output from compute com/molecule

Hi lammps users,

I try to get an output from the compute com/molecule command, which calculates the center of mass per molecule, but I cannot work it out.

I read the manual again and again but I can’t find the mistake in my script. It is global so I load it into a variable but I can’t get it dumped not by thermo_style nor by fix ave/time.

Please help. My input script is the following:

compute com/molecule gives you an array with 3 columns and n rows, where n is the number of water molecules that you have. In your case, c_centofmass[1][1] is the x co-ordinate of the first molecule's com, c_centofmass[2][2] is the y co-ordinate of the second molecule's com, etc. This is explained at the bottom of the compute com/molecule manual page (this is usually where the output of commands is explained) http://lammps.sandia.gov/doc/compute_com_molecule.html.

What is it that you want to calculate? The average position of the centre of mass of each water molecule?

Thanks a lot for your answer. I just want an output file with the centers of mass (x y z) for all water molecules per snapshot. To explain:

“snap 1”

Mol_id xcom ycom zcom





“snap N”

Mol_id xcom ycom zcom

Thanks in advance,


I think I found it, the “mode vector” was missing.

Don't forget to change Nevery, Nrepeat and Nfreq if you only want the instantaneous values of the COMs.

I guess it should be se to 1 1 1 right?

Thanks again for the concern.

If you want it for every timestep, yes. Or every tenth timestep would be 10 1 10, etc.