>> ParticleFunction: >> - Why does ParticleFunction take Particles? If you want that it >> should >> be ParticlesFunction, but it seems to me what we really want is for >> it >> to only take one particle and then use apply methods if we want to >> apply it to more than one. Otherwise we will be creating Particles >> with one Particle everywhere. > yes ... , but then I'll have to do a loop each time I want to rotate a > molecule. Write a method to apply it to a molecule. And another to apply it to a Particles. > > maybe it would be better to have MolecularHierarchyDecoratorFunction ? > So I could just give as input the root of the molecule? If it takes a single particle it is easy enough to have a method which traverses the hierarchy and applies it to each atom, for example. This is annoying to do with the current definition.
> >> >> - apply should be pure virtual so that you can tell if you got the >> name or signature wrong when overriding it. > sure. >> >> - at least one of the methods needs to be defined in a .cpp to get >> linking and casting right when using multiple libraries > For some reason python can not find the function implementation if it > is in the cpp file. It happened to Joerg as well - is there anything > else other than updating the include/Sconscript, ,src/Sconscript and > pyext/misc.i ? I'm not quite sure what you mean. What exactly happens? And what were you doing? See UnaryFunction as an example of how it should be.
As it stands now, each library which uses ParticleFunction will have its own definition of the base class and they will not be interconvertible (i.e. a ParticleFunction defined in IMP.core cannot be used in something in Kernel which expects a particlefunction).