# [lammps-users] (no subject)

Hi Steve,

So “fix 2 all setforce NULL NULL 0” has the same effect as “fix enforce2d”, is it right? However, I got exactly the same results in 50000 steps by using “” fix 2 all setforce NULL NULL 0" and “velocity set x y z NULL NULL 0”, but they are different from the result by using “set enforce2d” method. I don’t think my results are consistent with your explanation. If you need the my file for test, I will be more than happy to make a small package and give it to you offline. Thanks!

Best!

Dongsheng

Again, enforce2d zeroes both the z force and z velocity every step.
Your fix setforce will only zero the z force every step. Your velocity
will only zero the velocity initially. If something else gives your
particles velocity, then they may move. Dump the velocities and
forces every step. Are they zero?

Steve

Steve,

Thank you for your reply. According to your explanation, "fix enforce2d " is equivalent to the combination of “velocity set x y z NULL NULL 0” (set initial vz = 0) and “fix 2 all setforce NULL NULL 0” (set force fz = 0, so vz = 0 all the time).

I have make three input files, they are using those three different ways to control vz. All of them give me zeros of fz, z, vz for 500 steps. “velocity set x y z NULL NULL 0” and “fix 2 all setforce NULL NULL 0” give me exactly the same potential energy from thermo ouput. "fix enforce2d " gives me different potential energies.

I will send you my test package offline. If you can test it, I will highly appreciate it.

Best!

Dongsheng

One of your scripts is dimension 2, the other is dimension 3.
You're running with fix nvt which is a global thermostat which
rescales all velocities, including x,y, based on degrees of freedom,
which depends on dimensionality. I.e. if you tell LAMMPS its
a 3d simulation and all your particles move in 2d, LAMMPS doesn't
know that. If you are going to do a 2d simulation, then
use dimension 2 and use fix enforce2d.

Steve