# Flat-bottomed position restraints not working

**URL:** <https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554>\
**Category:** User discussions\
**Created:** [February 8, 2021, 7:19am UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554 "2021-02-08T07:19:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gonzaloqe](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/gonzaloqe/32/653_2.png) [@gonzaloqe](https://gromacs.bioexcel.eu/u/gonzaloqe)\
**Post date:** [February 8, 2021, 7:19am UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554/1 "2021-02-08T07:19:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [February 8, 2021, 9:38am UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554/2 "2021-02-08T09:38:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gonzaloqe](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/gonzaloqe/32/653_2.png) [@gonzaloqe](https://gromacs.bioexcel.eu/u/gonzaloqe)\
**Post date:** [February 8, 2021, 7:09pm UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554/3 "2021-02-08T19:09:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [February 8, 2021, 7:50pm UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554/4 "2021-02-08T19:50:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gonzaloqe](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/gonzaloqe/32/653_2.png) [@gonzaloqe](https://gromacs.bioexcel.eu/u/gonzaloqe)\
**Post date:** [February 9, 2021, 2:57pm UTC](https://gromacs.bioexcel.eu/t/flat-bottomed-position-restraints-not-working/1554/5 "2021-02-09T14:57:56Z")

</div>

It worked. thanks Justin and Hess.

Kind regards.
