# Cylindrical restraint with a certain length along the z-axis

**URL:** <https://gromacs.bioexcel.eu/t/cylindrical-restraint-with-a-certain-length-along-the-z-axis/487>\
**Category:** User discussions\
**Created:** [July 14, 2020, 6:51am UTC](https://gromacs.bioexcel.eu/t/cylindrical-restraint-with-a-certain-length-along-the-z-axis/487 "2020-07-14T06:51:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florida](https://avatars.discourse-cdn.com/v4/letter/f/fbc32d/32.png) [@Florida](https://gromacs.bioexcel.eu/u/Florida)\
**Post date:** [July 14, 2020, 6:51am UTC](https://gromacs.bioexcel.eu/t/cylindrical-restraint-with-a-certain-length-along-the-z-axis/487/1 "2020-07-14T06:51:45Z")

</div>

GROMACS version: 2019.6  
GROMACS modification: No

Same as the topic title, I’d like to apply cylindrical position restraint to all water molecules with a certain length along the z-axis.

For example, all water molecules from z = -1 nm to z = +1 nm (or -1 \< z \< +1) along the z-axis are restrained in a cylinder with a certain radius R (in x-y direction), and the water with z \< -1 nm or z \> +1 nm are free to move in the whole simulation box.

How can I achieve this goal?  
Anyone can show me an example?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![kevinboyd](https://avatars.discourse-cdn.com/v4/letter/k/c77e96/32.png) [@kevinboyd](https://gromacs.bioexcel.eu/u/kevinboyd)\
**Post date:** [July 18, 2020, 11:17pm UTC](https://gromacs.bioexcel.eu/t/cylindrical-restraint-with-a-certain-length-along-the-z-axis/487/2 "2020-07-18T23:17:01Z")

</div>

See my response to your other question

> [@No example in the manual](https://gromacs.bioexcel.eu/t/no-example-in-the-manual/494/2):
>
> Hi - if you have a request, please file an issue here: [https://gitlab.com/gromacs](https://gitlab.com/gromacs) The functional form is described here: [http://manual.gromacs.org/current/reference-manual/functions/restraints.html?highlight=cylinder#flat-bottomed-position-restraints](http://manual.gromacs.org/current/reference-manual/functions/restraints.html?highlight=cylinder#flat-bottomed-position-restraints) Cylindrical restraints are under flat-bottom potentials, the restraint format is described here and contains the inputs for radius and force constant: [http://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html](http://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html) The …
