# A question about compute inertia/chunk command

Dear.
I am using lammps version 3Mar20, and I have 14 atom types in my system, of which all atoms of 12 atom types form an ellipsoidal shape. I would like to use the compute inertia/chunk command to calculate the inertia tensor of all atoms with respect to the center of mass of the ellipsoid. What I found in the manual is to treat each molecule as a chunk or each type of atom as a chunk, but the inertia tensor calculated this way is the inertia tensor of all chunks with respect to the center of mass of the chunk itself, not with respect to the center of mass of the ellipsoid.

So my idea is to treat all atoms of the 12 atom types as one chunk, but I didn’t find the relevant command in the manual, can you give me some advice? Thank you very much!!!

jack

I dont know if it could save the day in your case, but you could use the variable command (see variable command — LAMMPS documentation) to set up an atom style variable that calculates the components of the inertia tensor. As an atom style variable, the calculation would be performed for every atom at every time instant. When specifying the formula for the calculation, you can make reference to the center of mass of the group of atoms composing the ellipsoid accordingly: this can be computed at every single time instant by means of the “compute com” (see compute com command — LAMMPS documentation).

You can then choose a suitable way to output the information depending on what you want. You could output individual values of the inertia tensor components at different time instants using the dump command. Or maybe a “compute reduce” (see compute reduce command — LAMMPS documentation) + plugging it’s ID on the thermo_style command can work depending on what you want (like, if you wanted average values for example).

Maybe there is a command that is able to do it in a more straightfoward fashion. I never worked with inertia tensor (I even had to google the formula to be honest), so I wouldnt know.

It is very difficult to give specific advice on a such a generic description.
Can you create a very small and simple input and data file to illustrate your problem?

Thank you very much for your answer, but I also used the compute com command to calculate the center of mass of the ellipsoid and used the variable command to define the three coordinates of the center of mass. But some errors appeared in the subsequent calculations that I could not solve.

This is a part of my input file

units real
boundary p p p
dimension 3
atom_style full
neighbor 2.0 bin

neigh_modify every 1 delay 0 check yes page 300000 one 5000

mass 1 12.011
mass 2 15.999400
mass 3 15.999400
mass 4 1.008
mass 5 12.011
mass 6 1.008
mass 7 12.011
mass 8 1.008
mass 9 12.0111
mass 10 1.008
mass 11 15.9994 #O(spce)
mass 12 1.008 #h(spce)
mass 13 14.0067 #N(N2)
mass 14 15.9994 #O(O2)

group water type 11 12
group myatoms type 1 2 3 4 5 6 7 8 9 10 11 12

compute cc1 myatoms chunk/atom molecule
compute myChunk myatoms inertia/chunk cc1
fix 1 myatoms ave/time 1000 1 1000 c_myChunk[*] file tmp.out mode vector

Using the above command, each molecule is considered as a chunk and the inertia tensor of each chunk is calculated with respect to the center of mass of the chunk itself, but I want to calculate the inertia tensor of all molecules in myatoms with respect to the center of mass of myatoms. All molecules in myatoms look like an ellipsoidal shape using vmd.

Is the error, by any chance, something such as “Compute used in variable between runs is not current"? If it is the case, it suffices to put an output command (such as shown below) in order to have values for using in the definition of the variables later on.

e.g.:

``````(...)

compute		c_ID group-ID com

thermo_style    custom step c_ID[1] c_ID[2] c_ID[3]
thermo          10

fix              1 all nvt temp 300 300 \$(100*dt)
run              0
unfix            1

variable 	xcom equal c_ID[1]
variable 	ycom equal c_ID[2]
variable 	zcom equal c_ID[3]

(...)

``````

That is not what I asked for.