IMP  2.0.1
The Integrative Modeling Platform
imp_restraints_in_modeller.py
1 ## \example modeller/imp_restraints_in_modeller.py
2 ## This demonstrates using IMP Restraints as additional energy terms in the
3 ## Modeller scoring function, so that IMP scoring terms can be incorporated into
4 ## existing comparative modeling pipelines.
5 ##
6 
7 import modeller
8 import IMP
9 import IMP.core
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 # Set up IMP and load the Modeller model in as a new Hierarchy
21 m = IMP.Model()
22 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
23 
24 # Create a simple IMP distance restraint between the first and last atoms
25 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
27  atoms[0].get_particle(),
28  atoms[-1].get_particle())
29 m.add_restraint(r)
30 
31 # Use the IMPRestraints class to add all of the IMP restraints to the
32 # Modeller scoring function
33 t = modmodel.env.edat.energy_terms
34 t.append(IMP.modeller.IMPRestraints(atoms))
35 
36 # Calculate the Modeller energy (score) for the whole protein
37 sel = modeller.selection(modmodel)
38 sel.energy()