Fix mass-weighting of centre-of-mass (COM) force#550
Conversation
…mass-weighted expressions
…r of mass-weighted interactions means that single atom interactions are not scaled up by mass, so scaling factor has to compensate)
…pler (new behaviour of mass-weighted interactions means that single atom interactions are not scaled up by mass, so scaling factor has to compensate))
…r (new behaviour of mass-weighted interactions means that single atom interactions are not scaled up by mass, so scaling factor has to compensate))
…x/mass-weighted-force # Conflicts: # python-libraries/nanover-server/src/nanover/imd/imd_force.py
|
One test failing: Don't know whether this test makes sense anymore, perhaps we need to check if any of the masses of the atoms to which a force is applied have zero masses? Previously this will only have been caught by the mass-weighted implementation of the force (returning zero energy in this case), so non-mass-weighted forces will have had non-zero energy, results that are clearly inconsistent and should be addressed anyway. |
…ion are zero, and explicitly check the total mass of the interaction atoms regardless of weighting scheme
…raction with a set of particles of which a subset have zero mass
|
For now, I have altered the function that applies the interactive forces to calculate the total mass of the particle group regardless of the weighting scheme (i.e. mass-weighted or non-mass-weighted), and if the total mass of the group is zero then the forces and energies are also zero. This should cover the following cases:
If only a subset of the particle group have zero mass, this is automatically covered for the mass-weighted case. However in the non-mass-weighted case, if a subset of atoms have zero mass it is necessary to define which atoms have zero mass and only distribute the applied force over the atoms with non-zero mass. I have adjusted the implementation of the non-mass-weighted force to cover this scenario. If we keep this it will be important to put a note in the documentation to let users know that the interaction forces are only distributed over particles in the selection with non-zero masses. |
This PR aims to address issue #549 by correcting the mass-weighting procedure for the COM-type interaction. In doing so, this PR makes the following changes to the code: