# Using external harmonic potential

**URL:** <https://gromacs.bioexcel.eu/t/using-external-harmonic-potential/2565>\
**Category:** User discussions\
**Created:** [July 22, 2021, 9:33am UTC](https://gromacs.bioexcel.eu/t/using-external-harmonic-potential/2565 "2021-07-22T09:33:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehr](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/mehr/32/547_2.png) [@mehr](https://gromacs.bioexcel.eu/u/mehr)\
**Post date:** [July 22, 2021, 9:33am UTC](https://gromacs.bioexcel.eu/t/using-external-harmonic-potential/2565/1 "2021-07-22T09:33:56Z")

</div>

GROMACS version: 2016-4

Hello everyone,

I have a simulation box containing a layer of molecules in water. I want to use an external harmonic potential to the molecules to keep them still as a layer in water during NPT equilibration and MD production runs. Is it possible to do this using GROMACS mdp parameters or do I need to use coding?

Thank you in advance for any helps.

Please let me know if I should provide extra information about my simulation box.

Best,  
Mehry

---

<div class="post-metadata">

**Author:** ![Ali](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ali/32/170_2.png) [@Ali](https://gromacs.bioexcel.eu/u/Ali)\
**Post date:** [July 22, 2021, 6:33pm UTC](https://gromacs.bioexcel.eu/t/using-external-harmonic-potential/2565/2 "2021-07-22T18:33:38Z")

</div>

I guess you would like to use [position restraints](https://www.gromacs.org/Documentation_of_outdated_versions/How-tos/Position_Restraints).  
When generated, you need to then let grompp know you are using restraints, by modifying the `.mdp` file. You might find [this tutorial](http://www.mdtutorials.com/gmx/lysozyme/02_topology.html) useful for an example.

---

<div class="post-metadata">

**Author:** ![mehr](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/mehr/32/547_2.png) [@mehr](https://gromacs.bioexcel.eu/u/mehr)\
**Post date:** [July 22, 2021, 7:06pm UTC](https://gromacs.bioexcel.eu/t/using-external-harmonic-potential/2565/3 "2021-07-22T19:06:30Z")

</div>

Hi Ali,  
Thank you for your help. I will try it.
