IMP logo
IMP Reference Guide  develop.031dafb4d2,2024/05/16
The Integrative Modeling Platform
modeller_restraints_in_imp.py
1 ## \example modeller/modeller_restraints_in_imp.py
2 # This demonstrates using Modeller restraints as additional terms in the IMP
3 # scoring function, so that existing Modeller restraints can be used in
4 # combination with new IMP restraints and optimization protocols.
5 #
6 
7 from __future__ import print_function
8 import modeller
9 import IMP
10 import IMP.modeller
11 import sys
12 
13 IMP.setup_from_argv(sys.argv, "Modeller restraints in IMP")
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 # Add a simple Modeller distance restraint between the first and last atoms
24 feat = modeller.features.Distance(modmodel.atoms[0], modmodel.atoms[-1])
25 r = modeller.forms.Gaussian(feature=feat, mean=10.0, stdev=1.0,
26  group=modeller.physical.xy_distance)
27 modmodel.restraints.add(r)
28 
29 # Set up IMP and load the Modeller model in as a new Hierarchy
30 m = IMP.Model()
31 protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
32 atoms = IMP.atom.get_by_type(protein, IMP.atom.ATOM_TYPE)
33 
34 # Use the ModellerRestraints class to add all of the Modeller restraints to
35 # the IMP scoring function
36 r = IMP.modeller.ModellerRestraints(m, modmodel, atoms)
38 
39 # Calculate the IMP score
40 print(sf.evaluate(False))
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.
An IMP restraint using all defined Modeller restraints.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Interface to the Modeller comparative modeling package.
Read a Modeller model into IMP.