Keren and Frido want to be able to create restraints that act on spherical 'blobs' - which may correspond to protein domains or perhaps to some other defined group of atoms - while at the same time having restraints on the underlying atoms themselves. Thus, the positions of the blobs need to match the positions of the atoms. (In the Modeller or CHARMM worlds, this would be achieved with a gravity center pseudoatom).
Thus, a proposal: a GravityCenterScoreState, which would take a list of hierarchy particles and a boolean flag (to turn on/off mass weighting). It would provide a method set_positions() which would set xyz attributes for each hierarchy particle to match the gravity center of the child atoms. (These attributes would be marked as non-optimizable, of course, since they are derived.) It would also have a protected method transform_derivatives(), which would back-transform any forces on the gravity center to the children.
(Note that there are several other kinds of pseudo or virtual atom, such as the several Modeller uses for NMR. If there is interest in these we could of course come up with a suitable class hierarchy. For example, one extension would be to turn the hierarchy particle into a sphere, by also populating a radius attribute, e.g. from the radius of gyration of the children. But I think currently nobody uses anything but gravity centers anyway.)
This ScoreState would require a change to the API. ScoreState::update (called before the score is evaluated) would be renamed ScoreState::pre_update and a new ScoreState::post_update method would be added (called after the score is evaluated). Gravity centers would simply call set_positions() from pre_update() and transform_derivatives() from post_update(). Existing ScoreStates would provide a do-nothing implementation for post_update().
Comments?
Ben