IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
doc/examples/domino/merge_tree.py
1## \example domino/merge_tree.py
2# The example shows how to generate and inspect a merge tree for use in Domino.
3
4import IMP
5import IMP.domino
6import IMP.core
7import IMP.container
8import IMP.algebra
9import sys
10
11IMP.setup_from_argv(sys.argv, "merge tree")
12
13IMP.set_log_level(IMP.TERSE)
14m = IMP.Model()
15# don't print messages about evaluation
16m.set_log_level(IMP.SILENT)
17
18bb = IMP.algebra.BoundingBox3D((0, 0, 0), (10, 10, 10))
19allc = []
20for i in range(0, 7):
21 p = IMP.Particle(m)
24 allc.append(d.get_coordinates())
26ss = IMP.domino.XYZStates(allc)
27for p in m.get_particle_indexes():
28 pst.set_particle_states(m.get_particle(p), ss)
29# generate a set of restraints based on the close pairs in this randomly
30# chosen configuration
32cp.set_distance(1)
33cps = cp.get_close_pairs(m, m.get_particle_indexes())
34
35if len(cps) > 0:
36 # one cannot create a container from an empty list
38else:
42
43# compute the interaction graph based on all the restraints
45 pst)
46# generate a junction tree from the interaction graph
48print(dir(jt))
49print(type(jt))
50# create a merge tree from the junction tree, this can be passed to
51# IMP.domin.DominoSampler
53s = pst.get_subset()
54print(s, type(s))
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
Store a list of ParticleIndexPairs.
Applies a PairScore to each Pair in a list.
Find all nearby pairs by testing all pairs.
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition XYZR.h:48
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
VectorD< D > get_random_vector_in(const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density.
Various classes to hold sets of particles.
Basic functionality that is expected to be used by a wide variety of IMP users.
Divide-and-conquer inferential optimization in discrete space.
MergeTree get_merge_tree(ScoringFunctionAdaptor input, const ParticleStatesTable *pst)
InteractionGraph get_interaction_graph(ScoringFunctionAdaptor rs, const ParticleStatesTable *pst)
SubsetGraph get_junction_tree(const InteractionGraph &ig)
void set_log_level(LogLevel l)
Set the current global log level.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.