# [gmx-users] semi-permeable wall in gromacs

gozde ergin gozdeeergin at gmail.com
Tue Apr 19 12:15:14 CEST 2016

```This is my posre.itp file;

[ position_restraints ]
; i  funct   g    r(nm)   k
1     2    5    2.4     4184
2     2    5    2.4     4184

My box size is 4.8*4.8*9.6. In the reference.gro file z positions of  all of the ions are set to 4.8 so I have two walls at 4.8+2.4=7.2nm  and 4.8-2.4=2.4nm
This step is working without any problem.

Than I use the command of;

gmx traj -f npt.trr -s npt.tpr -n index.ndx -ox coor.xvg -nox -noy

I extract all ions z-coordinate of the ions.
Than I use the equation in Roux2010 paper in order to estimate the osmotic pressure which is,

<Fwall1> = [k (1/N)sum(N) sum(i)(| zi-zwall1 |) and I apply this equation only the ions who have passed the wall.
<Fwall2> = [k (1/N)sum(N) sum(i)(| zi-zwall2 |)

Fwall = (Fwall1 + Fwall2)/2
P = <Fwall>/Area

However I get *very* different results than Roux2010. Even though our temperature, non-bond settings, system size etc are the same.

Has anyone here done simulations to calculate the osmotic pressure and/or osmotic coefficient?
Any suggestion?

Also Roux2010 mentioned that the force of the wall is *half harmonic* , what is the force in gromacs for flat-bottom restraint?

> On 07 Apr 2016, at 21:37, Justin Lemkul <jalemkul at vt.edu> wrote:
>
>
>
> On 4/7/16 12:57 PM, gozde ergin wrote:
>> Hi Justin,
>>
>> I just want to ask how is the r(nm) in posre.itp working?
>>
>> I would like to put semi-permeable wall on +/- 2.4 nm in z coordinate of the box.
>>
>> When I write 2.4 in the r(nm) property for [position_restraints] in posre.itp, it seems all of the molecules that I apply flat-bottom restraint travel +/- 2.4 nm.
>
> This is expected.  The flat-bottom potential is established with respect to the reference coordinates.
>
>> But I do not want this, I would like to put a wall or force on +/-2.4 nm in z of the box.
>>
>
> If you want walls at given z-values, the z-coordinate of species to which the restraint is applied have to be set to zero.  This coordinate file is passed to grompp -r as the reference point for the potential.
>
> -Justin
>
>>
>>
>>> On 21 Mar 2016, at 18:37, Justin Lemkul <jalemkul at vt.edu> wrote:
>>>
>>>
>>>
>>> On 3/21/16 1:29 PM, gozde ergin wrote:
>>>> Ok this was a silly question.
>>>> In g_energy command 5. one is flat-bottom posres force.
>>>> Sorry.
>>>>
>>>
>>> The output of g_energy is energy, not force.
>>>
>>> But the quantity is simple to calculate.  If you have applied a flat-bottom restraint along z, then you just need the time series of the z-coordinates of the restrained particles.
>>>
>>> F = k*(z-z0), where z0 is the position at which the flat-bottom restraint is active.  Since there are two walls, then you need to conditions, for +/- z0 and then the final sum should be divided by 2 before being divided by the area of the semipermeable wall.
>>>
>>> -Justin
>>>
>>>>> On 21 Mar 2016, at 17:26, gozde ergin <gozdeeergin at gmail.com> wrote:
>>>>>
>>>>> Hey Justin,
>>>>>
>>>>> I am just wondering in order to estimate the osmotic pressure I need extract the flat-bottom restraint force. (Force/Area = Pressure)
>>>>> Do you have any idea to how to extract this force?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On 10 Mar 2016, at 15:58, Justin Lemkul <jalemkul at vt.edu> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 3/10/16 4:44 AM, gozde ergin wrote:
>>>>>>> Dear Justin,
>>>>>>>
>>>>>>> Thanks for your respond, I assume there is a way to apply this restraint on specific molecules.
>>>>>>> Because my system is mixed with organic and water and I would like to apply these forces on organic molecules not water?
>>>>>>>
>>>>>>
>>>>>> So apply flat-bottom restraints to whatever the organic molecules are.  It's not something specific to ions.  You set the restraints in the molecule's topology (in its [moleculetype]), construct a reference coordinate file that defines some unphysical coordinates to be used as the center of the restraint, and that's it.  I've described the process in detail before so check the archive.
>>>>>>
>>>>>> -Justin
>>>>>>
>>>>>> --
>>>>>> ==================================================
>>>>>>
>>>>>> Justin A. Lemkul, Ph.D.
>>>>>> Ruth L. Kirschstein NRSA Postdoctoral Fellow
>>>>>>
>>>>>> Department of Pharmaceutical Sciences
>>>>>> School of Pharmacy
>>>>>> Health Sciences Facility II, Room 629
>>>>>> University of Maryland, Baltimore
>>>>>> 20 Penn St.
>>>>>> Baltimore, MD 21201
>>>>>>
>>>>>> jalemkul at outerbanks.umaryland.edu | (410) 706-7441
>>>>>> http://mackerell.umaryland.edu/~jalemkul
>>>>>>
>>>>>> ==================================================
>>>>>> --
>>>>>> Gromacs Users mailing list
>>>>>>
>>>>>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>>>>>>
>>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>>
>>>>>> * For (un)subscribe requests visit
>>>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.
>>>>>
>>>>
>>>
>>> --
>>> ==================================================
>>>
>>> Justin A. Lemkul, Ph.D.
>>> Ruth L. Kirschstein NRSA Postdoctoral Fellow
>>>
>>> Department of Pharmaceutical Sciences
>>> School of Pharmacy
>>> Health Sciences Facility II, Room 629
>>> University of Maryland, Baltimore
>>> 20 Penn St.
>>> Baltimore, MD 21201
>>>
>>> jalemkul at outerbanks.umaryland.edu <mailto:jalemkul at outerbanks.umaryland.edu> <mailto:jalemkul at outerbanks.umaryland.edu <mailto:jalemkul at outerbanks.umaryland.edu>> | (410) 706-7441
>>> http://mackerell.umaryland.edu/~jalemkul <http://mackerell.umaryland.edu/~jalemkul> <http://mackerell.umaryland.edu/~jalemkul <http://mackerell.umaryland.edu/~jalemkul>>
>>>
>>> ==================================================
>>> --
>>> Gromacs Users mailing list
>>>
>>> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List <http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List> <http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List <http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List>> before posting!
>>>
>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists <http://www.gromacs.org/Support/Mailing_Lists> <http://www.gromacs.org/Support/Mailing_Lists <http://www.gromacs.org/Support/Mailing_Lists>>
>>>
>>> * For (un)subscribe requests visit
>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users <https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users> <https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users <https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users>> or send a mail to gmx-users-request at gromacs.org <mailto:gmx-users-request at gromacs.org><mailto:gmx-users-request at gromacs.org <mailto:gmx-users-request at gromacs.org>>.
>>
>
> --
> ==================================================
>
> Justin A. Lemkul, Ph.D.
> Ruth L. Kirschstein NRSA Postdoctoral Fellow
>
> Department of Pharmaceutical Sciences
> School of Pharmacy
> Health Sciences Facility II, Room 629
> University of Maryland, Baltimore
> 20 Penn St.
> Baltimore, MD 21201
>
> jalemkul at outerbanks.umaryland.edu | (410) 706-7441
> http://mackerell.umaryland.edu/~jalemkul
>
> ==================================================
> --
> Gromacs Users mailing list
>
> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send a mail to gmx-users-request at gromacs.org.

```