This example optimizes a set of a balls to form 100 chains packed into a box. It illustrates using Monte Carlo (incremental) and conjugate gradients in conjunction in a non-trivial optimization.
36 p.set_name(
"P"+str(i)+
" "+str(j)+
" "+str(k))
40 movers[-1].set_was_used(
True)
43 d.set_coordinates(base)
45 d.set_coordinates_are_optimized(
True)
57 rss.add_restraint(bbr)
71 isf.add_close_pair_score(sps, 0, aps, filters)
76 nbl.set_pair_filters(filters)
80 mc.set_incremental_scoring_function(isf)
83 mc.set_scoring_function(sf)
90 cg.set_scoring_function(sf)
92 print "collisions", nbl.evaluate(
False),
"bonds", rss.evaluate(
False),
93 print bbr.evaluate(
False)
106 isf.set_log_level(IMP.base.TERSE)
107 mc.set_kt(100.0/(3*j+1))
108 print "mc", mc.optimize(ni*nj*np*(j+1)*100), m.evaluate(
False), cg.optimize(10)
110 print "collisions", nbl.evaluate(
False),
"bonds", rss.evaluate(
False),
111 print "bounding box", bbr.evaluate(
False)