Source code of compute com/molecule

Dear All users

I want to use compute com/molecule to calculate the centroid of the molecular ring.

But in my lammps version, there is no such command. In which version is this command in? Is anyone willing to share this part of the source code with me?



You can put something like that together with:

compute molchunk all chunk/atom molecule
compute molcom all com/chunk molchunk

and then read out the molecular centres of mass. If you only want the COM of one molecule, you can even go simpler by defining one group using that molecule and then using the xcm(group, dim) functions for equal-style variables.


You must go back to a very old version to find this command. This is not recommended. We have generalized the per molecule or per grid compute and averaging fix styles with a feature called “chunks” over 7 years ago. Please see: 8.3.2. Use chunks to calculate system properties — LAMMPS documentation

1 Like

Thank you! It’s useful and work.

Thanks for your reply. It can solved my problem very well.