[gmx-users] implementing Ewald 3D correction algorithm

David van der Spoel spoel at xray.bmc.uu.se
Thu Jan 17 20:35:21 CET 2002

On Thu, 17 Jan 2002, Rui Qiao wrote:

>Dear All:
>	I posted a question on dealing reduced periodicity for study of
>channel flow where electrostatic interaction is important. Thanks for the
>replies I've got, I think I do find a suitable algorithm, i.e. Ewald
>summatation with correction. (J. of Chem Phys, vol 111, No, 7,
>	The alogrithm is very simple:
>	a. do Ewald summation, you can use whatever method you want,
>e.g. PME, P3M and so on;
>	b. Add a correction term to force and potential term. For the
>force, it is simply (assume no periodicity in z-direction):
>	Fx = Fx + 0 (no correction in x and y direction)
>	Fy = Fy + 0
>	Fz = Fz - 4*pi*q_i/(slab_volume)*M_z
>	wherre M_z is total system dipole moment in z direction. i.e 
>M_z = sum(q_i * z_i).
I suggest you have a look at the code for electric fields. The total
dipole moment is computed as well. So you have to insert four or five
lines in md.c *after* global_stat (where the totatl dipole is summed) and
*before* update, where the positions are integrated. You only have to do
it for the local atoms:
   for (kkk=START(nsb); (kkk<START(nsb)+HOMENR(nsb)); kkk++)
     f[kkk][ZZ] += 4*pi*mdatoms->chargeT[kkk]/(slab)*Mtot[ZZ];

Groeten, David.
Dr. David van der Spoel, 	Biomedical center, Dept. of Biochemistry
Husargatan 3, Box 576,  	75123 Uppsala, Sweden
phone:	46 18 471 4205		fax: 46 18 511 755
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://zorn.bmc.uu.se/~spoel

More information about the gromacs.org_gmx-users mailing list