Computing centrosymmetry parameter with time-averaged positions

Hello,

I’m trying to write my own compute which will calculate the centrosymmetry parameter using a running average of the positions. I am using fix ave/atom in my input script to average the unwrapped atom positions. Then I just slightly modified compute_centro_atom.cpp to use the vectors generate by these fixes instead of atom->x when calculating the distance between atoms. This works for atoms in center of the box, but not for atoms which have nearest neighbors across the periodic boundaries. I think the issue has something to do with the ghost atoms near the boundaries. I’m not sure exactly how LAMMPS is averaging the “unwrapped” position of those ghost atoms (or if it is at all). What I essentially need is just the same array given by atom->x but averaged over time.

Any ideas for the best way to go about this?

Thank you!
Lauren

Greetings,
the centrosymmetry uses the ghost atoms by accessing x[1:nmax] and using the neighbor list arrays whereas the fix is averaging over x[1:nlocal] atom datums for each processor; this means your centrosymmetry modification is probably(idk exactly what you did) using unaveraged x data for the ghost atoms.

The fix ave/atom command doc page has a NOTE about averaging
wrapped (x) vs unwrapped (xu) coords. You can then dump
out the unwrapped coords to see if they make sense within
your modified compute as inputs the centro symmetry calc.
If what fix ave/atom is producing is not exactly what you
want, then your new compute should wrap/etc those coords
the way you need them. E.g. apply minimum image conventions.
What centrosymmetry needs is a central atom and coords
of its nearby neighbors. They need to all be consistent (i.e all
the coords are close to each other). If you start a simulation
with atoms with a variety of image flags, there is no guarantee
unwrapping all of them will produce atom coords close to each other.

Note that you could also do a time average of the centro-symmetry
param w/out writing any new code. That is different than
CS of time-averaged coords, but maybe equally good for your purposes.

Steve

Thanks for the replies. My issue was that the neighbor list was giving me atom indices for ghost atoms, which I didn’t have the time averaged coordinates for. What I ended up doing was finding the averaged position of the “real" atom for those ghost atoms and then just applying the minimum image convention to those. It works exactly how I wanted!

Thank you again!
Lauren