LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] Compute center of mass using wrapped coordinates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] Compute center of mass using wrapped coordinates


From: Pengyu Huang <hughh.py@...24...>
Date: Sat, 17 Jun 2017 00:39:13 +1000

Dear LAMMPS developers,

I would like to use the spherical binning to calculate the local density and pressure for a droplet simulation. It will be a droplet with both liquid and vapour phase in a periodic simulation box, but only a very little particles will be presented in the vapour phase. To do the spherical binning, the center of the mass of the droplet would need to be placed at the center. For a large droplet, the center of mass will not be drifted much from the middle, while for a small droplet it would drift a bit from the middle (not too far away). What I found from literature is that the center of mass of the droplet (or entire system, if not many vapor particles) is recentered at every a few timesteps. 

I think this can be done in LAMMPS: if I can use the wrapped coordinates to compute the center of mass, and then use "fix recenter", although the recenter is done at every timestep. I did a search through the LAMMPS mailing list, I found Stan asked a similar question before and Steve commented it should be fine to do this for all atoms in a system. (http://lammps.sandia.gov/threads/msg28439.html) I then modified the codes in Group::xcm() as Stan mentioned it. I changed from "cmone[0] += unwrap[0] * massone; ..." to "cmone[0] += x[i][0] * massone; ...", for all three cmone. The thermodynamics results (energy, temperature, etc...) are the same in both original and modified LAMMPS, when no "fix recenter" is applied. When using "fix recenter" to kept the center of mass at the middle, I found the thermodynamics values drifted and diverged after a few thousand steps. I think this should be expected due to the numerical errors of shifting the coordinates. 

I want to double check with you to see if the modification I made in LAMMPS are truly valid, just in case I miss something. For example, would the newly computed center of mass affect any important fix functions (fix nvt, npt and etc) in LAMMPS? If this works, it will also provide a bit more information to people who want to do the similar thing in LAMMPS. I would really appreciate it if you can give me some comments. 

Thank you for your time.

Regards,
Pengyu