Analyze the convergence of the IMP.em.FitRestraint. The script build a simple model and then displays the derivatives, em score and how well conjugate gradients converges under various displacements of the model.
6 from __future__
import print_function
13 use_rigid_bodies =
True
26 prb.set_name(
"rigid body")
31 print(
"initial frame", drb.get_reference_frame())
33 drb.set_coordinates_are_optimized(
True)
35 refiner.add_particle(prb, [p])
37 print([p.get_name()
for p
in refiner.get_refined(prb)])
42 d.set_coordinates_are_optimized(
True)
51 dheader.set_resolution(1)
53 dmap.set_particles([p])
71 m.set_log_level(IMP.SILENT)
74 opt.set_scoring_function(sf)
76 def try_point(i, j, k):
77 print(
"trying", i, j, k)
79 to_move.set_coordinates(vc)
86 print(
"score and derivatives", v, to_move.get_derivatives())
90 print(
"after", d.get_coordinates())
91 mag = to_move.get_coordinates().get_magnitude()
96 sg.set_color(converge_color)
97 sg.set_name(
"converge")
100 try_point(-bd, -bd, -bd)