[gmx-developers] pbc and virial problem

Alexander Herz aherz.kazan at arcor.de
Wed Apr 8 16:20:00 CEST 2009


I still don't understand why this happens, but I've got some more
details now.
I have averaged the different virial contributions over 50*10^3 steps:

With correction:
//just [f[i][XX]*x[i][XX],f[i][YY]*x[i][YY],f[i][ZZ]*x[i][ZZ]] over all
home atoms

AV_SHIFT_VIR: [594.654476,582.680015,0.000641]
//same for fshift only

//fshift[0..SHIFTS] averaged (x and y only)
//AV_SHIFT_VIR*-2 (calculated from the averaged fshifts above)


Without correction:

The main difference in the total virial clearly can be attributed to the
shift virial (AV_SHIFT_VIR calculated from fshift[0..SHIFTS]). Looking
at the different averaged fshift contributions, fshift[17,21,23,27]
contribute most
(these correspond to the shifts (0,-3,0),(-3,0,0),(3,0,0),(0,3,0)).

I'm using spc/e water by the way, the correction force will act on the
OW atoms only.

Any ideas why the shifted virial contributions differ so much while the
unshifted (home virial) contributions
are pretty much unaffected (as one would assume for all contributions in

How are the shifted forces calculated? Is there a specific
optimization/assumption for the
spc/e water optimized kernels I might be breaking? Aren't the shifted
forces depending on the "home" forces?
I really don't get why the shifted once should differ when the home ones

I'm really a bit lost here.


hessb at mpip-mainz.mpg.de schrieb:
> Hi,
> What you are saying seems a bit contradictory.
> Do I understand it correctly that you only add something
> to the z component of the force (and not to the shift force)
> and then the components of the shift forces change, which
> affect only the xx and yy components of the virial?
> That seems very strange.
> This almost must mean that somehow the position of atoms
> along x and y changes due to your extra force.
> For your force you have taken care of the correction that was missing
> in the wall potentials that caused the asymmetry?
> Berk
>> Hi,
>> I've added a force similar to the walls. Now I'm trying to calculate
>> surface tensions using this new correction via the virial.
>> We used to do these calculations with pbc=xyz with an older gromacs
>> version so I'm trying to do the same in order to be able compare the
>> results before going to pbc=xy.
>> The problem is that I get non sense for the virial xx and yy components.
>> To figure out why, I compared the averaged virials for the same sim with
>> and without the new correction.
>> The virial contribution from the non-shifted particles is pretty much
>> identical but the virial from the shifted
>> particles:
>>   (calc_virial in sim_util.c):
>>   clear_mat(vir_part);
>> calc_vir(fplog,SHIFTS,fr->shift_vec,fr->fshift,vir_part,ePBC==epbcSCREW,box);
>>   inc_nrnb(nrnb,eNR_VIRIAL,SHIFTS);
>> differs by almost exactly the amount which I'd expect.
>> The correction I apply only adds forces in z direction and the
>> simulation is setup such that no pbc in z is applied because of the cut
>> off (there is a water slab of ca. 6 nm thickness in the middle of the
>> box (z direction) surrounded by ca. 3 nm of nothing in both z
>> directions). Debugging through the code I can see that no images for
>> z!=0 are created.
>> The correction force is quite small compared to the forces applied by
>> gromacs non_bonded
>> (correction: avrg. force=0.03, max. force=8.0, gromacs: avrg.:456.0 ,
>> max.: 4831.0).
>> The force is calculated just after the walls right before do_nonbonded.
>> Finally, the question:
>> Any ideas how the small additional force in z direction can have such a
>> strong effect on the virial xx and yy components
>> (apparently fshifted[XX] and fshifted[YY] are influenced significantly
>> whereas the virial ZZ value remains virtually identical
>> no matter if the correction is applied or not, as fshifted[ZZ]==0 in
>> both cases).
>> Thx,
>> Alex
>> _______________________________________________
>> gmx-developers mailing list
>> gmx-developers at gromacs.org
>> http://www.gromacs.org/mailman/listinfo/gmx-developers
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-developers-request at gromacs.org.
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-developers-request at gromacs.org.

More information about the gromacs.org_gmx-developers mailing list