[gmx-users] source cord routines for electric fields

Makoto Yoneya makoto-yoneya at aist.go.jp
Fri Oct 3 08:19:36 CEST 2014


Dear David:

Thanks a lot for your valuable help.
Finally, I could reach my goal, i.e. apply simple sin-wave electric field.
As you pointed out, the original GROMACS code already includes some
time-dependent
electric field function.
However, for simple cos-wave (not the pulsed cos-wave), there is no phase
term
in the original code (up to 5.0.2).
Then, it is not possible to change it sin-wave.
Modify the line in mdlib/sim_util.c (function calc_f_el) as in the
followings,

            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);                   original
form */
                Ext[m] = cos(Et[m].a[0]*(t-Et[m].phi[0])); /* modified
form with phase */
            }

add the phase term for the simple cos-wave field.
Then, mdp file lines in the followings,

; Electric fields
; Format is number of terms (int) and for all terms an amplitude (real)
; and a phase angle (real)
E-x                      = 1 1.0       0.0
E-xt                     = 1 3.1415e-2 50.0

makes cos-wave electric fields with omega=3.1415e-2 (1/ps, period=200ps)
and phase=50ps, i.e. sin-wave.
Thanks a lot again.

Makoto Yoneya, Dr.
AIST, Tsukuba
JAPAN

> -----Original Message-----
> From: Makoto Yoneya [mailto:makoto-yoneya at aist.go.jp]
> Sent: Thursday, October 02, 2014 5:08 PM
> To: 'gmx-users'
> Subject: source cord routines for electric fields
>
> Dear David:
>
> Thank a lot for your quick reply.
> I'd found the code already includes some time-dependent function.
> I'll study how to use it.
> Thanks a lot again.
>
> Makoto Yoneya, Dr.
> AIST, Tsukuba
> JAPAN
>
> >On 2014-10-02 08:01, 米谷慎 wrote:
> >> Dear Gromacs experts:
> >>
> >> I'd like to add the time-dependent function to the electric field
> >> routines in GROMACS.
> >> I could only found the input (reading) codes in src/kernel/readir.c.
> >> Does anyone know which source cord routines I should modify to add
> >> the time-dependent functions.
> >>
> >> Thank you for advance.
> >>
> >> Makoto Yoneya, Dr.
> >> AIST, Tsukuba
> >> JAPAN
> >>
> >mdlib/sim_util.c
> >look for function calc_f_el
> >
> >
> >--
> >David van der Spoel, Ph.D., Professor of Biology Dept. of Cell & Molec.
> >Biol., Uppsala University.
> >Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.


More information about the gromacs.org_gmx-users mailing list