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