IMP  2.4.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 from __future__ import print_function
8 import modeller
9 import IMP
10 import IMP.modeller
11 
12 # Set up Modeller and build a model from the GGCC primary sequence
13 e = modeller.environ()
14 e.edat.dynamic_sphere = False
15 e.libs.topology.read('${LIB}/top_heav.lib')
16 e.libs.parameters.read('${LIB}/par.lib')
17 modmodel = modeller.model(e)
18 modmodel.build_sequence('GGCC')
19 
20 # Add a simple Modeller distance restraint between the first and last atoms
21 feat = modeller.features.distance(modmodel.atoms[0], modmodel.atoms[-1])
22 r = modeller.forms.gaussian(feature=feat, mean=10.0, stdev=1.0,
23  group=modeller.physical.xy_distance)
24 modmodel.restraints.add(r)
25 
26 # Set up IMP and load the Modeller model in as a new Hierarchy
27 m = IMP.kernel.Model()
28 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
29 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
30 
31 # Use the ModellerRestraints class to add all of the Modeller restraints to
32 # the IMP scoring function
33 m.add_restraint(IMP.modeller.ModellerRestraints(m, modmodel,
34  atoms))
35 
36 # Calculate the IMP score
37 print(m.evaluate(False))