IMP
2.0.0
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
core/custom_hierarchy.py
This example shows how to create and use a custom hierarchy of particles.
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
7
def
custom_hierarchy
(parent_particle, children_particles):
8
tr=
IMP.core.HierarchyTraits
(
"my hierarchy"
)
9
pd=
IMP.core.Hierarchy.setup_particle
(parent_particle, tr)
10
for
p
in
children_particles:
11
cd=
IMP.core.Hierarchy.setup_particle
(p, tr)
12
pd.add_child(cd)
13
pd.show()
14
15
m =
IMP.Model
()
16
p1 =
IMP.Particle
(m)
17
p2 =
IMP.Particle
(m)
18
p3 =
IMP.Particle
(m)
19
custom_hierarchy
(p1, (p2, p3))