IMP  2.4.0
The Integrative Modeling Platform
modeller/load_modeller_model.py

This demonstrates reading in an existing Modeller model, and converting the Modeller restraints (both static and dynamic) into equivalent IMP restraints.

1 ## \example modeller/load_modeller_model.py
2 # This demonstrates reading in an existing Modeller model, and converting the
3 # Modeller restraints (both static and dynamic) into equivalent IMP restraints.
4 #
5 
6 from __future__ import print_function
7 import modeller
8 import IMP
9 import IMP.modeller
10 
11 # Set up Modeller and build a model from the GGCC primary sequence
12 e = modeller.environ()
13 e.edat.dynamic_sphere = True
14 e.libs.topology.read('${LIB}/top_heav.lib')
15 e.libs.parameters.read('${LIB}/par.lib')
16 modmodel = modeller.model(e)
17 modmodel.build_sequence('GGCC')
18 # Generate Modeller stereochemistry
19 sel = modeller.selection(modmodel)
20 modmodel.restraints.make(sel, restraint_type='STEREO', spline_on_site=False)
21 
22 # Set up IMP and use the ModelLoader class to load the atom coordinates
23 # from Modeller into IMP as a new Hierarchy
24 m = IMP.kernel.Model()
25 loader = IMP.modeller.ModelLoader(modmodel)
26 protein = loader.load_atoms(m)
27 
28 # Load each Modeller static restraint in as an IMP.kernel.Restraint
29 for r in loader.load_static_restraints():
30  m.add_restraint(r)
31 
32 # Load each Modeller dynamic restraint (soft-sphere in this case) in as an
33 # equivalent IMP.kernel.Restraint
34 for r in loader.load_dynamic_restraints():
35  m.add_restraint(r)
36 
37 print(m.evaluate(False))