This example shows how to create a simple statistical potential using the PredicatePairsRestraint.
20 ps[0].add_attribute(ik, 0)
21 ps[1].add_attribute(ik, 1)
22 ps[2].add_attribute(ik, 0)
23 ps[3].add_attribute(ik, 1)
30 def do_get_inputs(self, m, pis):
32 return [m.get_particle(i)
for i
in pis]
34 def get_value_index(self, m, pis):
36 if not all(m.get_has_attribute(ik, pi)
for pi
in pis):
37 print(
"particle pair %s is untyped" % str(pis))
40 ts = sorted(m.get_attribute(ik, pi)
for pi
in pis)
41 ind = (ts[1] * ts[1]+1) // 2 + ts[0]
42 print(
"particle pair %s types %s map to %d" % (pis, ts, ind))
58 r.set_is_complete(
False)
62 print(
"Score is", sf.evaluate(
False))