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.
13 def create_scoring(m, ps):
14 pairs=[[0,1],[0,2],[1,3],[2,3],[3,4],[4,5],[1,5]]
22 pr.set_maximum_score(.01)
31 dr.set_maximum_score(.01)
32 print m.get_root_restraint_set()
35 def create_representation(m):
44 def create_discrete_states(ps):
51 vs= vs+[-v
for v
in vs]
52 print len(vs),
"states for each particle"
57 pst.set_particle_states(p, states)
60 def create_sampler(m, r, pst):
77 states.set_log_level(IMP.base.SILENT);
78 s.set_assignments_table(states)
79 s.set_subset_filter_tables(filters)
86 m.set_log_level(IMP.base.SILENT)
88 print "creating representation"
89 ps=create_representation(m)
90 print "creating discrete states"
91 pst=create_discrete_states(ps)
92 print "creating score function"
93 rs=create_scoring(m, ps)
94 print "creating sampler"
95 s=create_sampler(m, rs, pst)
104 print "found ", cs.get_number_of_configurations(),
"solutions"
105 for i
in range(cs.get_number_of_configurations()):
106 cs.load_configuration(i)
107 print "solution number:",i,
" is:", m.evaluate(
False)