# Fixing one dimension of simulation box in constant pressure

**URL:** <https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202>\
**Category:** User discussions\
**Created:** [December 5, 2020, 1:34am UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202 "2020-12-05T01:34:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggsmith123](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ggsmith123/32/520_2.png) [@ggsmith123](https://gromacs.bioexcel.eu/u/ggsmith123)\
**Post date:** [December 5, 2020, 1:34am UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/1 "2020-12-05T01:34:10Z")

</div>

2020-12-04T07:00:00Z  
GROMACS version:2020.3  
GROMACS modification: No

I have a quick and naive how-to question as a new user. Is there a way to run a constant pressure simulation where one dimension of the box is fixed at a constant length, so that pressure adjustments only occur in the other two dimensions of the simulation box? I can’t find a setting quite like this in the manual, but I’ve been told that the feature is probably in the program.

Thanks!

---

<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:** [December 5, 2020, 1:55am UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/2 "2020-12-05T01:55:30Z")

</div>

Semiisotropic coupling allows the box to deform uniformly in the x-y plane and independently in z. In your case, you would align your incompressible dimension along z and set the value of `compressibility` to zero for z.

---

<div class="post-metadata">

**Author:** ![Masrul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/masrul/32/234_2.png) [@Masrul](https://gromacs.bioexcel.eu/u/Masrul)\
**Post date:** [December 5, 2020, 3:41am UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/3 "2020-12-05T03:41:16Z")

</div>

[Anisotropic](http://manual.gromacs.org/documentation/current/user-guide/mdp-options.html) coupler could be an option. I used following settings to activate coupling along x-dimension.

```bash
pcoupl = Berendsen 
ref-p = 1.0 0.0 0.0 0.0 0.0 0.0  
compressibility = 4.5e-5 0.0 0.0 0.0 0.0 0.0    
tau-p = 2.0 
pcoupltype = anisotropic 

```

Similarly, non-zero second and third entry will activate y and z. Last three entries typically remain zero for rectangular box.

Regards,  
Masrul

---

<div class="post-metadata">

**Author:** ![ggsmith123](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ggsmith123/32/520_2.png) [@ggsmith123](https://gromacs.bioexcel.eu/u/ggsmith123)\
**Post date:** [December 11, 2020, 9:26pm UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/4 "2020-12-11T21:26:49Z")

</div>

This worked perfectly! Thanks!

-ggsmith

---

<div class="post-metadata">

**Author:** ![ggsmith123](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ggsmith123/32/520_2.png) [@ggsmith123](https://gromacs.bioexcel.eu/u/ggsmith123)\
**Post date:** [January 18, 2021, 6:28pm UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/5 "2021-01-18T18:28:11Z")

</div>

First, I want to thank you both, this helped me get started. I do have a follow up question that has turned up regarding the simulation of a semiisotropic (or anisotropic) system. Say I set the compressibility to zero on the z-axis input to fix that dimension of the box; if I set the reference pressure to 0.0 on that dimension, does it turn the referencing off, or does it cause the box to try to adopt a 0.0 bars pressure along that dimension? Is there some way to explicitly turn off referencing for one dimension? I know this might be a weird question, but I’m trying to compare the energies of two systems that are very similar but are different in a quite critical way where it’s clear that this critical difference is affecting the pressure equilibration such that they don’t tend to the same final pressures even though they are referenced the same way. I can’t compare the energies without STP. My current conclusion is that I’m setting something wrong.

Thanks,  
Greg

---

<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:** [January 18, 2021, 7:33pm UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/6 "2021-01-18T19:33:23Z")

</div>

Fixing the box vector simply requires `compressibility = 0`. The `ref-p` value in that dimension is then irrelevant as the box cannot adjust.

---

<div class="post-metadata">

**Author:** ![ggsmith123](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ggsmith123/32/520_2.png) [@ggsmith123](https://gromacs.bioexcel.eu/u/ggsmith123)\
**Post date:** [January 19, 2021, 9:37pm UTC](https://gromacs.bioexcel.eu/t/fixing-one-dimension-of-simulation-box-in-constant-pressure/1202/7 "2021-01-19T21:37:20Z")

</div>

Thank you! I had hoped this was the case.

Greg
