unwanted rotations

Hello,

I have a system consisting of three layers and some molecules between them. My system has periodicity only in z direction and I the box which I am using is a little bigger than the layers in x and y directions. Since I am using NVT method and I need the layers in z directions have fluctuations, I tried some different method to keep the layers constrained in all degrees of freedom except z direction such as the following ones.
In my first simulations I used:
timestep 1 # fs
fix 1 others nvt temp 300.0 300.0 100
fix 2 gul rigid/nvt single temp 300.0 300.0 100 torque * off off off force * off off on
fix 3 gll rigid/nvt single temp 300.0 300.0 100 torque * off off off force * off off on
fix 4 gml rigid/nvt single temp 300.0 300.0 100 torque * off off off force * off off on
run 100000

In the second simulation I used:
fix freeze1 up_layer setforce 0.0 0.0 NULL
fix freeze2 down_layer setforce 0.0 0.0 NULL
fix freeze3 mid_layer setforce 0.0 0.0 NULL
timestep 1 # fs
fix 1 all nvt temp 300.0 300.0 100 #y 1.0 1.0 1000 z 1.0 1.0 1000 couple xy
run 100000

And in the third simulation, I use both methods together. But in all of these simulations layers are rotating, so I would appreciate if any body have a suggestion.

Thanks in advance.

fix setforce is the right choice. You need to make sure that the
initial vx and vy are zero. You also need to make sure that no other
fixes are applied after these fixes. Try dumping out the velocities
to verify that everything is working right. Also, you could achieve
the same effect more gently by just fixing one or two atoms in each
layer.

vx and vy are zero. Any idea?

Other advices given?