Proper thermostatting

Dear LAMMPS users,

I have defined a system with a certain volume and periodic boundary conditions. I need to cool the system according to a linear law, for example, by 0.1 in a time of 10000 (lj units). I use the Langevin thermostat. My understanding of the documentation is that I should write
fix 1 all langevin 1.3 1.2 10000 48279
However for 2000000 steps with step 0.005 nothing happens and the temperature stays 1.3 (which was set with ‘velocity all create 1.3’)
Why?

When using the same
fix 2 all nvt temp 1.3 1.2 10000
Temperature rises instantly to 16.6

Then you have a poor understanding of the documentation. The end temperature should be reached by the end of the next run command. The third numerical parameter in each fix is the damping parameter, which has a different mechanism in fix nvt than it does in fix langevin. Please read the documentation more carefully for selections of the Nose-Hoover and Langevin damping parameters.

For example, using fix 1 all nvt temp 1.3 1.2 $(dt*100) followed by run 100000, the Nose-Hoover thermostat will change atom velocities to attempt a temperature of ~1.3 at step 1, 1.25 at step 50000, and 1.2 at step 100000.

Okay, got it.
But it’s still not clear with this parameter for the Langevin thermostat.
When its numbers are large, the random temperature jumps are very large. With small numbers it is small, but even with $(1.0*dt) - the temperature deviation is about 20% of the average.

fix langfix all langevin 1.3 1.2 $(1.0*dt) 48279
run 2000000

The behavior you describe is expected. In most cases you want a weak coupling to the thermostat, i.e. the Tdamp parameter should be rather large. The magnitude of the temperature fluctuations is dependent on multiple factors, including system size.

The fact that the measured temperature deviates from the target value significantly for larger Tdamp, however, is a bad sign. It could be an indication that your other simulation parameters are not good and thus you won’t have good energy conservation. After running your simulation with a thermostat at a constant temperature with a Tdamp of 100-1000 times the timestep for a while, the temperature should be conserved with about the same magnitude of fluctuations when running with just fix nve and without the thermostat. If the temperature increases significantly, then you have to investigate why this is the case. This is impossible to say from remote without knowing more about your simulation and its setup.

Yes, indeed, you’re right, the Tdamp parameter should be relatively large.

I have a simple argon-like system.
With the following script, the temperature rises almost instantly to 1.4.
If I set the thermostat to a constant temperature with the same settings, the temperature first holds constant with large deviations, and when you remove the thermostat, it also rises to 1.4

One more question: what is the time scale in LAMMPS? Correspond it to the dimensionless mass 24 or 48?

variable nvz        equal 3/130
variable Nparticles equal 10000
variable Volc       equal ${Nparticles}/${nvz}
variable sigm_vol   equal ${Volc}^(1/3)

lattice fcc ${nvz}
region allbox block 0 ${sigm_vol} 0 ${sigm_vol} 0 ${sigm_vol} side in units box
create_box 1 allbox
create_atoms 1 box

mass		1 24
pair_style lj/cut/omp 2.5
pair_coeff 1 1 1 1
pair_modify shift yes

velocity all create 1.3 87287 dist gaussian sum no mom yes rot yes

timestep 0.005
thermo 10000

fix NVEF    all nve

minimize 0.0 1.0e-8 1000 100000

run 200000

This script does not include equilibration which is required for this kind of test.

please see the documentation of the units command

setting the particle mass different from 1 in a single atom type simulation in reduced units is a pretty pointless step. all that you achieve by this is that you are changing the meaning of the time unit.

Does this mean that if the mass parameter is set to 1, the time corresponds to mass 1? At least that is what your words and documentation suggest. I need the time unit to correspond to mass 24 for comparison with other calculations.

It is the same with the equilibrium stage - after changing the potential to LJ the temperature increases to 1.4
Or am I misunderstanding this stage? It is needed to disperse the particles throughout the volume, no?

variable nvz        equal 3/130
variable Nparticles equal 10000
variable Volc       equal ${Nparticles}/${nvz}
variable sigm_vol   equal ${Volc}^(1/3)
variable seed equal 48279

lattice fcc ${nvz}
region allbox block 0 ${sigm_vol} 0 ${sigm_vol} 0 ${sigm_vol} side in units box
create_box 1 allbox
create_atoms 1 box

mass		1 24

timestep 0.005
thermo 10000

pair_style soft/omp 2.5
pair_coeff * *  100.0 2.5

fix NVEF    all nve
fix LANGFIX all langevin   1.3 1.3 1.0 ${seed} tally yes zero yes

run 200000

unfix LANGFIX

run 200000

pair_style lj/cut/omp 2.5
pair_coeff 1 1 1 1
pair_modify shift yes

run 200000

Yes. Please consult your preferred text book on MD simulations about equilibration. Discussing this in detail here would be off-topic.