[gmx-users] David, still confused with the alternating current electric field.

David spoel at xray.bmc.uu.se
Sun Nov 21 21:25:43 CET 2004


On Mon, 2004-11-22 at 03:54 +0800, xieyh at hkusua.hku.hk wrote:
> Dear David:
> 
> As you suggested, I have downloaded and installed the GMX CVS version for the
> applying of alternating current (AC) electric field (EF).However, my purpose
> can not yet be realized. Maybe, you can give me much more help.
> 
> Compared with GMX3.1 version, the source code about the electric field has been
> modified as shown in /src/mdlib/sim_util.c, also listed in the following. 
> 
> I think this part of code is fully considering the alternating current electric
> field. Howerver, I made some tries, then the AC electric field could not be
> applied. In other words, although the source code is modified, what is mdp
> options about AC electric field? As known, for direct current (DC) electric
> field: "E_z = 1.0   0.2   0.0" denotes an electric field with frequency=0 and
> strength=0.2. 
> 
> If applying the time-dependent AC electric field, some items need to be added
> into E_zt options. So can you give me a light about what is the E_zt option?
> For example, I want to apply a AC electric field: E = E0*cos (omega*t + phi),
> what is the corresponding definition in E_zt option?
You need to supply either a static and an oscillating field. Please try
to deduce from the source code which values are reasonable. Note that
the input is in V/nm, and that you can print the resulting field with a
command line option to mdrun.

> 
> Thanks for your patient reading about my question, and any of your advice will
> be greatly appreciated.
> 
> /* 
>  * calc_f_el calculates forces due to an electric field.
>  *
>  * force is kJ mol^-1 nm^-1 = e * kJ mol^-1 nm^-1 / e 
>  *
>  * Et[] contains the parameters for the time dependent 
>  * part of the field (not yet used). 
>  * Ex[] contains the parameters for
>  * the spatial dependent part of the field. You can have cool periodic
>  * fields in principle, but only a constant field is supported
>  * now. 
>  * The function should return the energy due to the electric field
>  * (if any) but for now returns 0.
>  */
> static void calc_f_el(FILE *fp,int  start,int homenr,
> 		      real charge[],rvec x[],rvec f[],
> 		      t_cosines Ex[],t_cosines Et[],real t)
> {
>   rvec Ext;
>   real t0;
>   int  i,m;
>   
>   for(m=0; (m<DIM); m++) {
>     if (Et[m].n) {
>       if (Et[m].n == 3) {
> 	t0 = Et[m].a[1];
> 	Ext[m] = cos(Et[m].a[0]*(t-t0))*exp(-sqr(t-t0)/(2.0*sqr(Et[m].a[2])));
>       }
>       else
> 	Ext[m] = cos(Et[m].a[0]*t);
>     }
>     else
>       Ext[m] = 1.0;
>     if (Ex[m].n) {
>       /* Convert the field strength from V/nm to MD-units */
>       Ext[m] *= Ex[m].a[0]*FIELDFAC;
>       for(i=start; (i<start+homenr); i++) 
> 	f[i][m] += charge[i]*Ext[m];
>     }
>     else
>       Ext[m] = 0;
>   }
>   if (fp) 
>     fprintf(fp,"%10g  %10g  %10g  %10g #FIELD\n",t,
> 	    Ext[XX]/FIELDFAC,Ext[YY]/FIELDFAC,Ext[ZZ]/FIELDFAC);
> 
> 
> Yours, 
> Xie YH
> The Univ. of Hong Kong
> 
> 
> On Fri, 2004-11-19 at 17:33 +0800, xieyh at hkusua.hku.hk wrote:
> > Dear gmx users:
> > 
> >  
> > 
> > I would like to apply an alternating current (AC) electric field to my 
> > simulation box. However, nowadays, only direct current (DC) electric 
> > field is used in Gromacs. Maybe, the application of AC electric field 
> > can be realized through the modification in src/mdlib/sim_util.c 
> > file.
> > 
> >  
> > 
> > Anyone knows how to make such a modification? At least, Is that 
> > promising for do this modification?
> 
> >It's implemented in cvs, not sure about 3.2.1. Try fiddling with mdp options.
> 
> 
> 
> 
> _______________________________________________
> gmx-users mailing list
> gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-users-request at gromacs.org.
-- 
David.
________________________________________________________________________
David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,          75124 Uppsala, Sweden
phone:  46 18 471 4205          fax: 46 18 511 755
spoel at xray.bmc.uu.se    spoel at gromacs.org   http://xray.bmc.uu.se/~spoel
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




More information about the gromacs.org_gmx-users mailing list