fix rigid issues with temperature and kinetic energy

Hello LAMMPS users,

I am running a simple simulation in an attempt to isolate a problem with using rigid bodies. I have 3 to 5 H2O molecules in a cube with periodic boundary conditions. The H2O molecules consist of 3 beads and have a ‘fix rigid’ applied so that hydrogens will not separate from the oxygens. Pair potentials between the molecules are governed by lj/cut between the oxygens. I use a langevin thermostat to maintain a constant temperature. The log file is set to track the temperature and kinetic energy. Units are in nondimensional lj.

The issues arise from the log file where the kinetic energy (not the temperature) appears to fluctuate around the value of my desired temperature. In addition, the degrees of freedom is unexpected. According to ‘compute temp’ documentation, temperature is supposed to be calculated by summation of (1/2)mv^2 = (d/2)NkT. For my 3D system, this means the average kinetic energy should be (3/2)kT. Using the results from my log file, I find the degrees of freedom or the ratio of average kinetic energy to temperature varies by number of molecules: 5/6 for 3 molecules and 9/10 for 5 molecules. Is there an explanation that I am overlooking in regards to the kinetic energy and temperature when I use ‘fix rigid’? I can provide my data and log files if you feel those would help.

Thanks in advance,
-Leebyn

If you’re using a thermostat, why wouldn’t the KE or temperature
fluctuate?

Compute temp subtracts out degrees-of-freedom for rigid
body constraints, as its doc page indicates. It also subtracts

out 3 additional DOF for the center of mass, as its doc page
indicates, which will be significant for your small system.

Steve

Steve,

I did expect the kinetic energy and temperature to fluctuate, but I did not expect the temperature to not match what I set on my thermostat. Instead, it is as if the temperature and kinetic energy values in the log file have been swapped.

So if compute temp is subtracting degrees-of-freedom for rigid bodies, should I use ‘compute_modify extra 0’ to have it not subtract them? Also, should I expect the temperature and kinetic energy relation to approach 3 degrees-of-freedom when I use a larger system?
Thanks for replying,
-Leebyn

I only told you what LAMMPS is doing with those
commands when used on rigid bodies. The doc pages

give further details. I think you’ll have to figure out how
to setup your simulation and interpret what those computes
are telling you.

Steve