# [gmx-users] g_dipoles

David van der Spoel spoel at xray.bmc.uu.se
Sun May 11 17:04:30 CEST 2014

```On 2014-05-11 15:31, Nilesh Dhumal wrote:
>> On 2014-05-11 02:18, Nilesh Dhumal wrote:
>>> I run g_dipoles for two ionic liquids : 1-Ethyl-3-methylimidazolium
>>> chloride and 1-Ethyl-3-methylimidazolium ethylsulfate. In both the
>>> systems
>>> cation is common 1-Ethyl-3-methylimidazolium.
>>
>>
>> I didn't follow the discussion but you can not use dipole moment
>> fluctuations to compute the dielectric constant for ionic species as
>> every ion that moves to the other side of the periodic box will increase
>> the fluctuations artificially.
>
>
> I am not calculating the dielectric constant for my system. I am
> calculating the dipole moment of the system. For dipole moment calculating
> program put the periodic boundary condition off. I calculated the dipole
> moment for two different systems. In one system program calculate the
> total charge on residue and change is 1. Program will subtract their
> charge at their center of  mass for one system and for other system it
> don't do. Both the system have cation and anion. Why program is not
> following same protocol for both systems? Why program is subtracting atom
> charges at their center of  mass for dipole moment calculation.
Not sure why the program does what it does, but the total dipole of a
periodic system is not a meaningful quantity either. If you have a
cluster in vacuum it could make sense, but then the charges should not
be corrected.

>
> Nilesh
>>
>>>
>>> In g_dipoles  comde
>>>
>>> static void neutralize_mols(int n,int *index,t_block *mols,t_atom *atom)
>>> {
>>>       double mtot,qtot;
>>>       int  ncharged,m,a0,a1,a;
>>>
>>>       ncharged = 0;
>>>       for(m=0; m<n; m++) {
>>>           a0 = mols->index[index[m]];
>>>           a1 = mols->index[index[m]+1];
>>>           mtot = 0;
>>>           qtot = 0;
>>>           for(a=a0; a<a1; a++) {
>>>               mtot += atom[a].m;
>>>               qtot += atom[a].q;
>>>           }
>>>           /* This check is only for the count print */
>>>           if (fabs(qtot) > 0.01)
>>>               ncharged++;
>>>           if (mtot > 0)
>>>               /* Remove the net charge at the center of mass */
>>>               for(a=a0; a<a1; a++)
>>>                   atom[a].q -= qtot*atom[a].m/mtot;
>>>           }
>>>       }
>>>
>>>       if (ncharged)
>>>           printf("There are %d charged molecules in the selection,\n"
>>>                  "will subtract their charge at their center of
>>> mass\n",ncharged);
>>> }
>>>
>>>
>>>
>>> For 1-Ethyl-3-methylimidazolium chloride, program don't print "There are
>>> %d charged molecules in the selection will subtract their charge at
>>> their
>>> center of "   and for other ionic liquids it do.
>>> For 1-Ethyl-3-methylimidazolium ethylsulfate ionic liquid program show
>>> the
>>> comment and recalculate the charges.
>>>
>>> /* Remove the net charge at the center of mass */
>>>               for(a=a0; a<a1; a++)
>>>                   atom[a].q -= qtot*atom[a].m/mtot;
>>>           }
>>>
>>> I don't know why program is not using same protocol for all system.
>>>
>>> What could be the reason to  remove the net charge at the center of mass
>>> for dipole moment calculation.
>>>
>>> Nilesh
>>>
>>>
>>>
>>>>
>>>> On 4/27/14, 4:33 PM, Nilesh Dhumal wrote:
>>>>>>
>>>>>>
>>>>>> On 4/27/14, 4:25 PM, Nilesh Dhumal wrote:
>>>>>>>>
>>>>>>>> On 4/27/14, 4:01 PM, Nilesh Dhumal wrote:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I run g_dipoles for two different systems (System are ionic
>>>>>>>>> liquids).
>>>>>>>>>
>>>>>>>>> For one system when I run g_dipoles I get following message
>>>>>>>>>
>>>>>>>>> There are 256 molecules in the selection
>>>>>>>>> There are 256 charged molecules in the selection,
>>>>>>>>> will subtract their charge at their center of mass
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> and I don't get this message for other system.
>>>>>>>>>
>>>>>>>>> Why program subtract their charge at their center of mass for one
>>>>>>>>> system
>>>>>>>>> and not for other.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Based on whatever the topology says, g_dipoles doesn't find a net
>>>>>>>> charge
>>>>>>>> on
>>>>>>>> what
>>>>>>>> the
>>>>>>>> molecules/selections are, what the topology(ies) is(are) - that's
>>>>>>>> all
>>>>>>>> that
>>>>>>>> can
>>>>>>>> be surmised at this point.
>>>>>>>>
>>>>>>>> -Justin
>>>>>>>>
>>>>>>>
>>>>>>> There are 128 cations (EMI) and 128 anions (ETS). Total charge is
>>>>>>> ZERO
>>>>>>>
>>>>>>> here is molecular section from topology file.
>>>>>>> [ defaults ]
>>>>>>> ; nbfunc        comb-rule       gen-pairs       fudgeLJ fudgeQQ
>>>>>>> 1               3               yes             0.5     0.5
>>>>>>>
>>>>>>>      #include "emi.itp"
>>>>>>>      #include "ets.itp"
>>>>>>>
>>>>>>>
>>>>>>>      [ molecules ]
>>>>>>>      ; Compound        #mols
>>>>>>>      EMI        128
>>>>>>>      ETS        128
>>>>>>>
>>>>>
>>>>> For other system I have different anion. I didn't specify the number
>>>>> of
>>>>> residues in molecular section.
>>>>>
>>>>> [ system ]
>>>>> ; Name
>>>>> Grunge ROck MAChoS t= 20000.00000
>>>>>
>>>>> [ molecules ]
>>>>> ; Compound        #mols
>>>>> Ion                 1
>>>>>
>>>>
>>>> So "Ion" is some collection of molecules, or what?  If it's a single
>>>> [moleculetype] composed of multiple molecules, each bearing a net
>>>> charge
>>>> but
>>>> adding up to zero for the whole [moleculetype], this explains your
>>>> observation.
>>>>     g_dipoles reads "Ion" as being a neutral entity, which is probably
>>>> not
>>>> correct
>>>> for a program like g_dipoles.
>>>>
>>>> -Justin
>>>>
>>>> --
>>>> ==================================================
>>>>
>>>> Justin A. Lemkul, Ph.D.
>>>> Ruth L. Kirschstein NRSA Postdoctoral Fellow
>>>>
>>>> Department of Pharmaceutical Sciences
>>>> School of Pharmacy
>>>> Health Sciences Facility II, Room 601
>>>> University of Maryland, Baltimore
>>>> 20 Penn St.
>>>> Baltimore, MD 21201
>>>>
>>>> jalemkul at outerbanks.umaryland.edu | (410) 706-7441
>>>> http://mackerell.umaryland.edu/~jalemkul
>>>>
>>>> ==================================================
>>>> --
>>>> Gromacs Users mailing list
>>>>
>>>> * Please search the archive at
>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>>>> posting!
>>>>
>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>
>>>> * For (un)subscribe requests visit
>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>>>> send
>>>> a mail to gmx-users-request at gromacs.org.
>>>>
>>>
>>>
>>
>>
>> --
>> David van der Spoel, Ph.D., Professor of Biology
>> Dept. of Cell & Molec. Biol., Uppsala University.
>> Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
>> spoel at xray.bmc.uu.se    http://folding.bmc.uu.se
>> --
>> Gromacs Users mailing list
>>
>> * Please search the archive at
>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>> posting!
>>
>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>
>> * For (un)subscribe requests visit
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or send
>> a mail to gmx-users-request at gromacs.org.
>>
>

--
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se
```