[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] Removing particle storage in restraints



I had mentioned this a while ago and would like to bring it up again since now seems like a good time to deal with it: I would like to remove the particle storage in the Restraint base class.

The reasons for this are:
- a significant fraction of the restraints don't use it so it is just taking up space (not significant) and presenting an opportunity for bugs since you could accidently look at the wrong storage or use the default get_interacting_particles when it is inappropriate.
- if a Restraint does used it, it imposes an unstructured storage mechanism on the restraint: that is, restrictions on the set of particles (since that it is always two particles, or always a set of pairs) are ignored. This makes a number of the restraints more complicated.
- for the Restraints which do use it, the amount of code savings in minimal to negative (it is negative in the case where the raw storage mechanism is exposed since that has to be done through using statements.
- If it is removed, to port restraints which currently use it you would simply add:
  IMP_LIST(protected, Particle, particle, Particle*)
to your class declaration and
IMP_LIST_IMPL(Restraint, Particle, particle,Particle*,,,);
in your .cpp file.
if you used the default get_interacting_particles, (you are probably doing a bad thing), you would also have to add 
ParticlesList get_interacting_particles() const
{
  return ParticlesList(1, Particles(particles_begin(), particles_end()));
}
in your header.