From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Feb 23 2011 - 09:12:37 CST

2011/2/23 Stéphane Pezennec <stephane.pezennec_at_rennes.inra.fr>:
> Dear all,

> It seems that the 'measure dipole' function (version 1.8.7) returns
> erroneous results when:

dear stephane,

would you mind checking if this behavior still occurs
in the latest beta version of VMD?

there have not been many changes to that part of the
VMD code since, so it is likely. but before digging into
the code myself, it would help to be certain about it.

http://www.ks.uiuc.edu/Research/vmd/alpha/

thanks,
    axel.

> - the net charge of the selection is not zero, and
> - the center of mass of the selection is not at the origin, and
> - the '-masscenter' flag is used.
>
> As a side-effect, when the first two conditions are fulfilled, the
> DipoleWatcher plugin displays incorrect dipoles.
>
> It can be observed when the selection is moved (e.g., aligned on
> something else, or simply translated using 'moveby'): the dipole, either
> updated using the plugin or measured again using 'measure dipole
> -masscenter', then changes in magnitude as well as orientation
> relatively to the selection atoms. As far as I know, it should not.
>
> I tried to look at the source (src/Measure.C, src/TclMeasure.C), but
> could not see anything wrong.
>
> I used a Q&D Tcl script to compute the dipole moment at the center of
> mass:
>
>  proc dpl {selection} {
>        set cdm [measure center $selection weight mass]
>        set p [veczero]
>        set cht 0.0
>        foreach pos [$selection get {x y z}] charge [$selection get charge] {
>                set p [vecadd $p [vecscale $charge $pos ]]
>                set cht [expr $cht + $charge]
>        }
>        puts $cht
>        return [vecsub $p [vecscale $cht $cdm]]
>  }
>
> This script and 'measure dipole -masscenter' yield the same results only
> when the center of mass of the selection is at the origin. On the few
> proteins tested, the -masscenter dipole was very close to the
> -origincenter one, whereas one could reasonably expect it to be close to
> the -geocenter one.
>
> As far as I can tell by using similar scripts, the use of the -geocenter
> or -origincenter flags yields correct results, which points to the
> computation of the center of mass.
>
> I would be happy to help, by further testing or answering to more specific
> questions.
>
> Regards,
>
> --
> Stéphane
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.