IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
7import modeller
8import IMP
9import IMP.core
10import IMP.modeller
11import sys
12
13IMP.setup_from_argv(sys.argv, "IMP restraints in Modeller")
14
15# Set up Modeller and build a model from the GGCC primary sequence
16e = modeller.Environ()
17e.edat.dynamic_sphere = False
18e.libs.topology.read('${LIB}/top_heav.lib')
19e.libs.parameters.read('${LIB}/par.lib')
20modmodel = modeller.Model(e)
21modmodel.build_sequence('GGCC')
22
23# Set up IMP and load the Modeller model in as a new Hierarchy
24m = IMP.Model()
25protein = IMP.modeller.ModelLoader(modmodel).load_atoms(m)
26
27# Create a simple IMP distance restraint between the first and last atoms
28atoms = 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
36t = modmodel.env.edat.energy_terms
37t.append(IMP.modeller.IMPRestraints(atoms, sf))
38
39# Calculate the Modeller energy (score) for the whole protein
40sel = modeller.Selection(modmodel)
41sel.energy()
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
Gather all the molecular particles of a certain level in the hierarchy.
Distance restraint between two particles.
Harmonic function (symmetric about the mean)
Create a scoring function on a list of restraints.
A Modeller restraint which evaluates an IMP scoring function.
Read a Modeller model into IMP.
Basic functionality that is expected to be used by a wide variety of IMP users.
Interface to the Modeller comparative modeling package.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.