# [gmx-users] g_dipoles

David spoel at xray.bmc.uu.se
Thu Nov 10 17:53:07 CET 2005

```On Thu, 2005-11-10 at 08:51 -0500, Viswanadham Sridhara wrote:
> Hi again,
> Is < |M| >\S2\N intentionally made equal to < |M|\S2\N > for t=0? I
> ask this question because, the difference of these two terms is almost
> zero in every calculation. I am not able to understand exactly how
> each term is calculated, I understand how epsilon, kirkwood factor,
> moments in each direction and total moment are calculated, but I dont
> exactly understand how these fluctuations are calculated.......
> Hope someone clarifies to me briefly how they are calculated at t =0
> and for t = 0 + of the simulation.
For a single step this is by definition correct. Note that M is a vector
of length 3.

> Viswam.
>
> On 11/9/05, David <spoel at xray.bmc.uu.se> wrote:
>         On Wed, 2005-11-09 at 15:36 -0500, Viswanadham Sridhara wrote:
>         > Hello again,
>
>         > The first two vectors < |M|\S2\N > and < |M| >\S2\N" are
>         assumed to be
>         > equal in the very first time step, but from 4ps in th is
>         case, they
>         > are different, can anyone tell me how they are calculated.
>         > I understand how they are calculated at t-0,
>         >   sum[(M\sx \N)^2 (M\sy \N )^2 (M\sz \N)^2] and it is made
>         equal for
>         > both < |M|\S2\N > and < |M| >\S2\N", so that their ratio is
>         1, 4th
>         > column in second file........
>         > But how are they calculated for t =4 ...and so on.....
>
>         The same way, here is the source code from gmx_dipoles.c (e2d
>         converts e
>         nm to Debye).
>
>         void mol_dip(int k0,int k1,atom_id ma[],rvec x[],t_atom atom
>         [],rvec mu)
>         {
>           int  k,kk,m;
>           real q;
>
>           clear_rvec(mu);
>           for(k=k0; (k<k1); k++) {
>             kk = ma[k];
>             q  = e2d(atom[kk].q);
>             for(m=0; (m<DIM); m++)
>               mu[m] += q*x[kk][m];
>           }
>         }
>
>         >
>         > --------------------
>         >
>         > I hope I am clear this time....
>         >
>         > Viswam..
>         >
>         >
>         >
>         >
>         > On 11/9/05, Viswanadham Sridhara <muta.mestri at gmail.com>
>         wrote:
>         >         Hello David,
>         >         Then why are the files 11.xvg and 111.xvg same as
>         first half
>         >         of 1.xvg and the second half of 1.xvg respectively,
>         in other
>         >         words the total dipole moment of the frames for the
>         whole
>         >         trajectory is same as when calculated separately for
>         the first
>         >         and second halves and concatenated, but not the
>         dipole plus
>         >         fluctuations...........(22.xvg and 222.xvg are
>         different
>         >         compared to 2.xvg)...
>         >         Thanks,
>         >
>         >
>         >
>         >         On 11/9/05, David <spoel at xray.bmc.uu.se> wrote:
>         >                 On Wed, 2005-11-09 at 14:38 -0500,
>         >                 Sridhara wrote:
>         >                 > Hello Everyone,
>         >                 > Can anyone explain me how g_dipoles
>         exactly work?
>         >                 > I am just briefly explaining what I did.
>         >                 > a) I took the whole trajectory and tried
>         to find
>         >                 dipole moment, --
>         >                 > >full.xvg (This is with option -o)
>         >                 > b)then i divided the whole trajectory into
>         two parts
>         >                 and tried to find
>         >                 > the dipole moment, first half-->fh.xvg and
>         second
>         >                 half sh.xvg.
>         >                 > Obviously fh.xvg and sh.xvg combined is
>         equal to
>         >                 full.xvg.
>         >                 >
>         >                 > But, when i use option -a in g_dipoles,
>         and tried to
>         >                 find <Mu>^2 -
>         >                 > <Mu^2> for the whole trajectory, the n
>         umbers I
>         >                 found are different
>         >                 > for the trajectory when divided into two
>         parts.
>         >                 >
>         >                 > -------------------
>         >                 > g_dipoles -f full.gro -s dppc.tpr -o 1 -a
>         2 -mu
>         >                 2.273 -mumax 5.0 -
>         >                 > epsilonRF 78.5
>         >                 > g_dipoles -f firsthalf.gro -s dppc.tpr -o
>         11 -a 22 -
>         >                 mu 2.273 -mumax
>         >                 > 5.0 -epsilonRF 78.5
>         >                 > g_dipoles -f secondhalf.gro -s dppc.tpr -o
>         111 -a
>         >                 222 -mu 2.273 -mumax
>         >                 > 5.0 -epsilonRF 78.5
>         >                 > -------------------------------------
>         >                 >
>         >                 > In other words,  concatenating 11 and 111
>         gives me
>         >                 1.xvg, but not with
>         >                 > 22 and 222......
>         >                 > How does Gromacs calculate <Mu>^2 and
>         <Mu^2>......
>         >                 Mu = Sum q R
>         >                 where Mu and R are vectors.
>         >
>         >                 Obviously if you compare two single
>         coordinate files
>         >                 the results will be
>         >                 different.
>         >
>         >                 > Thanks in advance,
>         >                 > Viswam.
>         >                 >
>         >                 >
>         >                 >
>         >                 > --
>         >                 > Graduate Research Assistant,
>         >                 > Old Dominion University, "VIRGINIA".
>         >                 >
>         _______________________________________________
>         >                 > 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
>         >                 ++++++++++++++++++++++++++++++++++++++++++++
>         ++++++++++
>         >                 ++++++++++++++++++
>         >
>         >
>         _______________________________________________
>         >                 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.
>         >
>         >
>         >
>         >         --
>         >         Old Dominion University, "VIRGINIA".
>         >
>         >
>         >
>         >
>         > --
>         > Old Dominion University, "VIRGINIA".
>         > _______________________________________________
>         > 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
>         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>         ++++++++++
>
>         _______________________________________________
>         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.
>
>
>
> --
> Old Dominion University, "VIRGINIA".
> _______________________________________________
> 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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

```