IMP logo
IMP Reference Guide  2.6.1
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 import sys
11 
12 IMP.setup_from_argv(sys.argv, "Load Modeller model")
13 
14 # Set up Modeller and build a model from the GGCC primary sequence
15 e = modeller.environ()
16 e.edat.dynamic_sphere = True
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 # Generate Modeller stereochemistry
22 sel = modeller.selection(modmodel)
23 modmodel.restraints.make(sel, restraint_type='STEREO', spline_on_site=False)
24 
25 # Set up IMP and use the ModelLoader class to load the atom coordinates
26 # from Modeller into IMP as a new Hierarchy
27 m = IMP.Model()
28 loader = IMP.modeller.ModelLoader(modmodel)
29 protein = loader.load_atoms(m)
30 
31 # Load each Modeller static restraint, and each Modeller dynamic restraint
32 # (soft-sphere in this case) in as an IMP.Restraint
34  list(loader.load_static_restraints())
35  + list(loader.load_dynamic_restraints()))
36 
37 print(sf.evaluate(False))