IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
custom_hierarchy.py
1## \example core/custom_hierarchy.py
2# This example shows how to create and use a custom hierarchy of particles.
3
4import IMP
5import IMP.core
6import sys
7
8IMP.setup_from_argv(sys.argv, "custom hierarchy")
9
10
11def custom_hierarchy(parent_particle, children_particles):
12 tr = IMP.core.HierarchyTraits("my hierarchy")
13 pd = IMP.core.Hierarchy.setup_particle(parent_particle, tr)
14 for p in children_particles:
16 pd.add_child(cd)
17 pd.show()
18
19
20m = IMP.Model()
21p1 = IMP.Particle(m)
22p2 = IMP.Particle(m)
23p3 = IMP.Particle(m)
24custom_hierarchy(p1, (p2, p3))
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Class to handle individual particles of a Model object.
Definition Particle.h:45
Define the type for a type of hierarchy.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, DecoratorTraits tr=get_default_decorator_traits())
Basic functionality that is expected to be used by a wide variety of IMP users.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.
custom_hierarchy