I found the tutorial IMP2.4 that still use add_restraint attribute:
While you could probably make things work using add_restraint(), I would
advise against it. Both add_restraint() and remove_restraint() were
deprecated in IMP a long time ago, and will be removed in the upcoming
2.5 release. See
http://integrativemodeling.org/nightly/doc/ref/kernel_2basic_optimization_8py-example.htmlfor the latest recommended way to run that example. Just keep your
restraints in a Python data structure (such as a list), or in a
RestraintSet, and pass them to a RestraintsScoringFunction. To remove a
restraint, just remove it from that list or RestraintSet.
Given the m.add_restraint(r), how can I achieve m.remove_restraint(r) in
IMP 2.4?
If you really want to stick with add_restraint() for now,
m.remove_restraint(r) is equivalent to
m.get_root_restraint_set().remove_restraint(r) (which will also stop
working when IMP 2.5 is released).