IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
cover_particles.py
1## \example core/cover_particles.py
2# Show how to maintain a sphere per residue which includes all atoms
3# of the residue. The derivatives are propagated from the sphere
4# cover to the atoms so that restraints can be used at multiple
5# levels.
6
7import IMP
8import IMP.core
9import IMP.atom
10import sys
11
12IMP.setup_from_argv(sys.argv, "cover particles")
13
14m = IMP.Model()
15prot = IMP.atom.read_pdb(IMP.core.get_example_path('example_protein.pdb'), m)
16res = IMP.atom.get_by_type(prot, IMP.atom.RESIDUE_TYPE)
18for r in res:
19 # add coordinates and a radius to the residue particle
21 # make sure that the coordinates and the radius define a sphere
22 # which contains all of the leaves (atoms) of the residue
23 IMP.core.Cover.setup_particle(r.get_particle(), pr)
24# update the coordinates of the residue particles so that they cover the atoms
25m.update()
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierarchyTraits.
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
Gather all the molecular particles of a certain level in the hierarchy.
Return the hierarchy children of a particle.
static Cover setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor members)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition XYZR.h:48
Functionality for loading, creating, manipulating and scoring atomic structures.
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.
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.