IMP logo
IMP Reference Guide  2.22.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 import modeller
7 import IMP
8 import IMP.modeller
9 import sys
10 
11 IMP.setup_from_argv(sys.argv, "Load Modeller model")
12 
13 # Set up Modeller and build a model from the GGCC primary sequence
14 e = modeller.Environ()
15 e.edat.dynamic_sphere = True
16 e.libs.topology.read('${LIB}/top_heav.lib')
17 e.libs.parameters.read('${LIB}/par.lib')
18 modmodel = modeller.Model(e)
19 modmodel.build_sequence('GGCC')
20 # Generate Modeller stereochemistry
21 sel = modeller.Selection(modmodel)
22 modmodel.restraints.make(sel, restraint_type='STEREO', spline_on_site=False)
23 
24 # Set up IMP and use the ModelLoader class to load the atom coordinates
25 # from Modeller into IMP as a new Hierarchy
26 m = IMP.Model()
27 loader = IMP.modeller.ModelLoader(modmodel)
28 protein = loader.load_atoms(m)
29 
30 # Load each Modeller static restraint, and each Modeller dynamic restraint
31 # (soft-sphere in this case) in as an IMP.Restraint
33  list(loader.load_static_restraints())
34  + list(loader.load_dynamic_restraints()))
35 
36 print(sf.evaluate(False))