Accessing center of mass for rigid molecule objects

Thank you for the feedback!

In my experience, fix rigid/small does work for adding rigid molecules on the fly as specified by a molecule template file, and it does indicate that an infile should be able to store the centers of masses - here is the section of the documentation in question:

IMPORTANT NOTE: If you are using fix rigid/small and defining a system that has no rigid bodies initially, because they will be added on-the-fly by commands such as fix deposit or fix pour, you may still wish to use the infile keyword. This is so that restart files written during the simulation will output an auxiliary restart file as described above with information on the new rigid bodies. In this case the initial infile file should use N = 0.

I have tried this (having an infile that contains only “N=0” and no other lines), but I am unable to get this functionality to work.

Again, thank you,

Leah Roth

I think your Qs are confusing two issues. When using fix rigid/small (or fix rigid)

you can let LAMMPS compute the initial COM of each rigid body. Or you can

input a list of COMs you have pre-computed (useful for bodies with overlapping

finite-spheroids, for example, when LAMMPS can’t compute the COM correctly).

These COMs are updated during a run internal to LAMMPS. If you write a restart
file, and they were input from a file, then an output file with the COMs

is also written, so that you can restart the run. The doc page explains this.

For fix rigid you can also output the COMs via fix ave/time b/c the fix makes
the list of COMs available as global output - see the fix rigid doc page.

Fix rigid/small does not do this, mainly b/c the COMs are stored with individual
atoms, not in a global list like for fix rigid.

I can’t think of a simple way to thus “dump” the COMs for fix rigid/small.

However, if your rigid bodies are simple and uniform (all the same), you can
easily do this. LAMMPS assigns one atom per rigid body to store the COM.

It’s the atom geometrically closest to the COM. E.g for water rigid bodies,
it would be the O atom. If you make a “group” that is just the center atom
for all rigid bodies, you can dump the coords of those atoms in the usual way.

That will be very close to the COM of each body, maybe close enough for
your purposes. If you dump 2 or 3 atoms per
body, you could post-process the dump file and figure out the exact COM
yourself, again depending on the shape of your rigid bodies.

Steve