Analyze the convergence of the IMP.em.FitRestraint. The script builds a simple model and then displays the derivatives, em score and how well conjugate gradients converges under various displacements of the model.
12 use_rigid_bodies =
True
25 prb.set_name(
"rigid body")
26 d.set_coordinates(IMP.algebra.Vector3D(0, 0, 0))
30 print(
"initial frame", drb.get_reference_frame())
32 drb.set_coordinates_are_optimized(
True)
38 d.set_coordinates_are_optimized(
True)
42 IMP.algebra.Vector3D(-bd - radius, -bd - radius, -bd - radius),
43 IMP.algebra.Vector3D(bd + radius, bd + radius, bd + radius))
46 dheader.set_resolution(1)
48 dmap.set_particles([p])
66 m.set_log_level(IMP.SILENT)
69 opt.set_scoring_function(sf)
72 def try_point(i, j, k):
73 print(
"trying", i, j, k)
74 vc = IMP.algebra.Vector3D(i, j, k)
75 to_move.set_coordinates(vc)
82 print(
"score and derivatives", v, to_move.get_derivatives())
86 print(
"after", d.get_coordinates())
87 mag = to_move.get_coordinates().get_magnitude()
92 sg.set_color(converge_color)
93 sg.set_name(
"converge")
97 try_point(-bd, -bd, -bd)