IMP logo
IMP Reference Guide  2.21.0
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 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()
A Modeller restraint which evaluates an IMP scoring function.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Create a scoring function on a list of restraints.
Distance restraint between two particles.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Interface to the Modeller comparative modeling package.
Basic functionality that is expected to be used by a wide variety of IMP users.
Read a Modeller model into IMP.
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:27