Masses are incorrectly evaluated for certain types of dynamic selections
For dynamic selections that compute center-of-mass or center-of-geometry positions of more than one atom, the total mass and charge are incorrectly calculated if the set of atoms changes between frames. For example, the following selection can cause issues:
res_com of (y > 2)
The masses are reported for all frames as they were on the initial evaluation, i.e., in this case for the whole residue. They may be too big if not all atoms of the residue are selected by the
y > 2condition for some particular frame.
Does not affect the behavior of g_select in 4.5 or 4.6, and is a relatively rare use case, so targeting the fix for 5.0 only.
Add tests for selection mass evaluation and fix it.
Removed unnecessary and at times incorrect precalculation of total
masses and charges for selected positions. Evaluate them again for each
frame if they may have changed.
Noticed when adding some tests for this behavior; the tests are also
Also store the masses and charges again in continuous arrays in
preparation for exposing those arrays.