Question about Langevin thermalization+rattle algorithm


I need to create rigid dumbbells that are confined in two dimensions. I saw that there are different ways to do it, and opted for rattle algorithm.

As I need both to thermalize the system and set the force on z equals to zero, I used these fixes in sequence:

fix 1 all nve
fix 2 all langevin 0.05 0.05 0.1 7456
fix 3 all setforce NULL NULL 0.0
fix 4 all rattle 0.0001 20 100 b 1

My question is if I can apply a langevin thermostat to each particle after the velocity verlet integration (nullifying the force on z), and then constrain the two particles of a dumbbell to a definite length.
Would the system thermalize in this way correctly only the translational degrees of freedom for the center of mass and the rotational one?

I know I could do the same with
fix 1 all rigid/small molecule langevin 0.1 0.1 0.1 7456
fix 2 all enforce2d

but I need the first version for other issues and also because I think is a little bit faster using the rattle algorithm.

Thanks in advance!


If you are running with dimension=2 in LAMMPS,

you should always use fix enforce2d, and use

it as your last fix (after any other fix that may alter

forces, e.g. rattle or langevin). If you use

fix langevin with compute temp/partial as its

thermostat, then you can turn off the z force

it otherwise induces, and you won’t need fix setforce.

Or just let fix enforce2d set the z force back to 0.0.

Fix langevin does not operate “after the v-Verlet integration”.

It operates in the middle of the timestep, altering forces.

Thus if specify SHAKE or RATTLE after fix langevin,

it should account for those forces when applying the constraint.

Again, any z-force ratlle induces should be removed by

fix enforce2d.

As to whether the system will thermalize like you expect,

you’ll need to monitor that.