12m.set_log_level(IMP.SILENT)
15for i, d
in enumerate(ds):
23 ds[0].get_particle_index(),
"0 at origin")
27 ds[1].get_particle_index(),
"1 on axis")
30for pr
in [(0, 1), (1, 2), (0, 2)]:
33 (ds[pr[0]].get_particle_index(), ds[pr[1]].get_particle_index()),
48def setup(cover, scale):
52 pst.set_particle_states(p, st)
54 r.set_maximum_score(.5 * scale ** 2)
61 sampler.set_restraints(rs)
62 sampler.set_subset_filter_tables(fs)
63 sampler.set_log_level(IMP.SILENT)
64 return (sampler, lf, pst)
67(sampler, lf, pst) = setup(covers[0], 4.0)
70ac = sampler.get_sample_assignments(subset)
75def get_mapping(cover0, cover1):
76 nn = IMP.algebra.NearestNeighbor3D(cover0)
77 ret = [[]
for c
in cover0]
78 for i, p
in enumerate(cover1):
79 nns = nn.get_nearest_neighbor(p)
87def display_mapping(index, cover0, cover1, mapping):
89 for i, c
in enumerate(mapping):
95 for i, c
in enumerate(cover0):
102for curi
in range(1, len(covers)):
103 scale = 4.0 / 2 ** curi
105 mapping = get_mapping(covers[curi - 1], covers[curi])
107 display_mapping(curi - 1, covers[curi - 1], covers[curi], mapping)
108 (sampler, lf, pst) = setup(covers[curi], scale)
112 for i, p
in enumerate(subset):
115 lf.set_allowed_states(p, allowed)
116 ccac = sampler.get_sample_assignments(subset)
120 print(
"for scale", scale,
"got", ac)
122 for i, a
in enumerate(ac):
128 for c
in covers[curi]:
Class for storing model, its restraints, constraints, and particles.
Class to handle individual particles of a Model object.
A harmonic score on the distance between two spheres.
Harmonic function (symmetric about the mean)
Applies a PairScore to a Pair.
Applies a SingletonScore to a Singleton.
Display an IMP::core::XYZR particle as a ball.
static XYZR setup_particle(Model *m, ParticleIndex pi)
static const FloatKeys & get_xyz_keys()
Get a vector containing the keys for x,y,z.
static Colored setup_particle(Model *m, ParticleIndex pi, Color color)
Write a CGO file with the geometry.
Sample best solutions using Domino.
Maintain an explicit list of what states each particle is allowed to have.
Filter a configuration of the subset using the Model thresholds.
Represent a subset of the particles being optimized.
Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
Basic functionality that is expected to be used by a wide variety of IMP users.
Color get_display_color(unsigned int i)
Divide-and-conquer inferential optimization in discrete space.
void load_particle_states(const Subset &s, const Assignment &ss, const ParticleStatesTable *pst)
Load the appropriate state for each particle in a Subset.
void setup_from_argv(int argc, char **argv, std::string description)
Parse the command line flags and return the positional arguments.