From: Eric Lang (
Date: Thu Oct 18 2018 - 06:31:41 CDT

Dear VMD developers and users,

I am using VMD 1.9.3 and I need to use the Dipole Watcher Plugin to visualise the dipole moment of a molecule.

My selection string for drawing the dipole moment includes an “and within X of” type of statement so the selection needs to be updated at every frame of the trajectory.

When I click on the “Write” button of the plugin, the dipole written to a file indeed corresponds to the dipole for which the selection has been updated for every frame.

However, for the visualisation, the dipole drawn by the plugin does not correspond to the dipole for which the selection has been updated to the current frame: it takes into account atoms that are further than the X Angstrom limit I specified. For a given frame for which atoms move further away from the cut-off distance, the discrepancy is confirmed by the fact that the dipole value indicated in the Dipole Monitoring Tool window is different from the dipole value written in the file.

Looking at dipwatch.tcl, in the “write dipole moment trajectory with current setting” section, there is indeed the following

set sel [atomselect $molid $dipselstr($dipid)]

puts $fp "\# frame dip_x dip_y dip_z |dip|"

set nf [molinfo $molid get numframes]

for {set i 0} {$i < $nf} {incr i $step} {

$sel frame $i

$sel update

if {! [catch {measure dipole $sel -debye $dipcenter($dipid)} vector]} {

puts $fp "$i [lindex $vector 0] [lindex $vector 1] [lindex $vector 2] [veclength $vector]"

$sel delete

which ensure the selection to be updated at every frame. However, it doesn’t look like there is something similar in the rest of the script. I tried to modify dipwatch.tcl to update the selection at every frame when drawing the dipole, but so far my attempts have been unsuccessful. I guess I am not proficient enough in TCL scripting or my understanding of dipwatch.tcl is not god enough.

If someone could tell me how to fix this directly in dipwatch.tcl, that would be really appreciated.

This fix might also need to be added permanently to the plugin for the future versions of VMD.

Many thanks in advance for your help