IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
modeller/modeller_restraints_in_imp.py

This demonstrates using Modeller restraints as additional terms in the IMP scoring function, so that existing Modeller restraints can be used in combination with new IMP restraints and optimization protocols.

1 ## \example modeller/modeller_restraints_in_imp.py
2 # This demonstrates using Modeller restraints as additional terms in the IMP
3 # scoring function, so that existing Modeller restraints can be used in
4 # combination with new IMP restraints and optimization protocols.
5 #
6 
7 import modeller
8 import IMP
9 import IMP.modeller
10 import sys
11 
12 IMP.setup_from_argv(sys.argv, "Modeller restraints in IMP")
13 
14 # Set up Modeller and build a model from the GGCC primary sequence
15 e = modeller.Environ()
16 e.edat.dynamic_sphere = False
17 e.libs.topology.read('${LIB}/top_heav.lib')
18 e.libs.parameters.read('${LIB}/par.lib')
19 modmodel = modeller.Model(e)
20 modmodel.build_sequence('GGCC')
21 
22 # Add a simple Modeller distance restraint between the first and last atoms
23 feat = modeller.features.Distance(modmodel.atoms[0], modmodel.atoms[-1])
24 r = modeller.forms.Gaussian(feature=feat, mean=10.0, stdev=1.0,
25  group=modeller.physical.xy_distance)
26 modmodel.restraints.add(r)
27 
28 # Set up IMP and load the Modeller model in as a new Hierarchy
29 m = IMP.Model()
30 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
31 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
32 
33 # Use the ModellerRestraints class to add all of the Modeller restraints to
34 # the IMP scoring function
35 r = IMP.modeller.ModellerRestraints(m, modmodel, atoms)
37 
38 # Calculate the IMP score
39 print(sf.evaluate(False))