IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
modeller/imp_restraints_in_modeller.py

This demonstrates using IMP.Restraints as additional energy terms in the Modeller scoring function, so that IMP scoring terms can be incorporated into existing comparative modeling pipelines.

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 import sys
12 
13 IMP.setup_from_argv(sys.argv, "IMP restraints in Modeller")
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 # Set up IMP and load the Modeller model in as a new Hierarchy
24 m = IMP.Model()
25 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
26 
27 # Create a simple IMP distance restraint between the first and last atoms
28 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
30  atoms[0].get_particle(),
31  atoms[-1].get_particle())
33 
34 # Use the IMPRestraints class to add this IMP scoring function to the
35 # Modeller scoring function
36 t = modmodel.env.edat.energy_terms
37 t.append(IMP.modeller.IMPRestraints(atoms, sf))
38 
39 # Calculate the Modeller energy (score) for the whole protein
40 sel = modeller.Selection(modmodel)
41 sel.energy()