# How can we generate itp file for flat-bottom position restraint?

**URL:** <https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198>\
**Category:** User discussions\
**Created:** [May 27, 2020, 9:52am UTC](https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198 "2020-05-27T09:52:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hosyadav](https://avatars.discourse-cdn.com/v4/letter/h/e68b1a/32.png) [@hosyadav](https://gromacs.bioexcel.eu/u/hosyadav)\
**Post date:** [May 27, 2020, 9:52am UTC](https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198/1 "2020-05-27T09:52:17Z")

</div>

GROMACS version: 2020.1  
GROMACS modification: Yes/No  
Here post your question  
Hi GROMACS users,

When we use pdb2gmx, it automatically gives us a position restraint itp for our system. If special position restraints [.itp file] are required, one can use genrestr utility of the gromacs. I want to apply a flat-bottom position restraint on a water layer in z+ and z- directions. There are other molecules also in the system but they are above and below the water layer. The thickness of water layer is 1 nm. As much I understood, the format of the flat-bottom position restraint for water would be as following:

; Position restraint for each water oxygen  
[position\_restraints]  
; i funct g r k  
1 2 5 0.5 1000

where funct = 2 will ensure the flat-bottom potential, g = 5 will ensure its applicability only in the z-direction, r = 0.5 is the half-width of the flat-bottom potential, and k = 1000 is of course force constant. Possibly, this itp will apply force on water molecules if any water molecule is below [COM\_water (z) - 0.5] nm or above [COM\_water(z) + 0.5] nm, where COM\_water(z) is the center of mass of the water molecules.

Now my question is following:  
I wrote the above itp by hand. Is it possible to get this itp by “gmx genrestr” utility or by other utility of GROMACS? In the present example, I have water. So it is easy to write it by hand. But other complex system, it might be difficult. I don’t see any option in genrestr to define function type etc.

---

<div class="post-metadata">

**Author:** ![cblau](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cblau/32/5_2.png) [@cblau](https://gromacs.bioexcel.eu/u/cblau)\
**Post date:** [May 27, 2020, 2:12pm UTC](https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198/2 "2020-05-27T14:12:37Z")

</div>

Hi Hosyadav,

gmx genrestr does not allow setting the function type.

It will help you half-way through though in generating the vanilla function type 1 harmonic restraints; you will have to edit the generated files yourself though to update the function type and the other following parameters.

---

<div class="post-metadata">

**Author:** ![hosyadav](https://avatars.discourse-cdn.com/v4/letter/h/e68b1a/32.png) [@hosyadav](https://gromacs.bioexcel.eu/u/hosyadav)\
**Post date:** [May 27, 2020, 3:09pm UTC](https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198/3 "2020-05-27T15:09:26Z")

</div>

Dear cblau,  
Thank you so much for replying the query. I suspected the same. Anyway I will use some script to write itp.  
Thanks once again for your response.

---

<div class="post-metadata">

**Author:** ![s.pallav](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/s.pallav/32/1099_2.png) [@s.pallav](https://gromacs.bioexcel.eu/u/s.pallav)\
**Post date:** [June 28, 2022, 1:45pm UTC](https://gromacs.bioexcel.eu/t/how-can-we-generate-itp-file-for-flat-bottom-position-restraint/198/4 "2022-06-28T13:45:55Z")

</div>

Hi @hosyadav,  
how did you generate one?
