# [lammps-users] Sharply different temperature in a fix nvt command

Hi, all

I’ve encounter a strange thing when using fix nvt command.

I have 2 kinds of molecules in the system, and atom type 1, 8 belong to
molecule “water” while atom type 2, 3, 4 belong to molecule “oil”, so I
wrote in my input file:

First, I would setup compute temp commands on
both groups (oil & water). Then I would verify
that they both start at 300 and then diverge (one
gets hot and one get's cold) but that the combination
of both groups stays at 300.

If that happens, then it is a possible outcome of using
one NVT thermostat on a heterogeneous group of
molecules. Basically, the thermostat applies a global
scaling factor which can affect different modes (molecules)
differently. One solution is to use 2 NVT thermostats,
one for water, one for oil. Another solution is to use a
different thermostat, like Langevin, which is applied
to each atom individually and typically doesn't have that
problem.

Steve

Hi, Steve

When using the command:

If the T of the water initially is 470K, then
you are doing something wrong. Either computing
its Temp wrong, or initiailizing it wrong. If you
are using a constrained water model (e.g. SHAKE)
then you need to account for the missing degrees of
freedom, but LAMMPS should do that for you if
you have setup the fixes correctly.

Steve

If water molecules are not constrained by SHAKE,
temperature for the water is well, starting at 300K
and keeps around that.

If fix shake is used for water molecules,

Case 1(only constrain the bonds)

Chen,

The issue is that LAMMPS chooses initial velocities with the assumption that there are no constraints. So when SHAKE is turned on, the initial temperature is a bit off and it takes a while for the temperature to settle to the thermostatted value. LAMMPS is correctly reporting the temperatures, including the effect of the constraints.

Paul

Are you specifying the fix shake before you initialize the velocities?
If you don't then LAMMPS has no way of knowing about SHAKE
when it sets the temperature.

Steve

I didn’t set fix shake before velocities are initialized.

But I just changed the inputfile.

When write fix shake before initializing velocities, it really made
some difference, the first Temperature value appeared changed
from 470K to 423K. But it still not 300K as I set in the fix nvt.

Chen Chen