From: Eric Lang (eric.lang_at_bristol.ac.uk)
Date: Thu Oct 18 2018 - 08:39:14 CDT

Dear Axel,

Thank you so much for your quick reply.

It all works fine with your fix now.

I agree, by default it would make more sense not to update the selection, but instead to have a way to toggle it in the GUI in case this is needed.

Many thanks for your help.

Eric

________________________________
From: Axel Kohlmeyer <akohlmey_at_gmail.com>
Sent: 18 October 2018 14:05
To: Eric Lang
Cc: Vmd l
Subject: Re: vmd-l: Dipole Watcher Plugin - atom selection not updated at every frame when drawing dipoles

eric,

please try the following change:

$ cvs diff !$
cvs diff dipwatch.tcl
Index: dipwatch.tcl
===================================================================
RCS file: /vmd/cvsroot/plugins/dipwatch/dipwatch.tcl,v
retrieving revision 1.5
diff -u -r1.5 dipwatch.tcl
--- dipwatch.tcl 15 Apr 2013 15:43:09 -0000 1.5
+++ dipwatch.tcl 18 Oct 2018 13:01:54 -0000
@@ -237,6 +237,7 @@
     set res 6
     set gidlist {}
     set filled yes
+ $sel update

     # perhaps this should use the center information
     if {[catch {measure center $sel weight mass} center]} {

i agree, that this needs to be addressed, but since most people use
static selections, the default behavior should be to not update the
selection and then offer a way to toggle in the GUI whether you want
to update it or not. for complex systems and selection strings,
updating the selection can take significant time and thus negatively
impact the visualization performance.

axel.

On Thu, Oct 18, 2018 at 8:17 AM Eric Lang <eric.lang_at_bristol.ac.uk> wrote:
>
> 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
>
>
> Eric

--
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.