[BUG] CenterOfMassesTrajectory changes elements and density
Description of the error When running CenterOfMassesTrajectory analysis on a DFTB water trajectory (from MDANSE-Examples), the resulting trajectory contains only hydrogen atoms.
Describe the expected result I would expect the following results:
- If grouping="atom", the output trajectory should be identical to the input,
- If grouping="molecule", the output trajectory should contain one object per molecule. I would expect it to be an artificial atom with the same mass at the mass of the original molecule.
Describe the actual result Instead, I got the following:
- With grouping="atom", from 200 H and 100 O atoms on input I got 300 H atoms in the output.
- With grouping="molecule" I got 100 H atoms. The number of H atoms is the same as the number of water molecules.
The figure compares the mass density of original water, molecule-grouped COM water and atom-grouped COM water.
Suggested fix Trajectory should have its own built-in atom database containing only the elements present in the system. This will make trajectories fully transferable and enable replacing molecules will artificial atoms that will conserve the mass of the system.
Additional details Even though it is possible to do statistics on molecule positions using the current implementation of COM trajectory, it will also become impossible to distinguish different molecules if they all get replaced with hydrogen.