Flat-bottomed position restraints not working

GROMACS version:2020.3
GROMACS modification: No

Dear GROMACS users, I had try to do osmotic pressure for NH4+ Cl- molecules in a water solution simulation using a flat-bottomed position restraints as other works in literature. I copy the itp that I use for the molecules of NH4+:

[ moleculetype ]
; Name nrexcl
NH4 3
[ atoms ]
; nr type resnr resid atom cgnr charge mass
1 N3 1 NH4 NP 1 -0.400000 14.0067
2 H 1 NH4 H 1 +0.350000 1.0080
3 H 1 NH4 H 1 +0.350000 1.0080
4 H 1 NH4 H 1 +0.350000 1.0080
5 H 1 NH4 H 1 +0.350000 1.0080
;total charge +1.000
[ bonds ]
; ai aj funct c0 c1
1 2 1 ; N3 H
1 3 1 ; N3 H
1 4 1 ; N3 H
1 5 1 ; N3 H
[ angles ]
; ai aj ak funct angle fc
2 1 3 1
2 1 4 1
2 1 5 1
3 1 4 1
3 1 5 1
4 1 5 1
[ position_restraints ]
; atom type g r (nm) K (kJ/mol/nm2)
1 2 5 3.0 1000
2 2 5 3.0 1000
3 2 5 3.0 1000
4 2 5 3.0 1000
5 2 5 3.0 1000

The objetive for me is to have all the NH4+ molecules within a cutoff in the Z direction of 3 nm from the center of the box, where the lenght Lz is 8 nm.

But when i run the simulations in NVT is seems that every molecule of NH4+ is moving in all z directions as the restriction are not applied.

The itp for the molecule is correct or something else?

kind regards

Did you supply a restraint file to grompp with the -r option with all z-coordinates set to 4?

I used the same configuration file in the -c option as in the -r option.

Could you explain how to set the z coordinates?

Best regards.

Change the coordinates using a text editor, or write a script to do so.

It worked. thanks Justin and Hess.

Kind regards.