This example shows how to create a simple statistical potential using the PredicatePairsRestraint.
5 from __future__
import division
21 ps[0].add_attribute(ik, 0)
22 ps[1].add_attribute(ik, 1)
23 ps[2].add_attribute(ik, 0)
24 ps[3].add_attribute(ik, 1)
31 def do_get_inputs(self, m, pis):
33 return [m.get_particle(i)
for i
in pis]
35 def get_value_index(self, m, pis):
37 if not all(m.get_has_attribute(ik, pi)
for pi
in pis):
38 print(
"particle pair %s is untyped" % str(pis))
41 ts = sorted(m.get_attribute(ik, pi)
for pi
in pis)
42 ind = (ts[1] * ts[1]+1) // 2 + ts[0]
43 print(
"particle pair %s types %s map to %d" % (pis, ts, ind))
59 r.set_is_complete(
False)
63 print(
"Score is", sf.evaluate(
False))