[gmx-users] Re: [gmx-developers] Meaning of the -correct switch in g_potential

Justin Lemkul jalemkul at vt.edu
Sat Feb 23 23:39:32 CET 2013

Please post usage questions to gmx-users.  The gmx-developers list is for 
discussions on code modifications, bugs, and future directions of Gromacs.  I am 
CC'ing gmx-users on this reply; please keep the discussion there.

On 2/23/13 5:02 PM, Andrew DeYoung wrote:
> Dear Developers,
> I am very sorry to bother you, but if you have time, I am wondering if you
> can please help me to understand the meaning of the -correct option in
> g_potential.  This has been a confusing topic to me and to some of my fellow
> graduate students.  If you could please point me in the right direction as
> to understanding this, I would be deeply grateful.
> What is the purpose of the -correct option in g_potential?

It applies something of a smoothing factor to the charge density slices.

> I have a system in the slab geometry, so I use g_potential to compute the
> charge density, electric field, and potential along the z-direction.  I
> think that, essentially, g_potential bins the charges for each frame, and
> then integrates to obtain the electric field and electric potential along z.
> By default, -correct is OFF (i.e., -nocorrect).  But what if -correct is on?
> In the manual page, it says that -correct tells the program to "Assume net
> zero charge of groups to improve accuracy."  If you have time, I have three
> questions:
> (1) What does -correct do?  I am not very fluent at all in C, or in any
> programming language.  But, looking at gmx_potential.c, it seems that
> -correct somehow reassigns the values on the charge density arrays.  Can you
> please help me understand what it is doing?

That's what it's doing.  If the code detects slices that have non-zero charges, 
it adds up those charges and divides by the number of slices that have non-zero 
charge.  The code then loops back through these slices and deducts this average 
amount of excess charge from each slice.

> (2) What does it mean to "assume net zero charge of groups"?  When running
> g_potential, I compute using the entire System selection.  My entire system
> indeed has net zero charge (as any reasonable system should), so in that

Not all "reasonable" systems have zero charge ;)

> sense, yes, my selection (System) has net zero charge.  But my system
> contains an ionic liquid, so not all _charge_ groups have net zero chage.

The calculation is not done over charge groups; it is done over the number of 
groups selected for the calculation (command line -ng).  If you're using only 
the System group for analysis, then you have a group with zero charge.

> (3) Should I use -correct?  When I compute the charge density rho of my
> system (100,000 frames in a 10 ns trajectory) with and without the -correct
> switch, the electric potential profiles differ at the level of ~0.1-0.5 V,
> which is quite significant, I think.

Significance depends on how large the magnitude of the actual value is.  If it's 
400, then 0.1 or 0.5 probably don't matter that much, but if it's 0.5, then I'd 
say so.  That's up to you to determine.

If you're analyzing one group, and that group has a net charge of zero, the 
available documentation and my interpretation of the code suggests that you 
should indeed be using -correct.  You wouldn't in the case of analyzing, say, a 
protein channel that has a net charge, which would be a group that is a subset 
of the remainder of the (presumably) uncharged system.



Justin A. Lemkul, Ph.D.
Research Scientist
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080


More information about the gromacs.org_gmx-users mailing list