home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.19.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
doc
examples
core
custom_hierarchy.py
1
## \example core/custom_hierarchy.py
2
# This example shows how to create and use a custom hierarchy of particles.
3
4
import
IMP
5
import
IMP.core
6
import
sys
7
8
IMP.setup_from_argv
(sys.argv,
"custom hierarchy"
)
9
10
11
def
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:
15
cd =
IMP.core.Hierarchy.setup_particle
(p, tr)
16
pd.add_child(cd)
17
pd.show()
18
19
20
m =
IMP.Model
()
21
p1 =
IMP.Particle
(m)
22
p2 =
IMP.Particle
(m)
23
p3 =
IMP.Particle
(m)
24
custom_hierarchy(p1, (p2, p3))
IMP::setup_from_argv
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
Model.h:86
IMP::core::Hierarchy::setup_particle
static Hierarchy setup_particle(Model *m, ParticleIndex pi, DecoratorTraits tr=get_default_decorator_traits())
Definition:
core/Hierarchy.h:116
IMP::core::HierarchyTraits
Define the type for a type of hierarchy.
Definition:
core/Hierarchy.h:50
IMP::core
Basic functionality that is expected to be used by a wide variety of IMP users.
custom_hierarchy
Definition:
custom_hierarchy.py:1
IMP::Particle
Class to handle individual particles of a Model object.
Definition:
Particle.h:43