bjmorgan / kinisi

A Python package for estimating diffusion properties from molecular dynamics simulations.
https://kinisi.readthedocs.io
MIT License
49 stars 11 forks source link

Include the ability to calculate a centre of geometry mean-squared displacement #37

Closed arm61 closed 2 months ago

arm61 commented 9 months ago

Currently, if you want to calculate the MSD for a molecule, there is a lot of gymnastics involving MDAnalysis to get here. This could be greatly simplified for the user by allowing a centre of geometry/mass calculation within kinisi (before the displacements are determined.

I think this would look best as something like

specie=[('C', 'O1', 'O2')]

For a CO2 molecule, i.e., the tuple defines the molecule that the centre of geometry/mass should be found over.

This should probably wait for the conclusion of #30 as it should also work for indices.

bjmorgan commented 9 months ago

How does it know which O–C–O are bonded and which are in separate molecules?

arm61 commented 9 months ago

If they are in a single tuple that is a molecule (in the structure I am suggesting). So if there were two molecules and you wanted the combined MSD of them it would be:

specie = [('C', 'O1', 'O2'), ('C', 'H1', 'H2', 'H3', 'H4')]
bjmorgan commented 9 months ago

Say I have two CO2 molecules in my simulation cell. Do I then set

species = [('C1', 'O1', 'O2'), ('C2', 'O3', O4')]

?

arm61 commented 8 months ago

It depends what the atom names in the simulation output are.

arm61 commented 8 months ago

I think that having the index identifier stuff helps with this as indices are more unique.

bjmorgan commented 8 months ago

I still don’t understand the proposal. Atoms in separate molecules should only contribute to the displacements of those molecules.

arm61 commented 8 months ago

Yeah so in:

species = [('C1', 'O1', 'O2'), ('C2', 'O3', O4')]

You would calculate 2 diffusions, one for the centre of geometry for molecule O1=C1=O2 and one for molecule O3=C2=O4 (I acknowledge that symmetrical CO2 molecules are not the most exciting to get the centre of geometry for).

bjmorgan commented 8 months ago

But why would you ever want individual diffusion for just two molecules, and not run e.g. a simulation with 1000s of CO2 molecules to get D*(CO2)? In which case, the specification syntax above becomes cumbersome.

arm61 commented 8 months ago

Just spoken to @jd15489, and we agree that having the specie working for both element types and atom types doesn't really work, i.e., if you want to look at all the molecule types of CO2 has two possible ways to be defined.

Therefore the proposed solution is that specie stays as it is to be user-friendly and only work with single elements. But if a users wants to track the centre-of-geometry of a molecule (or some molecules) then they would need to pass a indices keyword argument (and set specie to None), and this argument would be a list of list (or list of tuple) where each sub-list is the specific atom indices to be used to find the centre-of-geometry.

arm61 commented 8 months ago

Closing with @jd15489's PR #38. Thanks for the contribution @jd15489! 🚀 🎉

arm61 commented 8 months ago

Oops, closed the wrong issue

arm61 commented 4 months ago

@jd15489 can this be closed now?

jd15489 commented 2 months ago

Yes, this can be closed.