5 from __future__
import print_function
13 m.set_log_level(IMP.SILENT)
16 for i, d
in enumerate(ds):
24 ds[0].get_particle_index(),
"0 at origin")
28 ds[1].get_particle_index(),
"1 on axis")
31 for pr
in [(0, 1), (1, 2), (0, 2)]:
34 (ds[pr[0]].get_particle_index(), ds[pr[1]].get_particle_index()),
49 def setup(cover, scale):
53 pst.set_particle_states(p, st)
55 r.set_maximum_score(.5 * scale ** 2)
62 sampler.set_restraints(rs)
63 sampler.set_subset_filter_tables(fs)
64 sampler.set_log_level(IMP.SILENT)
65 return (sampler, lf, pst)
68 (sampler, lf, pst) = setup(covers[0], 4.0)
71 ac = sampler.get_sample_assignments(subset)
76 def get_mapping(cover0, cover1):
77 nn = IMP.algebra.NearestNeighbor3D(cover0)
78 ret = [[]
for c
in cover0]
79 for i, p
in enumerate(cover1):
80 nns = nn.get_nearest_neighbor(p)
88 def display_mapping(index, cover0, cover1, mapping):
90 for i, c
in enumerate(mapping):
96 for i, c
in enumerate(cover0):
103 for curi
in range(1, len(covers)):
104 scale = 4.0 / 2 ** curi
106 mapping = get_mapping(covers[curi - 1], covers[curi])
108 display_mapping(curi - 1, covers[curi - 1], covers[curi], mapping)
109 (sampler, lf, pst) = setup(covers[curi], scale)
113 for i, p
in enumerate(subset):
116 lf.set_allowed_states(p, allowed)
117 ccac = sampler.get_sample_assignments(subset)
121 print(
"for scale", scale,
"got", ac)
123 for i, a
in enumerate(ac):
129 for c
in covers[curi]:
Maintain an explicit list of what states each particle is allowed to have.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Sample best solutions using Domino.
A harmonic score on the distance between two spheres.
Filter a configuration of the subset using the Model thresholds.
Represent a subset of the particles being optimized.
Class for storing model, its restraints, constraints, and particles.
Color get_display_color(unsigned int i)
Apply a function to the distance to a fixed point.
static Colored setup_particle(Model *m, ParticleIndex pi, Color color)
An axis-aligned bounding box.
Basic functionality that is expected to be used by a wide variety of IMP users.
Class to handle individual particles of a Model object.
Write a CGO file with the geometry.
Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
Applies a PairScore to a Pair.
static const FloatKeys & get_xyz_keys()
Get a vector containing the keys for x,y,z.
void load_particle_states(const Subset &s, const Assignment &ss, const ParticleStatesTable *pst)
Load the appropriate state for each particle in a Subset.
Applies a SingletonScore to a Singleton.
Apply a function to an attribute.
Divide-and-conquer inferential optimization in discrete space.
Display an IMP::core::XYZR particle as a ball.
Harmonic function (symmetric about the mean)