From: Shounak Mukherjee (shuva510_at_gmail.com)
Date: Tue Dec 08 2020 - 13:13:29 CST

Hi John ,
 Than you very much for your help

On Thu, Dec 3, 2020 at 12:55 PM John Stone <johns_at_ks.uiuc.edu> wrote:

> Hi,
> The dipole watch plugin uses a combination of its own script code and
> the built-in "measure dipole" command in VMD to compute and draw
> the dipoles. You can certainly read the plugin source code.
>
> Here is a brief snippet that may answer many of your questions,
> but the rest of the code can be viewed in your VMD installation,
> in vmd/plugins/noarch/tcl/dipwatch1.2
>
> Below is one of the key Tcl procs that does the work.
> Best,
> John Stone
>
>
> #################
> # the heart of the matter. draw a dipole.
> proc ::DipWatch::draw_dipole {mol sel {update 0} {color red} {scale 1.0}
> {radius 0.2} {dipidx 0}} {
> variable dipvalue
> variable dipcenter
>
> set res 6
> set gidlist {}
> set filled yes
> if { $update } { $sel update }
>
> # perhaps this should use the center information
> if {[catch {measure center $sel weight mass} center]} {
> if {[catch {measure center $sel} center]} {
> puts stderr "problem computing dipole center: $center"
> return {}
> }
> }
> if {[catch {measure dipole $sel -debye $dipcenter($dipidx)} vector]} {
> puts stderr "problem computing dipole vector: $vector"
> return {}
> }
>
> set dipvalue($dipidx) [format "%6.2f D" [veclength $vector]]
> set vechalf [vecscale [expr $scale * 0.5] $vector]
>
> lappend gidlist [graphics $mol color $color]
> lappend gidlist [graphics $mol cylinder [vecsub $center $vechalf] \
> [vecadd $center [vecscale 0.7 $vechalf]] \
> radius $radius resolution $res filled $filled]
> lappend gidlist [graphics $mol cone [vecadd $center [vecscale 0.7
> $vechalf]] \
> [vecadd $center $vechalf] radius [expr $radius *
> 1.7] \
> resolution $res]
> return $gidlist
> }
>
>
>
> On Wed, Dec 02, 2020 at 03:46:34PM +0530, Shounak Mukherjee wrote:
> > Hello Everybody ,
> > I was calculating the dipole moment of a charged(+1) molecule
> > using the dipole moment watcher. I have a Mol2 file which I am loading
> and
> > then using Visualization>Dipole Moment Watcher .
> > I want to know if anybody knows how VMD calculates this dipole
> > moment and the direction and if there is a built-in-code which I can
> modify
> > according to my need?
>
>
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> http://www.ks.uiuc.edu/Research/vmd/
>