Optimize six particles on a 2D unit grid. In order to remove translation degrees of freedom, the 0th particle is pinned at the origin by allowing it only a single conformation. To remove flips, the first particle is restrained to have a positive x coordinate.
15 def create_scoring(m, ps):
16 pairs = [[0, 1], [0, 2], [1, 3], [2, 3], [3, 4], [4, 5], [1, 5]]
24 pr.set_maximum_score(.01)
33 dr.set_maximum_score(.01)
34 print m.get_root_restraint_set()
38 def create_representation(m):
48 def create_discrete_states(ps):
55 vs = vs + [-v
for v
in vs]
56 print len(vs),
"states for each particle"
61 pst.set_particle_states(p, states)
65 def create_sampler(m, r, pst):
82 states.set_log_level(IMP.base.SILENT)
83 s.set_assignments_table(states)
84 s.set_subset_filter_tables(filters)
91 m.set_log_level(IMP.base.SILENT)
93 print "creating representation"
94 ps = create_representation(m)
95 print "creating discrete states"
96 pst = create_discrete_states(ps)
97 print "creating score function"
98 rs = create_scoring(m, ps)
99 print "creating sampler"
100 s = create_sampler(m, rs, pst)
109 print "found ", cs.get_number_of_configurations(),
"solutions"
110 for i
in range(cs.get_number_of_configurations()):
111 cs.load_configuration(i)
112 print "solution number:", i,
" is:", m.evaluate(
False)