Question regarding density

Hello,

I am trying to write a script to calculate the density of a system in a LAMMPS simulation for every timestep. I am outputting lx, ly, and lz in thermo_style and I know the total mass of the system. My only concern is that lx, ly and lz are not equivalent to abs(xhi) + abs(xlo), abs(yhi) + abs(ylo), and abs(zhi) + abs(zlo) as shown in the dump file for the same corresponding timestep. This leads me to believe that one of the two is incorrect. I also realize in hindsight that I could have output density directly with thermo_style, but it’s too late for that now.

Thank you,

-Keith

Hello,

I am trying to write a script to calculate the density of a system in a
LAMMPS simulation for every timestep. I am outputting lx, ly, and lz in
thermo_style and I know the total mass of the system. My only concern is
that lx, ly and lz are not equivalent to abs(xhi) + abs(xlo), abs(yhi) +
abs(ylo), and abs(zhi) + abs(zlo) as shown in the dump file for the same
corresponding timestep. This leads me to believe that one of the two is
incorrect. I also realize in hindsight that I could have output density
directly with thermo_style, but it's too late for that now.

question: do you have an orthogonal or a triclinic cell?

as far as thermo output goes you always have:
lx = xhi - xlo, ly = yhi - ylo, lz = zhi - zlo

and volume always is lx*ly*lz

for triclinic cells, the output in the dump file is not xlo/xhi,
ylo/yhi, zlo/zhi, but the box boundaries, i.e. smallest/largest x/y/z,
which requires some math to convert to lz/ly/lz.

axel.

If you are not using a triclinic box, I can’t think

of any way the thermo lx,ly,lz would be out-of-sync

with the BOX BOUNDS in a dump file.

If you are using triclinic, then as Axel indicates,

the BOX BOUNDS mean something different,

This is explained on the dump doc page. And

the math eqs Axel mentions are in section 6.12

of the manual.

Steve