Fix Shake destroy temperature gradient

Hi lammps user,

I’m trying to establish temperature gradient for liquid water by using both “fix shake” and “fix thermal/conductivity”.
At the first few time step, temperature gradient can be seen, but later I’m sure it is just destroyed by “fix shake”. If I delete fix shake, everything goes well. I know “fix thermal/conductivity” cannot be used with “fix shake” for molecules due to unbalance in energy and momentum, but what I’m confusing is why “Fix Shake” will damage temperature gradient during later period?

To my understanding, what Shake did is changing forces on atoms, and molecules will be constrained during the later integration . In other words, velocities on atoms will not be bothered too much. So if I use “fix ave/spatial” to monitor average kinetic energy in each layer, temperature gradient (kinetic energy) can be easily observed. If I increase the swap frequency, temperature gradient can be established faster, but what happen is gradient at beginning, but gradually damaged later. Please help me out. Thanks.

To my understanding, what Shake did is changing forces on atoms, and
molecules will be constrained during the later integration . In other words,
velocities on atoms will not be bothered too much.

I am not familiar with the fixes you are using. But I did want to
reply to this one point you made here. Constraints like "fix_rigid"
and "fix_shake" reduce the number of degrees of freedom of the system,
and should reduce the total kinetic energy of the system. (by
preventing relative motion along the direction of a bond axis, for
example. Under simple NVT or NPT conditions, the routines which
compute and regulate the temperature normally take this into account
so you don't have to worry about it.)

As you noticed, in the the lammps manual under "fix
thermal/conductivity" it says:
"LAMMPS does not check, but you should not use this fix to swap the
kinetic energy of atoms that are in
constrained molecules, e.g. via fix shake or fix rigid. This is
because application of the constraints will alter the
amount of transferred momentum."

It sounds like the problem with "fix shake" occurs when molecules
collide: for some reason the amount of energy being transferred
between them is not correct to maintain the temperature gradient. So
as more time passes, more collisions occur, it seems like the problem
should grow. This sounds consistent with the behavior you are seeing.

I'm guessing that perhaps you don't see the problem initially if the
velocities were initially set to produce the desired temperature
gradient. (Someone can correct me if I'm wrong. I don't know how
this algorithm works.)

Anyway, if the manual is telling you not to use "fix
thermal/conductivity" with "fix shake", I would not argue with it.
:slight_smile:

Alternatively, you can use stiff harmonic bonds and angles to
approximate rigid bonds and angles (and use a smaller timestep).
Good luck.

Andrew