IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
rigid_bodies.py
1## \example core/rigid_bodies.py
2# This example shows how to set up rigid bodies, one per residue in a protein.
3# A score state is then used to ensure that the bodies remain rigid during
4# the optimization process.
5#
6
7import IMP
8import IMP.core
9import IMP.atom
10import IMP.container
11import sys
12
13IMP.setup_from_argv(sys.argv, "rigid bodies")
14
15m = IMP.Model()
16# create a new IMP.atom.Hierarchy for the pdb file
17mp1 = IMP.atom.read_pdb(IMP.core.get_example_path('example_protein.pdb'), m)
18chains = IMP.atom.get_by_type(mp1, IMP.atom.CHAIN_TYPE)
19rd = IMP.atom.Hierarchy(chains[0])
20# Create a rigid body from the first chain
21# note that rbs != chains[0] as the bounding volume for rbs needs to include
22# all of the chain, but chains[0] might have a smaller sphere associated
23# with it.
24rbs = IMP.atom.create_rigid_body(chains[0])
25print("all done")
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
The standard decorator for manipulating molecular structures.
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
Gather all the molecular particles of a certain level in the hierarchy.
Functionality for loading, creating, manipulating and scoring atomic structures.
IMP::core::RigidBody create_rigid_body(const Hierarchies &h, std::string name=std::string("created rigid body"))
Rigidify a molecule or collection of molecules.
Hierarchy read_pdb(TextInput input, Model *model, PDBSelector *selector=get_default_pdb_selector(), bool select_first_model=true)
Read all the molecules in the first model of the PDB file.
Various classes to hold sets of particles.
Basic functionality that is expected to be used by a wide variety of IMP users.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.