# How does "-\[no\]correct (no)" flag works in gmx potential tool?

**URL:** <https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [January 29, 2025, 4:54pm UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410 "2025-01-29T16:54:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![prithvi](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@prithvi](https://gromacs.bioexcel.eu/u/prithvi)\
**Post date:** [January 29, 2025, 4:54pm UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/1 "2025-01-29T16:54:07Z")

</div>

GROMACS version:22.4  
GROMACS modification: No

Hi,

I have a simple membrane bilayer system, where POPC is the membrane lipid and is equilibrated with 150mM KCL, and **the net charge of the whole system is zero**.

I am trying to get the electrostatic potential of the system across the z-axis using the tool _gmx potential_.

When I use the _gmx potential_ command **without _-correct_** flag (gmx potential -f prd.0.conv.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_2.xvg -oc charge\_sys\_2.xvg -of field\_sys\_2.xvg -sl 100 -center), I get following plot as shown in left side of the figure.

When I use the _gmx potential_ command **with _-correct_** flag (gmx potential -f prd.0.conv.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_2.xvg -oc charge\_sys\_2.xvg -of field\_sys\_2.xvg -sl 100 -center -correct), I get the plot shown in right of the figure.

 ![Screenshot From 2025-01-29 22-22-02](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/9/98032d039be74807bc184c0e536133c981a84e37.png)

Since my system’s net charge is already zero, I don’t understand why I get two different results in these two cases (I think both cases should give the same results.). Can anyone please explain the reason behind this?  
Also, if there is any reference towards the workings of the command and related flag, please redirect me.

Thank you  
Prithvi

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [January 29, 2025, 5:08pm UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/2 "2025-01-29T17:08:53Z")

</div>

It looks like the right one is run with `-symm`, but not the left one.

Edit: Actually it doesn’t look like it’s symmetrized. My mistake. But it looks like the right one is run with `-center`, but not the left one.

---

<div class="post-metadata">

**Author:** ![prithvi](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@prithvi](https://gromacs.bioexcel.eu/u/prithvi)\
**Post date:** [January 30, 2025, 6:47am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/3 "2025-01-30T06:47:56Z")

</div>

Thanks for the reply,

Yes, the left one is without -center flag, but even if I include the -center flag the graph does not change, as shown below:

 ![Screenshot From 2025-01-30 12-15-27](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/1/17a025604c473eacfd86c5c54dc017320253570f.png)

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [January 30, 2025, 7:53am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/4 "2025-01-30T07:53:45Z")

</div>

OK. So the commands you showed above were not exactly correct. Are there any other differences in the commands? At least they’re more similar with `-center`. What would it look like with `-symm`? I’m not sure why `-correct` would make a difference, but I haven’t used `gmx potential` much.

From the output, my impression is that you might need to simulate (and/or equilibrate) longer to get rid of the overall tilt of the potential curve. How long is your current simulation and for how long was it equilibrated?

---

<div class="post-metadata">

**Author:** ![prithvi](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@prithvi](https://gromacs.bioexcel.eu/u/prithvi)\
**Post date:** [January 30, 2025, 9:59am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/5 "2025-01-30T09:59:42Z")

</div>

Here are the exact commands for the above plots:  
Left plot of figure-1:

> gmx potential -f prd.0.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_l\_50ns\_3.xvg -oc charge\_sys\_l\_50ns\_3.xvg -of field\_sys\_l\_50ns\_3.xvg -sl 100 -b 50000 -e 100000  
> Right plot of figure-1:  
> gmx potential -f prd.0.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_l\_50ns\_3.xvg -oc charge\_sys\_l\_50ns\_3.xvg -of field\_sys\_l\_50ns\_3.xvg -sl 100 -b 50000 -e 100000 -center -correct

figure-2:

> gmx potential -f prd.0.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_l\_50ns\_3.xvg -oc charge\_sys\_l\_50ns\_3.xvg -of field\_sys\_l\_50ns\_3.xvg -sl 100 -b 50000 -e 100000 -center

figure-3(shown below, with symmetry):

> gmx potential -f prd.0.xtc -n index\_2.ndx -s prd.0.tpr -o potenial\_sys\_l\_50ns\_3.xvg -oc charge\_sys\_l\_50ns\_3.xvg -of field\_sys\_l\_50ns\_3.xvg -sl 100 -b 50000 -e 100000 -center -symm
> 
> ![Screenshot From 2025-01-30 15-14-10](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/d/d643146c7c9bf95d8197a303f869ad488ac76feb.png)

I have done 15 ns of equilibration followed by 100 ns of production run. The system size is around ~45K atoms, and the box length is 6.7nmX6.7nmX9.6nm.

Even if it has not equilibrated properly and charges are distributed such that I get a potential plot like in figure-2, I am not sure why I am getting a different plot for _-correct_ flag, for a system with a zero net charge.

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [January 30, 2025, 10:12am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/6 "2025-01-30T10:12:59Z")

</div>

Thanks for the command lines and output with symmetry.

> [@prithvi](#):
>
> Even if it has not equilibrated properly and charges are distributed such that I get a potential plot like in figure-2, I am not sure why I am getting a different plot for _-correct_ flag, for a system with a zero net charge.

Neither am I. Hopefully, someone with more knowledge about the tool can bring some clarity.

---

<div class="post-metadata">

**Author:** ![Maya\_Zygadlo](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Maya\_Zygadlo](https://gromacs.bioexcel.eu/u/Maya_Zygadlo)\
**Post date:** [March 13, 2025, 10:15am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/7 "2025-03-13T10:15:13Z")

</div>

Thank you for all the informations !  
Have you found an answer to your problem ?

I am actually also working on a single bilayer system with a 150 mM of NaCl and wanted to get the potential with gmx potential. I am confronted to the same problem as you as the potential on each side of the membrane is not the same (with the right side being lower than the left one), and I don’t understand why.

 ![Capture d’écran du 2025-03-13 11-09-42](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/3/3b47988eccaf7a9747207fbf12cdd9f71a861667.png)  
The -correct option seems to get the potential how it should look like but I also have another system where there is an ionic imbalance on each side of the bilayer and if I use this option, it puts the potential of each side of the bilayer at 0 (which is not correct).  
If you have found out why it does so or have any new informations, I would be very glad to read about it as I am getting quite stuck on this issue.

---

<div class="post-metadata">

**Author:** ![prithvi](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@prithvi](https://gromacs.bioexcel.eu/u/prithvi)\
**Post date:** [March 17, 2025, 11:30am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/8 "2025-03-17T11:30:22Z")

</div>

> [@Maya\_Zygadlo](#):
>
> mbrane is not the sam

Hi Maya,  
Unfortunately, I still haven’t found the reason for this. I will update if I do; if you know any alternative ways(or tools) of calculating this potential, please do share.

---

<div class="post-metadata">

**Author:** ![Maya\_Zygadlo](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Maya\_Zygadlo](https://gromacs.bioexcel.eu/u/Maya_Zygadlo)\
**Post date:** [March 27, 2025, 2:44pm UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/9 "2025-03-27T14:44:57Z")

</div>

Hi again,

There is this link that explains the Poisson equation used to calculate the potential : [Calculating 1D electrostatic potential profile from MD simulations – Alta Fang](https://altafang.com/2020/10/13/calculating-1d-electrostatic-potential-profile-from-md-simulations/)  
The author here has written a python script for the main equation but it can be easily adapted if you don’t use LAMMPS as I do.  
The problem is that I still get some surprising results on my end but maybe this can help you. At least, it lets me know that it is not an issue of gmx potential but from something else which I’m still trying to resolve.  
I will let you know if I find an answer to my problem, so that it can maybe resolve your too !

---

<div class="post-metadata">

**Author:** ![Marius](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Marius](https://gromacs.bioexcel.eu/u/Marius)\
**Post date:** [March 28, 2025, 8:28am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/10 "2025-03-28T08:28:14Z")

</div>

Hi,

There is a publication ([https://pubs.aip.org/aip/jcp/article/130/21/215107/626544/Calculation-of-the-electrostatic-potential-of](https://pubs.aip.org/aip/jcp/article/130/21/215107/626544/Calculation-of-the-electrostatic-potential-of)) that describes a similar observation with the symmetric POPC membrane that you have simulated. The authors recommend post-processing the trajectory by centering all atoms in respect to the center of the membrane. They also discuss several equations necessary for calculating the one-dimensional potential, which may help you resolve or better understand your current issue.

Best,  
Marius

---

<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:** [March 28, 2025, 9:55am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/11 "2025-03-28T09:55:45Z")

</div>

I don’t understand how the -correct option is a valid approach. It sets the net charge of each slab to zero. That is changing the physics.

I don’t see how one can improve the potential calculation. This is straightforward physics where there is only a single solution. The -center option is useful (and doesn’t interfere with physics). Symmetrizing can be useful to increase statistics for cases where the system studied is actually expected to be symmetric.

---

<div class="post-metadata">

**Author:** ![wkopec](https://avatars.discourse-cdn.com/v4/letter/w/b5ac83/32.png) [@wkopec](https://gromacs.bioexcel.eu/u/wkopec)\
**Post date:** [March 19, 2026, 1:33pm UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/12 "2026-03-19T13:33:28Z")

</div>

Hi,

I believe the -correct flag should always be used and should be the default. My understanding of this flag is that it performs two mean subtractions during the classical double integration:

1. Before the first integration: subtract the mean charge density from all slices that have nonzero charge density. This makes the effective total charge exactly zero, removing a constant drift term from the electric field.

2. After the first integration: subtract the mean electric field (again, only from slices with nonzero charge density). This removes a constant offset from E(z), which would otherwise produce a linear drift in the potential.

I don’t think this is the same as "It sets the net charge of each slab to zero”. In our hands it produces consistent results that agree with expectations, and it removes the odd dependency on number of slabs that is typically seen (which comes from splitting molecules close to the boundaries during calculations, which is not fixed by several intuitive fixes). Some of the test systems and potential calculations are presented here: [https://www.biorxiv.org/content/10.1101/2022.10.18.512672v1.full.pdf](https://www.biorxiv.org/content/10.1101/2022.10.18.512672v1.full.pdf)

We also have experimental code where the Poisson equation is solved in the Fourier space, where periodicity is built in by construction. Importantly both methods (Fourier vs gmx potential with the -correct flag) produce identical results.

In our tests, the -correct flag works as intended even when an external electric field is applied, recovering the “Reaction Potential”, as described by Gumbart et al ( [Constant electric field simulations of the membrane potential illustrated with simple systems - ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0005273611003361?via%3Dihub) Figure 1, green curve).

Best,  
Wojciech

---

<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:** [March 20, 2026, 9:48am UTC](https://gromacs.bioexcel.eu/t/how-does-no-correct-no-flag-works-in-gmx-potential-tool/11410/13 "2026-03-20T09:48:35Z")

</div>

Your observations are correct. But the manual doesn’t say “It sets the net charge of each slab to zero”. It says “Assume net zero charge of groups to improve accuracy”. I agree this should be default when the net charge of groups is zero. But then we need to know if the net charge is zero. I suppose we could check for this.

But looking at the code, I don’t understand how correct can help. The summation variables are double precision. It seems to me that -correct will only help when charges of groups do not sum to exactly zero.
