Caching restraint scores so that restraints are not evaluated repeatedly for the same configuration is an important part of domino. Without caching, sub assignments that are shared between subsets will be rescored. The IMP::domino::RestraintCache provides a centralized place for this. To use it, one creates one and then adds the restraints you want to use for filtering and scoring to it. You can then pass the cache to the IMP::domino::RestraintScoreFilterTable and it will filter based on those restraints. You can also extract scores from the table directly, using it to manage the loading of particle states.
13 from __future__
import print_function
32 for i
in range(0, int(2.0 / resolution))]
38 p.set_radius(resolution / 2.0)
40 p.set_radius(.4 * resolution)
41 order = [eps[0]] + ps + [eps[1]]
44 for i, p
in enumerate(order):
54 r.set_maximum_score(0.01)
58 resolution, IMP.algebra.get_unit_bounding_box_3d())
60 vs = [g.get_center(i)
for i
in g.get_all_indexes()]
61 print(
"States are", vs)
65 pst.set_particle_states(p, states)
70 r.set_log_level(IMP.SILENT)
71 rc.add_restraints([r])
75 s.set_check_level(IMP.NONE)
80 s.set_subset_filter_tables([ef, rssft])
88 sts = s.get_sample_assignments(alls)
92 print(
"saving configurations to", rmf.get_name())
99 domino_restraints = rc.get_restraints()
101 for r
in domino_restraints:
106 print(
"found assignments", sts)
108 for i, s
in enumerate(sts):
112 for r
in domino_restraints:
113 rc.load_last_score(r, alls, s)