├── LICENSE ├── Makefile ├── README.md ├── demo ├── README.md ├── chl_msd_xy.dat.reference ├── popc_msd_xy.dat.reference └── regtest.tcl ├── diffusion_coefficient.tcl ├── diffusion_coefficient_gui.tcl ├── diffusion_coefficient_gui.ui ├── diffusion_coefficient_gui_ui.tcl ├── doc ├── Makefile ├── README.md ├── formulas.png ├── formulas.tex └── gui.png ├── load.tcl ├── paper ├── drawing-source.svg ├── drawing.pdf ├── gui.png ├── paper.bib └── paper.md └── pkgIndex.tcl /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Toni Giorgino 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .SILENT: 2 | 3 | VMFILES = pkgIndex.tcl diffusion_coefficient_gui.tcl diffusion_coefficient_gui_ui.tcl diffusion_coefficient.tcl 4 | VMVERSION = 1.0 5 | DIR = $(PLUGINDIR)/noarch/tcl/diffusion_coefficient(VMVERSION) 6 | 7 | 8 | bins: 9 | win32bins: 10 | dynlibs: 11 | staticlibs: 12 | win32staticlibs: 13 | 14 | distrib: 15 | @echo "Copying diffusion_coefficient $(VMVERSION) files to $(DIR)" 16 | mkdir -p $(DIR) 17 | cp $(VMFILES) $(DIR) 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | VMD Diffusion Coefficient Tool 2 | ================================ 3 | 4 | Toni Giorgino © 2011-2019 5 | 6 | The Diffusion Coefficient Tool is an analysis plugin for VMD that 7 | computes one, two or three-dimensional MSD-based diffusion 8 | coefficients of a chosen molecular species. 9 | 10 | Please find this software's documentation in the [doc subdirectory](doc). 11 | 12 | [![status](https://joss.theoj.org/papers/25d51faf73cc17ae3affb51b787bbe18/status.svg)](https://joss.theoj.org/papers/25d51faf73cc17ae3affb51b787bbe18) 13 | 14 | Citation 15 | -------- 16 | 17 | Giorgino, (2019). Computing diffusion coefficients in macromolecular simulations: the Diffusion Coefficient Tool for VMD. Journal of Open Source Software, 4(41), 1698, [doi:10.21105/joss.01698](https://doi.org/10.21105/joss.01698) 18 | 19 | 20 | License 21 | ------- 22 | 23 | This software is distributed subject to the BSD-3 licensing terms. 24 | Please refer to the accompanying [LICENSE](LICENSE) file. 25 | -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | # VMD Diffusion Coefficient Tool - demo and regression test 2 | 3 | This directory contains a script intended both as 4 | a demonstration of use, and as a regression test. 5 | 6 | It can be launched with 7 | 8 | vmd -dispdev none regtest.tcl 9 | 10 | On first run, the script will download ~250MB of simulation 11 | results part of the [case 12 | study](https://sourceforge.net/projects/membplugin/files/Case%20Study/CaseStudy_v2.pdf/download) 13 | for the [MEMBPLUGIN 14 | tool](https://academic.oup.com/bioinformatics/article/30/10/1478/266901#supplementary-data). 15 | 16 | The simulation data corresponds to 20 ns of simulation of a 1:1 molar 17 | ratio POPC:Cholesterol bilayer. The bilayer was modeled at all-atom 18 | resolution with the CHARMM36 forcefield. The details of the system 19 | preparation are reported in the [case 20 | study](https://sourceforge.net/projects/membplugin/files/Case%20Study/CaseStudy_v2.pdf/download). 21 | 22 | The script computes lateral MSD displacement for time intervals 23 | ranging from 2 to 10 ns for the POPC and Cholesterol species 24 | separately. Diffusion coefficients can be determined from *asymptotic 25 | slopes* of the curves (usually fitting linear models). 26 | 27 | -------------------------------------------------------------------------------- /demo/chl_msd_xy.dat.reference: -------------------------------------------------------------------------------- 1 | 2.00 14.36 2 | 2.40 15.83 3 | 2.80 17.19 4 | 3.20 18.82 5 | 3.60 20.34 6 | 4.00 21.99 7 | 4.40 23.62 8 | 4.80 24.48 9 | 5.20 25.45 10 | 5.60 26.35 11 | 6.00 27.27 12 | 6.40 28.01 13 | 6.80 28.59 14 | 7.20 29.06 15 | 7.60 29.37 16 | 8.00 29.80 17 | 8.40 30.29 18 | 8.80 31.15 19 | 9.20 31.72 20 | 9.60 32.38 21 | 10.00 32.57 22 | -------------------------------------------------------------------------------- /demo/popc_msd_xy.dat.reference: -------------------------------------------------------------------------------- 1 | 2.00 25.57 2 | 2.40 26.66 3 | 2.80 28.16 4 | 3.20 30.06 5 | 3.60 31.47 6 | 4.00 32.85 7 | 4.40 33.89 8 | 4.80 34.56 9 | 5.20 35.33 10 | 5.60 35.98 11 | 6.00 36.52 12 | 6.40 37.56 13 | 6.80 38.90 14 | 7.20 39.55 15 | 7.60 40.10 16 | 8.00 40.31 17 | 8.40 40.66 18 | 8.80 41.68 19 | 9.20 42.11 20 | 9.60 42.91 21 | 10.00 42.60 22 | -------------------------------------------------------------------------------- /demo/regtest.tcl: -------------------------------------------------------------------------------- 1 | # This script tests the diffusion coefficient tools command line. 2 | # 3 | # It relies on membrane simulation data provided as supporting 4 | # information of: Guixà-González R, Rodriguez-Espigares I, 5 | # Ramírez-Anguita JM, Carrió-Gaspar P, Martinez-Seara H, Giorgino T, 6 | # et al. MEMBPLUGIN: studying membrane complexity in 7 | # VMD. Bioinformatics. 2014 May 8 | # 15;30(10):1478–80. doi:10.1093/bioinformatics/btu037 9 | # 10 | # The data is downloaded from the internet the first time the script 11 | # is run. 12 | # 13 | # Run with "vmd -dispdev none -e test.tcl" (command line) or "play 14 | # test.tcl" (TCL Console) 15 | 16 | 17 | exec wget -c https://master.dl.sourceforge.net/project/membplugin/Case%20Study/CaseStudy_files.zip 18 | exec unzip -o CaseStudy_files.zip 19 | 20 | # The topology 21 | mol new case_study_systems/1_1.psf 22 | 23 | # The data file: 200 frames, 20 ns, i.e. 100 ps per frame 24 | mol addfile case_study_systems/1_1_20ns.dcd waitfor all 25 | 26 | # Helper to pretty print on file in tall format 27 | proc printout {l2 fn} { 28 | set f [open $fn w] 29 | foreach tau [lindex $l2 0] msd [lindex $l2 1] { 30 | puts $f [format "%.2f %.2f" $tau $msd] 31 | } 32 | close $f 33 | } 34 | 35 | 36 | # Safeguard if path properly set yet. 37 | set auto_path [linsert $auto_path 0 [file normalize ..] ] 38 | package require diffusion_coefficient 39 | 40 | 41 | # Lateral MSD of POPC lipids 42 | set popc_msd_xy [ diffusion_coefficient -dt 0.1 -alongx 1 -alongy 1 -alongz 0 -msd range -selection "resname POPC and name P" ] 43 | printout $popc_msd_xy popc_msd_xy.dat 44 | 45 | # Lateral MSD of cholesterol 46 | set chl_msd_xy [ diffusion_coefficient -dt 0.1 -alongx 1 -alongy 1 -alongz 0 -msd range -selection "resname CHL1 and name C1" ] 47 | printout $chl_msd_xy chl_msd_xy.dat 48 | 49 | # Fitted diffusion coefficient of CHL 50 | set chl_fitD_xy [ diffusion_coefficient -dt 0.1 -alongx 1 -alongy 1 -alongz 0 -fitD range -selection "resname CHL1 and name C1" ] 51 | puts " " 52 | puts " " 53 | puts [format "Fitted CHL D over default range: %.2g ± %.2g Ų/ns, int. %.2g ± %.2g" {*}$chl_fitD_xy] 54 | puts [format "Expected: %.2g ± %.2g Ų/ns, int. %.2g ± %.2g" 0.549456 0.030907 12.46229 0.79994] 55 | 56 | 57 | 58 | # Diff 59 | puts " " 60 | puts " " 61 | puts "vvvv Regression test differences below vvvv" 62 | exec diff popc_msd_xy.dat popc_msd_xy.dat.reference 63 | exec diff chl_msd_xy.dat chl_msd_xy.dat.reference 64 | puts "^^^^ Regression test differences above ^^^^" 65 | puts " " 66 | puts " " 67 | puts "Please verify any discrepancies above" 68 | 69 | 70 | #quit 71 | -------------------------------------------------------------------------------- /diffusion_coefficient.tcl: -------------------------------------------------------------------------------- 1 | 2 | # Core functions for VMD Diffusion Coefficient Plugin. VMD Diffusion 3 | # Coefficient tool. Computes one, two or three-dimensional MSD-based 4 | # diffusion coefficients of a chosen molecular species. See the 5 | # LICENSE file for copyright information. 6 | 7 | # Toni Giorgino, ISIB-Consiglio Nazionale delle Ricerche, 2012 8 | # https://github.com/giorginolab/vmd_diffusion_coefficient/ 9 | 10 | package provide diffusion_coefficient 1.2 11 | 12 | namespace eval ::diffusion_coefficient:: { 13 | # Variables matching command line options. 14 | variable arg 15 | variable arg_defaults { 16 | selection "water and noh" 17 | dt 1 18 | alongx 1 19 | alongy 1 20 | alongz 1 21 | remove_drift 1 22 | from - 23 | to - 24 | step - 25 | interval_from - 26 | interval_to - 27 | interval_stride - 28 | d - 29 | msd - 30 | fitD - 31 | } 32 | array set arg $arg_defaults 33 | 34 | # List of args in "preferred" order 35 | variable arg_list {selection dt alongx alongy alongz remove_drift 36 | from to step interval_from interval_to interval_stride } 37 | 38 | # Status text, bound by the GUI, otherwise unused 39 | variable status_text 40 | 41 | # If set the computations stops 42 | variable abort_flag 0 43 | } 44 | 45 | 46 | # User-accessible proc 47 | proc diffusion_coefficient { args } { 48 | return [eval ::diffusion_coefficient::diffusion_coefficient $args] } 49 | 50 | 51 | # Help 52 | proc ::diffusion_coefficient::diffusion_coefficient_usage { } { 53 | variable arg 54 | variable arg_list 55 | puts "VMD Diffusion Coefficient tool. Computes one, two or three-dimensional 56 | MSD-based diffusion coefficients of a chosen molecular species. 57 | 58 | Usage: diffusion_coefficient 59 | 60 | Command is one of: 61 | -msd Compute mean squared displacement (MSD) at a tau of 62 | NN frames; equivalent to msd_interval -from NN -to NN. 63 | Returns a value as Angstrom^2 . This is the recommended 64 | way of using the plugin. 65 | -msd range Compute MSD for taus between -from and -to (mandatory) 66 | Returns two lists of {tau} {MSD(tau)} 67 | -d range Compute D(tau)=MSD(tau)/(2*D*tau) between -from and 68 | -to (mandatory). Returns two lists of {tau} {D(tau)} 69 | -fitD range Compute D by a linear fit of MSD over the specified 70 | range. Returns a list of {D D_err S S_err} where 71 | D is the MSD slope divided by 2D; S is the MSD intercept; 72 | and _err are the respective standard errors. 73 | 74 | See https://github.com/giorginolab/vmd_diffusion_coefficient/ for 75 | definitions. If you don't understand what MSD(tau) is, don't use this 76 | tool. 77 | 78 | Toni Giorgino, National Research Council of Italy. 79 | 80 | Options (with defaults):" 81 | foreach k $arg_list { 82 | puts " -$k [list $arg($k)]" 83 | } 84 | 85 | } 86 | 87 | 88 | # Command line parsing (sets namespace variables). TODO: allow short 89 | # substrings, e.g. -sel 90 | proc ::diffusion_coefficient::parse_args {args} { 91 | variable arg 92 | 93 | for {set i 0} {$i<[llength $args]} {incr i} { 94 | set a [lindex $args $i] 95 | if [regexp {^-} $a] { 96 | set a [string trimleft $a -] 97 | if {![info exists arg($a)]} { 98 | error "Unknown option: $a" 99 | } else { 100 | incr i 101 | set v [lindex $args $i] 102 | set arg($a) $v 103 | } 104 | } else { 105 | error "Unknown command: $a" 106 | } 107 | } 108 | } 109 | 110 | 111 | proc ::diffusion_coefficient::get_cli_equivalent {} { 112 | variable arg 113 | variable arg_list 114 | 115 | foreach k $arg_list { 116 | append cli "-$k [list $arg($k)] " 117 | } 118 | return $cli 119 | } 120 | 121 | 122 | # Main entry point. 123 | proc ::diffusion_coefficient::diffusion_coefficient {args} { 124 | variable arg 125 | variable arg_defaults 126 | array set arg $arg_defaults 127 | set_default_interval 128 | set_default_lags 129 | if {[llength $args]==0} { 130 | diffusion_coefficient_usage 131 | return 132 | } 133 | eval parse_args $args 134 | parray arg 135 | 136 | 137 | if { ($arg(msd)!="-") + ($arg(d)!="-") + ($arg(fitD)!="-") != 1 } { 138 | error "Exactly one of -msd, -d, or -fitD must be given" 139 | } 140 | 141 | # Execute 142 | if { $arg(msd)=="range" } { 143 | return [compute_avg_msd]; # MSD range 144 | } elseif [string is integer $arg(msd)] { 145 | set tau $arg(msd); # MSD integer 146 | set arg(from) $tau 147 | set arg(to) $tau 148 | set arg(step) 1 149 | lassign [compute_avg_msd] tlist msdlist 150 | return [lindex $msdlist 0] 151 | } elseif { $arg(d)=="range" } { # D range 152 | lassign [compute_avg_msd] tlist msdlist 153 | set dlist [msd_to_d $tlist $msdlist] 154 | return [list $tlist $dlist] 155 | } elseif { $arg(fitD)=="range" } { 156 | lassign [compute_avg_msd] tlist msdlist 157 | set dfit [msd_fit $tlist $msdlist] 158 | return $dfit 159 | } else { 160 | error "Unknown invocation type." 161 | } 162 | 163 | } 164 | 165 | 166 | # Save to file 167 | proc ::diffusion_coefficient::save_to_file {fn} { 168 | lassign [compute_avg_msd] tlist msdlist 169 | set dlist [msd_to_d $tlist $msdlist] 170 | set dfit [msd_fit $tlist $msdlist] 171 | 172 | set fp [open $fn w] 173 | puts $fp "# Created with the Diffusion Coefficient Tool for VMD." 174 | puts $fp "# Options: [get_cli_equivalent]" 175 | puts $fp [format "# Fit value for D (first two columns): %.4g \xB1 %.4g \xC5\xB2/ns (intercept %.4g \xB1 %.4g \xC5\xB2)" {*}$dfit] 176 | puts $fp "# Tau MSD D" 177 | foreach tau $tlist msd $msdlist d $dlist { 178 | puts $fp [format "%.4f %.4f %.4f" $tau $msd $d] 179 | } 180 | close $fp 181 | } 182 | 183 | 184 | # Default analysis interval is the whole trajectory, all frames 185 | proc ::diffusion_coefficient::set_default_interval {} { 186 | variable arg 187 | if [molinfo num] { 188 | set nf [molinfo top get numframes] 189 | set arg(interval_from) 0 190 | set arg(interval_to) [expr $nf-1] 191 | set arg(interval_stride) 1 192 | } 193 | } 194 | 195 | 196 | # Default lags is from 1/10 to 1/2 of the whole trajectory, at steps 197 | # of 1/50 198 | proc ::diffusion_coefficient::set_default_lags {} { 199 | variable arg 200 | if [molinfo num] { 201 | set nf [molinfo top get numframes] 202 | set arg(from) [expr $nf/10] 203 | set arg(to) [expr $nf/2 ] 204 | set arg(step) [expr $nf/50] 205 | } 206 | } 207 | 208 | 209 | 210 | # Performs sanity checks on selection 211 | proc diffusion_coefficient::check_selection {} { 212 | variable arg 213 | set as [atomselect top $arg(selection)] 214 | if {[$as num]==0} { 215 | $as delete 216 | error "Atom selection is empty" 217 | } 218 | if { [$as num] != [llength [lsort -uniq [$as get fragment]]] } { 219 | $as delete 220 | error "Each selected atom should belong to a separate molecule" 221 | } 222 | $as delete 223 | if {[molinfo top get numframes]<=2} { 224 | error "Not enough trajectory frames" 225 | } 226 | } 227 | 228 | 229 | # Return a zero-centered version of the input list 230 | proc diffusion_coefficient::veccenter {l} { 231 | set m [vecmean $l] 232 | set N [llength $l] 233 | set mN [lrepeat $N $m] 234 | set r [vecsub $l $mN] 235 | return $r 236 | } 237 | 238 | 239 | # If loaded in gui, update message. Otherwise, print. 240 | proc diffusion_coefficient::set_status {msg} { 241 | variable status_text $msg 242 | update 243 | puts "$msg" 244 | } 245 | 246 | 247 | # Number of dimensions 248 | proc diffusion_coefficient::nd {} { 249 | variable arg 250 | set alongx $arg(alongx) 251 | set alongy $arg(alongy) 252 | set alongz $arg(alongz) 253 | set ND [expr $alongx+$alongy+$alongz] 254 | return $ND 255 | } 256 | 257 | 258 | # Requires atomselect, axis ("x", "y" or "z"), start and end frames. 259 | # Returns the squared distance moved along that axis 260 | proc diffusion_coefficient::delta2_between {as axis t0 t1} { 261 | variable arg 262 | $as frame $t0 263 | set v0 [$as get $axis] 264 | $as frame $t1 265 | set v1 [$as get $axis] 266 | if {$arg(remove_drift)==1} { 267 | set v0 [veccenter $v0] 268 | set v1 [veccenter $v1] 269 | } 270 | set dv [vecsub $v1 $v0] 271 | set dv2 [vecdot $dv $dv] 272 | return $dv2 273 | } 274 | 275 | 276 | # Uses the atomselect 277 | proc diffusion_coefficient::msd_between {as t0 t1} { 278 | variable arg 279 | set alongx $arg(alongx) 280 | set alongy $arg(alongy) 281 | set alongz $arg(alongz) 282 | 283 | set N [$as num] 284 | 285 | set dx2 0 286 | set dy2 0 287 | set dz2 0 288 | 289 | if {$alongx==1} { 290 | set dx2 [delta2_between $as x $t0 $t1] 291 | } 292 | if {$alongy==1} { 293 | set dy2 [delta2_between $as y $t0 $t1] 294 | } 295 | if {$alongz==1} { 296 | set dz2 [delta2_between $as z $t0 $t1] 297 | } 298 | set msd [expr ($dx2+$dy2+$dz2)/$N ] 299 | return $msd 300 | } 301 | 302 | 303 | 304 | 305 | # Compute the average MSD. Takes data from the currently-loaded 306 | # molecule, returns two lists with lag times and MSD (floats). 307 | # Drift removal: see 308 | # http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1303338/ 309 | proc diffusion_coefficient::compute_avg_msd {} { 310 | variable arg 311 | variable abort_flag 312 | 313 | set from $arg(from) 314 | set to $arg(to) 315 | set step $arg(step) 316 | set interval_from $arg(interval_from) 317 | set interval_to $arg(interval_to) 318 | set interval_stride $arg(interval_stride) 319 | 320 | set alongx $arg(alongx); set alongy $arg(alongy); set alongz $arg(alongz) 321 | 322 | check_selection 323 | 324 | set_status "Initializing" 325 | 326 | set as [atomselect top $arg(selection)] 327 | 328 | set T [molinfo top get numframes] 329 | if {$to=="last"} { set to [expr $T-1] } 330 | if {$interval_to=="last"} { set interval_to [expr $T-1] } 331 | 332 | # Form windows of varying sizes; ws=tau 333 | set tau_list {} 334 | set msd_list {} 335 | for {set ws $from} {$ws<=$to} {incr ws $step} { 336 | set msdavg 0 337 | set ns 0 338 | # and slide them 339 | for {set t0 $interval_from} \ 340 | {$t0<[expr $interval_to-$ws]} \ 341 | {incr t0 $interval_stride} { 342 | set t1 [expr $t0+$ws] 343 | set msd [msd_between $as $t0 $t1] 344 | set msdavg [expr $msdavg+$msd] 345 | incr ns 346 | } 347 | 348 | # convert frames into time units 349 | set tau [expr $ws*$arg(dt)] 350 | lappend tau_list $tau 351 | lappend msd_list [expr 1.*$msdavg/$ns] 352 | 353 | set_status [format "Computing: %2.0f%% done" \ 354 | [expr 100.*($ws-$from+1)/($to-$from+1)] ] 355 | 356 | if {$abort_flag == 1} { 357 | set abort_flag 0 358 | set_status "Aborted." 359 | $as delete 360 | error Aborted. 361 | } 362 | } 363 | 364 | $as delete 365 | 366 | # return 367 | set_status "Ready" 368 | return [list $tau_list $msd_list] 369 | } 370 | 371 | 372 | 373 | # Gets tau, MSD(tau) and returns MSD(tau)/2/D/tau 374 | proc diffusion_coefficient::msd_to_d {tau_list msd_list} { 375 | variable arg 376 | 377 | set dt $arg(dt); # not needed- we get real times in 378 | foreach tau $tau_list msd $msd_list { 379 | lappend d_list [expr $msd/2.0/$tau/[nd]] 380 | } 381 | return $d_list 382 | } 383 | 384 | 385 | # Gets tau, MSD(tau) and returns MSD(tau)/2/D/tau, intercept, and 386 | # standard errors computed by linear fits. 387 | proc diffusion_coefficient::msd_fit {tau_list msd_list} { 388 | variable arg 389 | 390 | set dt $arg(dt); # not needed- we get real times in 391 | 392 | set fit [linear-model $tau_list $msd_list 1] 393 | set fit_slope [lindex $fit 1] 394 | set fit_int [lindex $fit 0] 395 | set fit_slope_se [lindex $fit 7] 396 | set fit_int_se [lindex $fit 5] 397 | 398 | set out [list \ 399 | [expr $fit_slope/2.0/[nd] ] \ 400 | [expr $fit_slope_se/2.0/[nd] ] \ 401 | $fit_int \ 402 | $fit_int_se] 403 | 404 | set_status [format "Fit value for D: %.4g \xB1 %.4g \xC5\xB2/ns (intercept %.4g \xB1 %.4g \xC5\xB2)" {*}$out] 405 | 406 | return $out 407 | } 408 | 409 | 410 | 411 | 412 | 413 | 414 | ## From TCLLIB, https://github.com/tcltk/tcllib/blob/master/modules/math/statistics.tcl 415 | # 416 | # linear-model 417 | # Determine the coefficients for a linear regression between 418 | # two series of data (the model: Y = A + B*X) 419 | # 420 | # Arguments: 421 | # xdata Series of independent (X) data 422 | # ydata Series of dependent (Y) data 423 | # intercept Whether to use an intercept or not (optional) 424 | # 425 | # Result: 426 | # List of the following items: 427 | # - (Estimate of) Intercept A 428 | # - (Estimate of) Slope B 429 | # - Standard deviation of Y relative to fit 430 | # - Correlation coefficient R2 431 | # - Number of degrees of freedom df 432 | # - Standard error of the intercept A 433 | # - Significance level of A 434 | # - Standard error of the slope B 435 | # - Significance level of B 436 | # 437 | # 438 | proc diffusion_coefficient::linear-model { xdata ydata {intercept 1} } { 439 | variable TOOFEWDATA 440 | 441 | if { [llength $xdata] < 3 } { 442 | return -code error -errorcode ARG "$TOOFEWDATA: not enough independent data" 443 | } 444 | if { [llength $ydata] < 3 } { 445 | return -code error -errorcode ARG "$TOOFEWDATA: not enough dependent data" 446 | } 447 | if { [llength $xdata] != [llength $ydata] } { 448 | return -code error -errorcode ARG "$TOOFEWDATA: number of dependent data differs from number of independent data" 449 | } 450 | 451 | set sumx 0.0 452 | set sumy 0.0 453 | set sumx2 0.0 454 | set sumy2 0.0 455 | set sumxy 0.0 456 | set df 0 457 | foreach x $xdata y $ydata { 458 | if { $x != "" && $y != "" } { 459 | set sumx [expr {$sumx+$x}] 460 | set sumy [expr {$sumy+$y}] 461 | set sumx2 [expr {$sumx2+$x*$x}] 462 | set sumy2 [expr {$sumy2+$y*$y}] 463 | set sumxy [expr {$sumxy+$x*$y}] 464 | incr df 465 | } 466 | } 467 | 468 | if { $df <= 2 } { 469 | return -code error -errorcode ARG "$TOOFEWDATA: too few valid data" 470 | } 471 | if { $sumx2 == 0.0 } { 472 | return -code error -errorcode ARG "$TOOFEWDATA: independent values are all the same" 473 | } 474 | 475 | # 476 | # Calculate the intermediate quantities 477 | # 478 | set sx [expr {$sumx2-$sumx*$sumx/$df}] 479 | set sy [expr {$sumy2-$sumy*$sumy/$df}] 480 | set sxy [expr {$sumxy-$sumx*$sumy/$df}] 481 | 482 | # 483 | # Calculate the coefficients 484 | # 485 | if { $intercept } { 486 | set B [expr {$sxy/$sx}] 487 | set A [expr {($sumy-$B*$sumx)/$df}] 488 | } else { 489 | set B [expr {$sumxy/$sumx2}] 490 | set A 0.0 491 | } 492 | 493 | # 494 | # Calculate the error estimates 495 | # 496 | set stdevY 0.0 497 | set varY 0.0 498 | 499 | if { $intercept } { 500 | set ve [expr {$sy-$B*$sxy}] 501 | if { $ve >= 0.0 } { 502 | set varY [expr {$ve/($df-2)}] 503 | } 504 | } else { 505 | set ve [expr {$sumy2-$B*$sumxy}] 506 | if { $ve >= 0.0 } { 507 | set varY [expr {$ve/($df-1)}] 508 | } 509 | } 510 | set seY [expr {sqrt($varY)}] 511 | 512 | if { $intercept } { 513 | set R2 [expr {$sxy*$sxy/($sx*$sy)}] 514 | set seA [expr {$seY*sqrt(1.0/$df+$sumx*$sumx/($sx*$df*$df))}] 515 | set seB [expr {sqrt($varY/$sx)}] 516 | set tA {} 517 | set tB {} 518 | if { $seA != 0.0 } { 519 | set tA [expr {$A/$seA*sqrt($df-2)}] 520 | } 521 | if { $seB != 0.0 } { 522 | set tB [expr {$B/$seB*sqrt($df-2)}] 523 | } 524 | } else { 525 | set R2 [expr {$sumxy*$sumxy/($sumx2*$sumy2)}] 526 | set seA {} 527 | set tA {} 528 | set tB {} 529 | set seB [expr {sqrt($varY/$sumx2)}] 530 | if { $seB != 0.0 } { 531 | set tB [expr {$B/$seB*sqrt($df-1)}] 532 | } 533 | } 534 | 535 | # 536 | # Return the list of parameters 537 | # 538 | return [list $A $B $seY $R2 $df $seA $tA $seB $tB] 539 | } 540 | -------------------------------------------------------------------------------- /diffusion_coefficient_gui.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env wish# diffusion_coefficient_gui.tcl -- 2 | # 3 | # UI generated by GUI Builder Build 146 on 2019-09-18 20:38:55 from: 4 | # /Users/toni/compile/vmd_diffusion_coefficient/diffusion_coefficient_gui.ui 5 | # This file is auto-generated. Only the code within 6 | # '# BEGIN USER CODE' 7 | # '# END USER CODE' 8 | # and code inside the callback subroutines will be round-tripped. 9 | # The proc names 'ui' and 'init' are reserved. 10 | # 11 | 12 | package require Tk 8.4 13 | 14 | # Declare the namespace for this dialog 15 | namespace eval diffusion_coefficient_gui {} 16 | 17 | # Source the ui file, which must exist 18 | set diffusion_coefficient_gui::SCRIPTDIR [file dirname [info script]] 19 | source [file join $diffusion_coefficient_gui::SCRIPTDIR diffusion_coefficient_gui_ui.tcl] 20 | 21 | # BEGIN USER CODE 22 | # ---------------------------------------- 23 | # GUI functions for computing density profiles. 24 | # ---------------------------------------- 25 | 26 | 27 | # This code is a mess because it can be loaded back in guibuilder. 28 | package provide diffusion_coefficient_gui 1.2 29 | 30 | namespace eval diffusion_coefficient_gui { 31 | variable utf8_tau "\u03C4" 32 | variable utf8_A2 "\uc5\ub2" 33 | variable already_registered 0 34 | 35 | variable w .diffusion_coefficient 36 | variable abort_button $w.abort_button 37 | # http://www.small-icons.com/packs/24x24-free-application-icons.htm 38 | variable save_icon_data { 39 | R0lGODlhGAAYAHcAACH5BAEAAA4ALAAAAAAYABgAp+bo5/f3+CprsN7Z1v///mV7l4igtmu+6t/g 40 | 4fDx8dXT1Ojp6ePk5dvc3QEAAP///xdarP/9+dXW2Ozt7f3+/mzF8HXK8XnN8hxhr1y77OLj5YLS 41 | 9X3V+byvstDR04La/9HS1H3S9Nze3vX29hyc5VtVX2xmc3HH8N3f4Pj5+Gm756Ganf39/ozZ+Pn5 42 | +n3O9JyPkPP19JLT8UI5RjuLzPb49+bm5ce+wWVebXZxfFyt4rWrrmK/7v//+zSJzrnl+qvd9nrV 43 | /jN9xHDJ8hWa5H52hkm17uvs7dLu/Oze2yui5yFsu/j7+U1HVFVOXOHi46upsz6u6zgxO6akr0Sy 44 | 7KueotnZ2+/w8DKn5zmr6b+1uGd7l1W16LWmpo6Lkkit5leCpLSnqLiqrGmSuKqdn2fI9nfQ+aWZ 45 | mS1usiWe5VGr5NjX15WEf4qiuK+ipPv7/GTI+oTV9aGUlWt5kcK3trq3uvz+/VCp4Pr6+vv7+y93 46 | vnvT+WvK90hBTWfD8nOJpW/M9+Tg3NTU13PO9/Ds6zin5PXy7yhyvEKp5ZONlYDU9VC26kKf3Gqz 47 | 2pSRm4XP7yKa3szt+3tzgIDN7rPh99DQ0qCWmenq7Cl3wz+b2jGi4o3Z9tfW1/z8/F5WY6/g90yg 48 | 21KAo1R+n7Xk+IzR8I6JmtPLzl226kea1s7N0Fy/8Eyx55jV8nNvfc3FyNfY2TWDxzeP0jmFyUOi 49 | 4IeBkYDV+0ppg1F/pTGFysvAw8LAx3nJ7Pr9+6WeoBxotouHl9ra3IR/j1C67vHy8vn39VO46lSv 50 | 5FKt5kSh30uz6ESW1JyUlt/h4puZoPr7+kKU0kCQ0NbX2NfW2tbV2GfD71a87yx7xla668Xt/7y4 51 | utDFyT1PZU+37mjC8CdzwC59yHG43NTKzOvp52a+7L7o+Vmz5tja29DIy8S5vNrZ2GjA773r/zqT 52 | 1Cig4IB6hIuFj53X8yZwvp+dp23I7rzn+6Xa86DY9GPB8MDp+0md2dnY2D6r5YWBidXU1TyX2AAA 53 | AAj/ABGtykBQhYoDCBMqVKGj2CkHEL9EQoJvXZIeETJq7PGg44Mk2MYdg1gOySZFHM7FSMCyZY0V 54 | vVYoMMWhBRc1DoyRCxGHg6srE4IKJWYLXKMV4TjEsalDDb0QG/bcOLKgqlVDYD58sKRtz4YNLWbd 55 | +XHhhRl0ABioXUtIVK0gy3KZefFiA7KxFi4M0qIBgd+/4kJ9CALjxqALF0IwAjVqiAVAHVA0mEzZ 56 | xjYwtxJpAWQhb6Z8lCqc4LPDioTTqK3UyVbHww4+J05Y8IfqE7UKZaroU8C7dz9Oa9akq1KmQoUh 57 | 7JQB4eEHzp82BqJLn97mDxw/6irEegZE1Zg5WwqI/x9PXvyWOWPudfMBrZ6wLg8IyJ9Pn/6DLtV4 58 | +KBhzwgdFyO44AIeebzxRicsJEgBBXngQQc3GeBCAzxUdMCELlBMIU8zjnjxDj/uSJKDCV7Y0YER 59 | 13wjCytRiDFCADDGKOOMYlCxiDWwyJBFGCzFMEINKaTAhDO82LEgBSkME0YUyWAihAxYuHEFFL8E 60 | U0QrJuBQghNN9DGDFCXE4EYWX3gjBClKkHEJMK9IE800gggCAggeeFBJKiAcQQYW+8SjxyNpnGED 61 | AIQWauihZyhRyBJ6TEKCHAxMUQotRYyIgydcegnmAnKkockSh+xCBAwimNOACCKg4BczTzyhwasI 62 | oCkAAwnt+ILBPESwEcgAvPbqq6+BsEECJBBgAEGxaAig7LLMMouGsccGBAA7 63 | } 64 | variable stop_icon_data { 65 | R0lGODlhGAAYAHcAACH5BAEAAAAALAAAAAAYABgApwEAAP////RiS/RxVaUBA+4VEvJGSe4WEu0N 66 | D/R5W/RyV+4bE+4TEfR1WfbFyPRuUvZ6XfR6XesYC/mdgfRqTO4XEvR2Wd0GAe4cEu4QEPILDvR3 67 | WsorK/RkSvBFQeIZIsUVFuaqr6IBBe4PD8cKCvRyVe4YE+4SEJgAA+IGAe4REPAgFe0LDvR1WO0M 68 | DsMGCeyIj6wBBfEuNfBEPugKAOZCRuIWDuU4OZIAAu9DQe0rMvZ8X/EeEvUiHPDIzfEcFO9VUug6 69 | O/FVVfRpT7sDB4sAAfEbEssAAO0OD/AYEe8TEfYaGvEfFOxdYuguNfArM98AAO8YE/mcgvRzWPZ5 70 | XOQHAKAAA+4ZE+1vdu4SEdFfYekWCPIKDu4YEvR5WvRxU+aHifR4WtFKS/EbDv339fEcD/RuUMYX 71 | Gd8KAvRpS9wRDeE3OcoSFPMhDcsYGfmxmfR0WfMTEvmzmvZNNcwLDPRsTrADBtArLvmcgfMbDuxC 72 | P+wuNu8dFPRvVOQRBs4RFONBRskJCuQLB+8XEtAIC7sTFdsfIPE/RPWBYfMhFMkRE/RyVvAYDtEq 73 | Ke0tNeYrMvJWVvV3WOQtKsIMEPYJDvRmTPmIb+gqMvRrUPMkFvNYV/NjSMgRD/mhhPhEM+8VEvJH 74 | SvRtUuMQCfislfEZEtEPEvRtUPMOEPFARvmokPRvT/RtTM4JC/MIDvmqlP34+PZnS/QaE/IpEPmw 75 | luE0K/CdpfB7g/AVDPQMDu8tNew5KfN5W/gVGfZvU/mnjvIMDuc2OfZQON44PLoQEeILDuAAAPmc 76 | gOQAAOE4PdkcGfiEa/RzV/QpHvPIzb0UFtcVEPmPddoGAPIhFr4FCOg9QO/T1fMXE/QQEPV+XfIf 77 | FNoxNcEcHPV5W/NAMOYOAuMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 78 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 79 | AAj/AAEIHCjjkIGDCA2AQiVjoEOHTzTJMTah4gQpUvB08tDw4cAnkN7s2AGhJAQqVHYlQOQhl0cA 80 | OoTMghChZs0EOBN4CYPNg6OHMUdtCKNzg1ELSBs0aAGHW449Ay8BcbXUgtIWU6YsU8B1gNcSkXI4 81 | AfAISKoSi7gq8Mp2wJcvD+KGelBCjxNqvvqYoVBH1SoKgE09SLOpEqYhHRIP6QWsBjQBkCNLnkz5 82 | Rg1LtgK8ChAigOcAMBx8djAjABnPM24AUlYrADFBKYqJhgIlQJNjTQJ8CBAkSIAZa4TBQuYZhp8t 83 | zQLQoBHggqwLugNgwRJAkqFSwbZoK+7NR4AqVQKo/2kDffdnCYT+zLmTjA7nb95TpAgA5giYABIC 84 | cJAgIRMrNrp05lkjaFTTXDSieeYALfrlsYI0gSjSDSdaaEECBjZsw4ENiRwhhhggiPIMB8MYscAP 85 | JEziCQ9ljMHECitkwwMTfPzAyC1JLGBEEqREEUUsL8TgBjMYFLnAkQtccYUJJnRRQQUHRPmJNSTY 86 | AUAMZ/QwSJNPRnlAAWCCyQADSsQR5EAigNCDEmGOyUAWWZxwggoZZHDNCyI8ZAUIS6gwZ50jBIoE 87 | EgggcMo0KLyEgjNLuFBooS64wMKkuBCR6EsA4FAILxr8osGnXHDRCiVE4IDpQEWIQMCqrK5qRREe 88 | BQEEADs= 89 | } 90 | } 91 | 92 | # VMD-specific stuff 93 | set diffusion_coefficient_gui::in_vmd \ 94 | [string length [info proc vmd_install_extension]] 95 | if { $diffusion_coefficient_gui::in_vmd } { 96 | package require diffusion_coefficient 97 | } else { 98 | # Kludge to run outside VMD 99 | namespace eval ::diffusion_coefficient:: {} 100 | array set ::diffusion_coefficient::arg {} 101 | } 102 | 103 | 104 | # Tweak the icon 105 | proc diffusion_coefficient_gui::fixup_ui_icons {} { 106 | variable w 107 | image create photo SaveGIF -data $diffusion_coefficient_gui::save_icon_data 108 | image create photo StopGIF -data $diffusion_coefficient_gui::stop_icon_data 109 | $w.save_button configure -image SaveGIF 110 | $w.abort_button configure -image StopGIF 111 | } 112 | 113 | 114 | 115 | # Register menu if possible 116 | proc diffusion_coefficient_gui::register_menu {} { 117 | variable already_registered 118 | if {$already_registered==0} { 119 | incr already_registered 120 | vmd_install_extension diffusion_coefficient_gui \ 121 | diffusion_coefficient_gui::diffusion_coefficient_tk \ 122 | "Analysis/Diffusion Coefficient Tool" 123 | } 124 | } 125 | 126 | 127 | # Called right upon menu action 128 | proc diffusion_coefficient_gui::diffusion_coefficient_tk {} { 129 | # puts "In diffusion_coefficient_tk" 130 | variable diffusion_coefficient_window 131 | if { [winfo exists .diffusion_coefficient] } { 132 | wm deiconify $diffusion_coefficient_window 133 | } else { 134 | set diffusion_coefficient_window [ toplevel ".diffusion_coefficient" ] 135 | wm title $diffusion_coefficient_window "Diffusion Coefficient Tool" 136 | diffusion_coefficient_gui::ui $diffusion_coefficient_window; # diffusion_coefficient_gui::init is now obsolete 137 | fixup_ui_icons 138 | } 139 | reset_interval_button_command 140 | reset_lags_button_command 141 | return $diffusion_coefficient_window 142 | } 143 | 144 | proc diffusion_coefficient_gui::help_docs {} { 145 | vmd_open_url https://github.com/giorginolab/vmd_diffusion_coefficient/ 146 | } 147 | 148 | proc diffusion_coefficient_gui::help_about {} { 149 | variable diffusion_coefficient_window 150 | tk_messageBox -title "About" -parent $diffusion_coefficient_window -message \ 151 | " 152 | VMD Diffusion Coefficient Tool 153 | 154 | Version [package versions diffusion_coefficient] 155 | 156 | Toni Giorgino 157 | National Research Council of Italy (CNR) 158 | 159 | Copyright (c) 2010-2019 160 | 161 | Previous versions: 162 | Computational Biophysics Group 163 | Research Programme on Biomedical Informatics (GRIB-IMIM) 164 | Universitat Pompeu Fabra (UPF) 165 | 166 | " 167 | 168 | } 169 | # END USER CODE 170 | 171 | # BEGIN CALLBACK CODE 172 | # ONLY EDIT CODE INSIDE THE PROCS. 173 | 174 | # diffusion_coefficient_gui::_checkbutton_1_command -- 175 | # 176 | # Callback to handle _checkbutton_1 widget option -command 177 | # 178 | # ARGS: 179 | # 180 | # 181 | proc diffusion_coefficient_gui::_checkbutton_1_command args {} 182 | 183 | # diffusion_coefficient_gui::_checkbutton_2_command -- 184 | # 185 | # Callback to handle _checkbutton_2 widget option -command 186 | # 187 | # ARGS: 188 | # 189 | # 190 | proc diffusion_coefficient_gui::_checkbutton_2_command args {} 191 | 192 | # diffusion_coefficient_gui::_checkbutton_3_command -- 193 | # 194 | # Callback to handle _checkbutton_3 widget option -command 195 | # 196 | # ARGS: 197 | # 198 | # 199 | proc diffusion_coefficient_gui::_checkbutton_3_command args {} 200 | 201 | # diffusion_coefficient_gui::_checkbutton_4_command -- 202 | # 203 | # Callback to handle _checkbutton_4 widget option -command 204 | # 205 | # ARGS: 206 | # 207 | # 208 | proc diffusion_coefficient_gui::_checkbutton_4_command args {} 209 | 210 | # diffusion_coefficient_gui::_entry_1_invalidcommand -- 211 | # 212 | # Callback to handle _entry_1 widget option -invalidcommand 213 | # 214 | # ARGS: 215 | # 216 | # 217 | proc diffusion_coefficient_gui::_entry_1_invalidcommand args {} 218 | 219 | # diffusion_coefficient_gui::_entry_1_validatecommand -- 220 | # 221 | # Callback to handle _entry_1 widget option -validatecommand 222 | # 223 | # ARGS: 224 | # 225 | # 226 | proc diffusion_coefficient_gui::_entry_1_validatecommand args {} 227 | 228 | # diffusion_coefficient_gui::_entry_1_xscrollcommand -- 229 | # 230 | # Callback to handle _entry_1 widget option -xscrollcommand 231 | # 232 | # ARGS: 233 | # 234 | # 235 | proc diffusion_coefficient_gui::_entry_1_xscrollcommand args {} 236 | 237 | # diffusion_coefficient_gui::_entry_2_invalidcommand -- 238 | # 239 | # Callback to handle _entry_2 widget option -invalidcommand 240 | # 241 | # ARGS: 242 | # 243 | # 244 | proc diffusion_coefficient_gui::_entry_2_invalidcommand args {} 245 | 246 | # diffusion_coefficient_gui::_entry_2_validatecommand -- 247 | # 248 | # Callback to handle _entry_2 widget option -validatecommand 249 | # 250 | # ARGS: 251 | # 252 | # 253 | proc diffusion_coefficient_gui::_entry_2_validatecommand args {} 254 | 255 | # diffusion_coefficient_gui::_entry_2_xscrollcommand -- 256 | # 257 | # Callback to handle _entry_2 widget option -xscrollcommand 258 | # 259 | # ARGS: 260 | # 261 | # 262 | proc diffusion_coefficient_gui::_entry_2_xscrollcommand args {} 263 | 264 | # diffusion_coefficient_gui::_entry_3_invalidcommand -- 265 | # 266 | # Callback to handle _entry_3 widget option -invalidcommand 267 | # 268 | # ARGS: 269 | # 270 | # 271 | proc diffusion_coefficient_gui::_entry_3_invalidcommand args {} 272 | 273 | # diffusion_coefficient_gui::_entry_3_validatecommand -- 274 | # 275 | # Callback to handle _entry_3 widget option -validatecommand 276 | # 277 | # ARGS: 278 | # 279 | # 280 | proc diffusion_coefficient_gui::_entry_3_validatecommand args {} 281 | 282 | # diffusion_coefficient_gui::_entry_3_xscrollcommand -- 283 | # 284 | # Callback to handle _entry_3 widget option -xscrollcommand 285 | # 286 | # ARGS: 287 | # 288 | # 289 | proc diffusion_coefficient_gui::_entry_3_xscrollcommand args {} 290 | 291 | # diffusion_coefficient_gui::_entry_4_invalidcommand -- 292 | # 293 | # Callback to handle _entry_4 widget option -invalidcommand 294 | # 295 | # ARGS: 296 | # 297 | # 298 | proc diffusion_coefficient_gui::_entry_4_invalidcommand args {} 299 | 300 | # diffusion_coefficient_gui::_entry_4_validatecommand -- 301 | # 302 | # Callback to handle _entry_4 widget option -validatecommand 303 | # 304 | # ARGS: 305 | # 306 | # 307 | proc diffusion_coefficient_gui::_entry_4_validatecommand args {} 308 | 309 | # diffusion_coefficient_gui::_entry_4_xscrollcommand -- 310 | # 311 | # Callback to handle _entry_4 widget option -xscrollcommand 312 | # 313 | # ARGS: 314 | # 315 | # 316 | proc diffusion_coefficient_gui::_entry_4_xscrollcommand args {} 317 | 318 | # diffusion_coefficient_gui::_entry_5_invalidcommand -- 319 | # 320 | # Callback to handle _entry_5 widget option -invalidcommand 321 | # 322 | # ARGS: 323 | # 324 | # 325 | proc diffusion_coefficient_gui::_entry_5_invalidcommand args {} 326 | 327 | # diffusion_coefficient_gui::_entry_5_validatecommand -- 328 | # 329 | # Callback to handle _entry_5 widget option -validatecommand 330 | # 331 | # ARGS: 332 | # 333 | # 334 | proc diffusion_coefficient_gui::_entry_5_validatecommand args {} 335 | 336 | # diffusion_coefficient_gui::_entry_5_xscrollcommand -- 337 | # 338 | # Callback to handle _entry_5 widget option -xscrollcommand 339 | # 340 | # ARGS: 341 | # 342 | # 343 | proc diffusion_coefficient_gui::_entry_5_xscrollcommand args {} 344 | 345 | # diffusion_coefficient_gui::_entry_6_invalidcommand -- 346 | # 347 | # Callback to handle _entry_6 widget option -invalidcommand 348 | # 349 | # ARGS: 350 | # 351 | # 352 | proc diffusion_coefficient_gui::_entry_6_invalidcommand args {} 353 | 354 | # diffusion_coefficient_gui::_entry_6_validatecommand -- 355 | # 356 | # Callback to handle _entry_6 widget option -validatecommand 357 | # 358 | # ARGS: 359 | # 360 | # 361 | proc diffusion_coefficient_gui::_entry_6_validatecommand args {} 362 | 363 | # diffusion_coefficient_gui::_entry_6_xscrollcommand -- 364 | # 365 | # Callback to handle _entry_6 widget option -xscrollcommand 366 | # 367 | # ARGS: 368 | # 369 | # 370 | proc diffusion_coefficient_gui::_entry_6_xscrollcommand args {} 371 | 372 | # diffusion_coefficient_gui::_entry_7_invalidcommand -- 373 | # 374 | # Callback to handle _entry_7 widget option -invalidcommand 375 | # 376 | # ARGS: 377 | # 378 | # 379 | proc diffusion_coefficient_gui::_entry_7_invalidcommand args {} 380 | 381 | # diffusion_coefficient_gui::_entry_7_validatecommand -- 382 | # 383 | # Callback to handle _entry_7 widget option -validatecommand 384 | # 385 | # ARGS: 386 | # 387 | # 388 | proc diffusion_coefficient_gui::_entry_7_validatecommand args {} 389 | 390 | # diffusion_coefficient_gui::_entry_7_xscrollcommand -- 391 | # 392 | # Callback to handle _entry_7 widget option -xscrollcommand 393 | # 394 | # ARGS: 395 | # 396 | # 397 | proc diffusion_coefficient_gui::_entry_7_xscrollcommand args {} 398 | 399 | # diffusion_coefficient_gui::_entry_8_invalidcommand -- 400 | # 401 | # Callback to handle _entry_8 widget option -invalidcommand 402 | # 403 | # ARGS: 404 | # 405 | # 406 | proc diffusion_coefficient_gui::_entry_8_invalidcommand args {} 407 | 408 | # diffusion_coefficient_gui::_entry_8_validatecommand -- 409 | # 410 | # Callback to handle _entry_8 widget option -validatecommand 411 | # 412 | # ARGS: 413 | # 414 | # 415 | proc diffusion_coefficient_gui::_entry_8_validatecommand args {} 416 | 417 | # diffusion_coefficient_gui::_entry_8_xscrollcommand -- 418 | # 419 | # Callback to handle _entry_8 widget option -xscrollcommand 420 | # 421 | # ARGS: 422 | # 423 | # 424 | proc diffusion_coefficient_gui::_entry_8_xscrollcommand args {} 425 | 426 | # diffusion_coefficient_gui::abort_button_command -- 427 | # 428 | # Callback to handle abort_button widget option -command 429 | # 430 | # ARGS: 431 | # 432 | # 433 | proc diffusion_coefficient_gui::abort_button_command args {} 434 | 435 | # diffusion_coefficient_gui::button_help_command -- 436 | # 437 | # Callback to handle button_help widget option -command 438 | # 439 | # ARGS: 440 | # 441 | # 442 | proc diffusion_coefficient_gui::button_help_command args { 443 | help_docs 444 | } 445 | 446 | # diffusion_coefficient_gui::plot_d_button_command -- 447 | # 448 | # Callback to handle plot_d_button widget option -command 449 | # 450 | # ARGS: 451 | # 452 | # 453 | proc diffusion_coefficient_gui::plot_d_button_command args { 454 | variable ::diffusion_coefficient::arg 455 | variable diffusion_coefficient_window 456 | variable utf8_tau 457 | variable utf8_A2 458 | variable abort_button 459 | 460 | $abort_button configure -state normal 461 | if [ catch { 462 | puts "diffusion_coefficient) Equivalent command: diffusion_coefficient -d range [::diffusion_coefficient::get_cli_equivalent]" 463 | 464 | set ND [::diffusion_coefficient::nd] 465 | lassign [::diffusion_coefficient::compute_avg_msd] tlist msdlist 466 | 467 | set fit [::diffusion_coefficient::msd_fit $tlist $msdlist] 468 | set a [lindex $fit 0] 469 | set b [lindex $fit 2] 470 | set t0 [lindex $tlist 0] 471 | set t1 [lindex $tlist end] 472 | 473 | set dlist [::diffusion_coefficient::msd_to_d $tlist $msdlist] 474 | 475 | set title [format "%d-dimensional diffusion coefficient, D = MSD/(2*$ND*$utf8_tau)" $ND] 476 | set mpl [multiplot -x $tlist -y $dlist -plot \ 477 | -title $title \ 478 | -xlabel "Lag time $utf8_tau (ns)" \ 479 | -ylabel "D ($utf8_A2/ns)" \ 480 | -marker point -radius 2 -fillcolor "#ff0000" -color "#ff0000" ] 481 | $mpl draw line $t0 $a $t1 $a -dash . 482 | # puts " $mpl draw line $t0 $a $t1 $a -dash . " 483 | } e ] { 484 | tk_messageBox -title Error -message $e -icon error \ 485 | -parent $diffusion_coefficient_window 486 | } 487 | $abort_button configure -state disabled 488 | 489 | } 490 | 491 | # diffusion_coefficient_gui::plot_msd_button_command -- 492 | # 493 | # Callback to handle plot_msd_button widget option -command 494 | # 495 | # ARGS: 496 | # 497 | # 498 | proc diffusion_coefficient_gui::plot_msd_button_command args { 499 | variable diffusion_coefficient_window 500 | variable utf8_tau 501 | variable utf8_A2 502 | variable abort_button 503 | 504 | $abort_button configure -state normal 505 | if [ catch { 506 | puts "diffusion_coefficient) Equivalent command: diffusion_coefficient -msd range [::diffusion_coefficient::get_cli_equivalent]" 507 | 508 | set ND [::diffusion_coefficient::nd] 509 | lassign [::diffusion_coefficient::compute_avg_msd] tlist msdlist 510 | 511 | set fit [::diffusion_coefficient::msd_fit $tlist $msdlist] 512 | set a [expr 2.0 * $ND * [lindex $fit 0] ]; # MSD = 2 E D tau 513 | set b [lindex $fit 2] 514 | set t0 [lindex $tlist 0] 515 | set t1 [lindex $tlist end] 516 | set y0 [expr $a * $t0 + $b] 517 | set y1 [expr $a * $t1 + $b] 518 | 519 | set mpl [multiplot -x $tlist -y $msdlist -plot \ 520 | -title "Mean square displacement with linear fit" \ 521 | -xlabel "Lag time $utf8_tau (ns)" \ 522 | -ylabel "MSD ($utf8_A2)" \ 523 | -marker point -radius 2 -fillcolor "#ff0000" -color "#ff0000" ] 524 | 525 | $mpl draw line $t0 $y0 $t1 $y1 -dash . 526 | } e ] { 527 | tk_messageBox -title Error -message $e -icon error \ 528 | -parent $diffusion_coefficient_window 529 | } 530 | $abort_button configure -state disabled 531 | 532 | } 533 | 534 | # diffusion_coefficient_gui::reset_interval_button_command -- 535 | # 536 | # Callback to handle reset_interval_button widget option -command 537 | # 538 | # ARGS: 539 | # 540 | # 541 | proc diffusion_coefficient_gui::reset_interval_button_command args { 542 | ::diffusion_coefficient::set_default_interval 543 | } 544 | 545 | # diffusion_coefficient_gui::reset_lags_button_command -- 546 | # 547 | # Callback to handle reset_lags_button widget option -command 548 | # 549 | # ARGS: 550 | # 551 | # 552 | proc diffusion_coefficient_gui::reset_lags_button_command args { 553 | ::diffusion_coefficient::set_default_lags 554 | } 555 | 556 | # diffusion_coefficient_gui::save_button_command -- 557 | # 558 | # Callback to handle save_button widget option -command 559 | # 560 | # ARGS: 561 | # 562 | # 563 | proc diffusion_coefficient_gui::save_button_command args { 564 | variable diffusion_coefficient_window 565 | variable abort_button 566 | set fn [tk_getSaveFile -parent $diffusion_coefficient_window -filetypes {{{CSV Files} {.csv}} {{All files} *}} ] 567 | if {$fn != ""} { 568 | $abort_button configure -state normal 569 | if [ catch {::diffusion_coefficient::save_to_file $fn} e] { 570 | tk_messageBox -title Error -message $e -icon error -parent $diffusion_coefficient_window 571 | } 572 | $abort_button configure -state disabled 573 | } 574 | } 575 | 576 | # diffusion_coefficient_gui::abort_button_command -- 577 | # 578 | # Legacy command found in callback code. Add user comments inside body. 579 | # 580 | # ARGS: 581 | # 582 | # 583 | proc diffusion_coefficient_gui::abort_button_command args { 584 | set ::diffusion_coefficient::abort_flag 1 585 | } 586 | 587 | # END CALLBACK CODE 588 | 589 | # diffusion_coefficient_gui::init -- 590 | # 591 | # Call the optional userinit and initialize the dialog. 592 | # DO NOT EDIT THIS PROCEDURE. 593 | # 594 | # Arguments: 595 | # root the root window to load this dialog into 596 | # 597 | # Results: 598 | # dialog will be created, or a background error will be thrown 599 | # 600 | proc diffusion_coefficient_gui::init {root args} { 601 | # Catch this in case the user didn't define it 602 | catch {diffusion_coefficient_gui::userinit} 603 | if {[info exists embed_args]} { 604 | # we are running in the plugin 605 | diffusion_coefficient_gui::ui $root 606 | } elseif {$::argv0 == [info script]} { 607 | # we are running in stand-alone mode 608 | wm title $root diffusion_coefficient_gui 609 | if {[catch { 610 | # Create the UI 611 | diffusion_coefficient_gui::ui $root 612 | } err]} { 613 | bgerror $err ; exit 1 614 | } 615 | } 616 | catch {diffusion_coefficient_gui::run $root} 617 | } 618 | diffusion_coefficient_gui::init . 619 | 620 | -------------------------------------------------------------------------------- /diffusion_coefficient_gui.ui: -------------------------------------------------------------------------------- 1 | # GUIBUILDER FILE Build 146 2 | # Created: 2019-09-18 20:38:53 by GUI Builder Build 146 3 | language tcl 8.4 4 | widget {Tk frame} f { 5 | geometry min_column {40 40} 6 | geometry min_row {16 24 42 12 4 2 21 15 2 13 18} 7 | geometry pad_column {0 0} 8 | geometry pad_row {0 0 0 0 0 0 0 0 0 0 0} 9 | geometry resize_column {0 3} 10 | geometry resize_row {1 3 0 0 0 0 0 3 0 3 3} 11 | geometry weight_column {0 1} 12 | geometry weight_row {0 1 0 0 0 0 0 1 0 1 1} 13 | data GROUP Tk 14 | data ID {} 15 | data MASTER {} 16 | data TYPE {Tk frame} 17 | data level 0 18 | } 19 | widget {Tk frame} _frame_1 { 20 | geometry -column 2 21 | geometry -columnspan 1 22 | geometry -row 4 23 | geometry -rowspan 1 24 | geometry -sticky ew 25 | geometry min_column {40 40 40 40} 26 | geometry min_row 4 27 | geometry pad_column {0 0 0 0} 28 | geometry pad_row 0 29 | geometry resize_column {0 0 0 3} 30 | geometry resize_row 0 31 | geometry weight_column {0 0 0 1} 32 | geometry weight_row 0 33 | data GROUP Tk 34 | data ID _frame_1 35 | data MASTER {} 36 | data TYPE {Tk frame} 37 | data level 1 38 | } 39 | widget {Tk frame} _frame_3 { 40 | geometry -column 2 41 | geometry -columnspan 1 42 | geometry -row 5 43 | geometry -rowspan 1 44 | geometry -sticky news 45 | geometry min_column {40 40 40 40 40 40 40} 46 | geometry min_row 3 47 | geometry pad_column {0 0 0 0 0 0 0} 48 | geometry pad_row 0 49 | geometry resize_column {0 0 0 0 0 3 0} 50 | geometry resize_row 0 51 | geometry weight_column {0 0 0 0 0 1 0} 52 | geometry weight_row 0 53 | data GROUP Tk 54 | data ID _frame_3 55 | data MASTER {} 56 | data TYPE {Tk frame} 57 | data level 1 58 | } 59 | widget {Tk frame} _frame_4 { 60 | geometry -column 2 61 | geometry -columnspan 1 62 | geometry -row 6 63 | geometry -rowspan 1 64 | geometry -sticky news 65 | geometry min_column {40 40 40 40 40 40 40} 66 | geometry min_row 2 67 | geometry pad_column {0 0 0 0 0 0 0} 68 | geometry pad_row 0 69 | geometry resize_column {0 0 0 0 0 3 0} 70 | geometry resize_row 0 71 | geometry weight_column {0 0 0 0 0 1 0} 72 | geometry weight_row 0 73 | data GROUP Tk 74 | data ID _frame_4 75 | data MASTER {} 76 | data TYPE {Tk frame} 77 | data level 1 78 | } 79 | widget {Tk frame} _frame_6 { 80 | geometry -column 1 81 | geometry -columnspan 1 82 | geometry -row 11 83 | geometry -rowspan 1 84 | geometry -sticky ew 85 | geometry min_column {40 40} 86 | geometry min_row 2 87 | geometry pad_column {0 0} 88 | geometry pad_row 0 89 | geometry resize_column {0 3} 90 | geometry resize_row 0 91 | geometry weight_column {0 1} 92 | geometry weight_row 0 93 | data GROUP Tk 94 | data ID _frame_6 95 | data MASTER {} 96 | data TYPE {Tk frame} 97 | data level 1 98 | } 99 | widget {Tk frame} _frame_5 { 100 | geometry -column 2 101 | geometry -columnspan 1 102 | geometry -row 9 103 | geometry -rowspan 1 104 | geometry -sticky news 105 | geometry min_column {16 2 2 2} 106 | geometry min_row 2 107 | geometry pad_column {0 0 0 0} 108 | geometry pad_row 0 109 | geometry resize_column {3 3 0 0} 110 | geometry resize_row 0 111 | geometry weight_column {1 1 0 0} 112 | geometry weight_row 0 113 | data GROUP Tk 114 | data ID _frame_5 115 | data MASTER {} 116 | data TYPE {Tk frame} 117 | data level 1 118 | } 119 | widget {Tk label} _label_1 { 120 | configure -font {Helvetica 13 bold} 121 | configure -pady 6 122 | configure -text {VMD Diffusion Coefficient Tool} 123 | geometry -column 1 124 | geometry -columnspan 2 125 | geometry -row 1 126 | geometry -rowspan 1 127 | geometry -sticky ew 128 | geometry min_column {2 40} 129 | geometry min_row 2 130 | geometry pad_column {0 0} 131 | geometry pad_row 0 132 | geometry resize_column {3 3} 133 | geometry resize_row 0 134 | geometry weight_column {1 1} 135 | geometry weight_row 0 136 | data GROUP Tk 137 | data ID _label_1 138 | data MASTER {} 139 | data TYPE {Tk label} 140 | } 141 | widget {Tk label} _label_2 { 142 | configure -font {helvetica 10} 143 | configure -text {Compute one, two or three-dimensional mean squared displacements (MSD) of a molecular species, and associated diffusion coefficients} 144 | configure -wraplength 450 145 | geometry -column 1 146 | geometry -columnspan 2 147 | geometry -row 2 148 | geometry -rowspan 1 149 | geometry -sticky {} 150 | geometry min_column {2 40} 151 | geometry min_row 2 152 | geometry pad_column {0 0} 153 | geometry pad_row 0 154 | geometry resize_column {3 3} 155 | geometry resize_row 0 156 | geometry weight_column {1 1} 157 | geometry weight_row 0 158 | data GROUP Tk 159 | data ID _label_2 160 | data MASTER {} 161 | data TYPE {Tk label} 162 | } 163 | widget {Tk label} _label_3 { 164 | configure -font {helvetica 10} 165 | configure -text {Selection (one atom per molecule)} 166 | geometry -column 1 167 | geometry -columnspan 1 168 | geometry -row 3 169 | geometry -rowspan 1 170 | geometry -sticky e 171 | geometry min_column {2 40} 172 | geometry min_row 2 173 | geometry pad_column {0 0} 174 | geometry pad_row 0 175 | geometry resize_column {3 3} 176 | geometry resize_row 0 177 | geometry weight_column {1 1} 178 | geometry weight_row 0 179 | data GROUP Tk 180 | data ID _label_3 181 | data MASTER {} 182 | data TYPE {Tk label} 183 | } 184 | widget {Tk entry} _entry_1 { 185 | configure -justify center 186 | configure -textvariable diffusion_coefficient::arg(selection) 187 | configure -width 30 188 | geometry -column 2 189 | geometry -columnspan 1 190 | geometry -row 3 191 | geometry -rowspan 1 192 | geometry -sticky ew 193 | geometry min_column {2 40} 194 | geometry min_row 2 195 | geometry pad_column {0 0} 196 | geometry pad_row 0 197 | geometry resize_column {3 3} 198 | geometry resize_row 0 199 | geometry weight_column {1 1} 200 | geometry weight_row 0 201 | data GROUP Tk 202 | data ID _entry_1 203 | data MASTER {} 204 | data TYPE {Tk entry} 205 | } 206 | widget {Tk label} _label_4 { 207 | configure -font {helvetica 10} 208 | configure -text {Real time between frames (ns)} 209 | geometry -column 1 210 | geometry -columnspan 1 211 | geometry -row 7 212 | geometry -rowspan 1 213 | geometry -sticky e 214 | geometry min_column {2 40} 215 | geometry min_row 2 216 | geometry pad_column {0 0} 217 | geometry pad_row 0 218 | geometry resize_column {3 3} 219 | geometry resize_row 0 220 | geometry weight_column {1 1} 221 | geometry weight_row 0 222 | data GROUP Tk 223 | data ID _label_4 224 | data MASTER {} 225 | data TYPE {Tk label} 226 | } 227 | widget {Tk entry} _entry_2 { 228 | configure -justify center 229 | configure -textvariable diffusion_coefficient::arg(dt) 230 | configure -width 12 231 | geometry -column 2 232 | geometry -columnspan 1 233 | geometry -row 7 234 | geometry -rowspan 1 235 | geometry -sticky w 236 | geometry min_column {2 40} 237 | geometry min_row 2 238 | geometry pad_column {0 0} 239 | geometry pad_row 0 240 | geometry resize_column {3 3} 241 | geometry resize_row 0 242 | geometry weight_column {1 1} 243 | geometry weight_row 0 244 | data GROUP Tk 245 | data ID _entry_2 246 | data MASTER {} 247 | data TYPE {Tk entry} 248 | } 249 | widget {Tk label} _label_5 { 250 | configure -font {helvetica 10} 251 | configure -text {Diffusion along} 252 | geometry -column 1 253 | geometry -columnspan 1 254 | geometry -row 4 255 | geometry -rowspan 1 256 | geometry -sticky e 257 | geometry min_column {2 40} 258 | geometry min_row 2 259 | geometry pad_column {0 0} 260 | geometry pad_row 0 261 | geometry resize_column {3 3} 262 | geometry resize_row 0 263 | geometry weight_column {1 1} 264 | geometry weight_row 0 265 | data GROUP Tk 266 | data ID _label_5 267 | data MASTER {} 268 | data TYPE {Tk label} 269 | } 270 | widget {Tk checkbutton} _checkbutton_1 { 271 | configure -font {helvetica 10} 272 | configure -text { x} 273 | configure -variable diffusion_coefficient::arg(alongx) 274 | geometry -column 1 275 | geometry -columnspan 1 276 | geometry -row 1 277 | geometry -rowspan 1 278 | geometry -sticky {} 279 | geometry min_column {2 40} 280 | geometry min_row 2 281 | geometry pad_column {0 0} 282 | geometry pad_row 0 283 | geometry resize_column {3 3} 284 | geometry resize_row 0 285 | geometry weight_column {1 1} 286 | geometry weight_row 0 287 | data GROUP Tk 288 | data ID _checkbutton_1 289 | data MASTER _frame_1 290 | data TYPE {Tk checkbutton} 291 | } 292 | widget {Tk checkbutton} _checkbutton_2 { 293 | configure -font {helvetica 10} 294 | configure -text { y} 295 | configure -variable diffusion_coefficient::arg(alongy) 296 | geometry -column 2 297 | geometry -columnspan 1 298 | geometry -row 1 299 | geometry -rowspan 1 300 | geometry -sticky {} 301 | geometry min_column {2 40} 302 | geometry min_row 2 303 | geometry pad_column {0 0} 304 | geometry pad_row 0 305 | geometry resize_column {3 3} 306 | geometry resize_row 0 307 | geometry weight_column {1 1} 308 | geometry weight_row 0 309 | data GROUP Tk 310 | data ID _checkbutton_2 311 | data MASTER _frame_1 312 | data TYPE {Tk checkbutton} 313 | } 314 | widget {Tk checkbutton} _checkbutton_3 { 315 | configure -font {helvetica 10} 316 | configure -takefocus 1 317 | configure -text { z} 318 | configure -variable diffusion_coefficient::arg(alongz) 319 | geometry -column 3 320 | geometry -columnspan 1 321 | geometry -row 1 322 | geometry -rowspan 1 323 | geometry -sticky {} 324 | geometry min_column {2 40} 325 | geometry min_row 2 326 | geometry pad_column {0 0} 327 | geometry pad_row 0 328 | geometry resize_column {3 3} 329 | geometry resize_row 0 330 | geometry weight_column {1 1} 331 | geometry weight_row 0 332 | data GROUP Tk 333 | data ID _checkbutton_3 334 | data MASTER _frame_1 335 | data TYPE {Tk checkbutton} 336 | } 337 | widget {Tk button} _button_3 { 338 | configure -font {helvetica 10 bold} 339 | configure -text {MSD displacement} 340 | geometry -column 1 341 | geometry -columnspan 1 342 | geometry -row 1 343 | geometry -rowspan 1 344 | geometry -sticky nsew 345 | geometry min_column {2 40} 346 | geometry min_row 2 347 | geometry pad_column {0 0} 348 | geometry pad_row 0 349 | geometry resize_column {3 3} 350 | geometry resize_row 0 351 | geometry weight_column {1 1} 352 | geometry weight_row 0 353 | data GROUP Tk 354 | data ID plot_msd_button 355 | data MASTER _frame_5 356 | data TYPE {Tk button} 357 | } 358 | widget {Tk button} _button_4 { 359 | configure -font {helvetica 10 bold} 360 | configure -text {Diffusion coefficient} 361 | geometry -column 2 362 | geometry -columnspan 1 363 | geometry -row 1 364 | geometry -rowspan 1 365 | geometry -sticky nsew 366 | geometry min_column {2 40} 367 | geometry min_row 2 368 | geometry pad_column {0 0} 369 | geometry pad_row 0 370 | geometry resize_column {3 3} 371 | geometry resize_row 0 372 | geometry weight_column {1 1} 373 | geometry weight_row 0 374 | data GROUP Tk 375 | data ID plot_d_button 376 | data MASTER _frame_5 377 | data TYPE {Tk button} 378 | } 379 | widget {Tk label} _label_6 { 380 | configure -font {helvetica 10} 381 | configure -text {Compute MSD at lag times \u03C4 from} 382 | geometry -column 1 383 | geometry -columnspan 1 384 | geometry -row 5 385 | geometry -rowspan 1 386 | geometry -sticky e 387 | geometry min_column {2 40} 388 | geometry min_row 2 389 | geometry pad_column {0 0} 390 | geometry pad_row 0 391 | geometry resize_column {3 3} 392 | geometry resize_row 0 393 | geometry weight_column {1 1} 394 | geometry weight_row 0 395 | data GROUP Tk 396 | data ID _label_6 397 | data MASTER {} 398 | data TYPE {Tk label} 399 | } 400 | widget {Tk entry} _entry_3 { 401 | configure -justify center 402 | configure -textvariable diffusion_coefficient::arg(from) 403 | configure -width 6 404 | geometry -column 1 405 | geometry -columnspan 1 406 | geometry -row 1 407 | geometry -rowspan 1 408 | geometry -sticky ew 409 | geometry min_column {2 40} 410 | geometry min_row 2 411 | geometry pad_column {0 0} 412 | geometry pad_row 0 413 | geometry resize_column {3 3} 414 | geometry resize_row 0 415 | geometry weight_column {1 1} 416 | geometry weight_row 0 417 | data GROUP Tk 418 | data ID _entry_3 419 | data MASTER _frame_3 420 | data TYPE {Tk entry} 421 | } 422 | widget {Tk label} _label_8 { 423 | configure -font {helvetica 10} 424 | configure -text to 425 | geometry -column 2 426 | geometry -columnspan 1 427 | geometry -row 1 428 | geometry -rowspan 1 429 | geometry -sticky {} 430 | geometry min_column {2 40} 431 | geometry min_row 2 432 | geometry pad_column {0 0} 433 | geometry pad_row 0 434 | geometry resize_column {3 3} 435 | geometry resize_row 0 436 | geometry weight_column {1 1} 437 | geometry weight_row 0 438 | data GROUP Tk 439 | data ID _label_8 440 | data MASTER _frame_3 441 | data TYPE {Tk label} 442 | } 443 | widget {Tk entry} _entry_4 { 444 | configure -justify center 445 | configure -textvariable diffusion_coefficient::arg(to) 446 | configure -width 6 447 | geometry -column 3 448 | geometry -columnspan 1 449 | geometry -row 1 450 | geometry -rowspan 1 451 | geometry -sticky ew 452 | geometry min_column {2 40} 453 | geometry min_row 2 454 | geometry pad_column {0 0} 455 | geometry pad_row 0 456 | geometry resize_column {3 3} 457 | geometry resize_row 0 458 | geometry weight_column {1 1} 459 | geometry weight_row 0 460 | data GROUP Tk 461 | data ID _entry_4 462 | data MASTER _frame_3 463 | data TYPE {Tk entry} 464 | } 465 | widget {Tk entry} _entry_5 { 466 | configure -justify center 467 | configure -textvariable diffusion_coefficient::arg(step) 468 | configure -width 6 469 | geometry -column 5 470 | geometry -columnspan 1 471 | geometry -row 1 472 | geometry -rowspan 1 473 | geometry -sticky ew 474 | geometry min_column {2 40} 475 | geometry min_row 2 476 | geometry pad_column {0 0} 477 | geometry pad_row 0 478 | geometry resize_column {3 3} 479 | geometry resize_row 0 480 | geometry weight_column {1 1} 481 | geometry weight_row 0 482 | data GROUP Tk 483 | data ID _entry_5 484 | data MASTER _frame_3 485 | data TYPE {Tk entry} 486 | } 487 | widget {Tk label} _label_9 { 488 | configure -font {helvetica 10} 489 | configure -text step 490 | geometry -column 4 491 | geometry -columnspan 1 492 | geometry -row 1 493 | geometry -rowspan 1 494 | geometry -sticky {} 495 | geometry min_column {2 40} 496 | geometry min_row 2 497 | geometry pad_column {0 0} 498 | geometry pad_row 0 499 | geometry resize_column {3 3} 500 | geometry resize_row 0 501 | geometry weight_column {1 1} 502 | geometry weight_row 0 503 | data GROUP Tk 504 | data ID _label_9 505 | data MASTER _frame_3 506 | data TYPE {Tk label} 507 | } 508 | widget {Tk label} _label_10 { 509 | configure -font {helvetica 10} 510 | configure -text {frames } 511 | geometry -column 6 512 | geometry -columnspan 1 513 | geometry -row 1 514 | geometry -rowspan 1 515 | geometry -sticky w 516 | geometry min_column {2 40} 517 | geometry min_row 2 518 | geometry pad_column {0 0} 519 | geometry pad_row 0 520 | geometry resize_column {3 3} 521 | geometry resize_row 0 522 | geometry weight_column {1 1} 523 | geometry weight_row 0 524 | data GROUP Tk 525 | data ID _label_10 526 | data MASTER _frame_3 527 | data TYPE {Tk label} 528 | } 529 | widget {Tk label} _label_11 { 530 | configure -font {helvetica 10} 531 | configure -text {Analysis interval from} 532 | geometry -column 1 533 | geometry -columnspan 1 534 | geometry -row 6 535 | geometry -rowspan 1 536 | geometry -sticky e 537 | geometry min_column {2 40} 538 | geometry min_row 2 539 | geometry pad_column {0 0} 540 | geometry pad_row 0 541 | geometry resize_column {3 3} 542 | geometry resize_row 0 543 | geometry weight_column {1 1} 544 | geometry weight_row 0 545 | data GROUP Tk 546 | data ID _label_11 547 | data MASTER {} 548 | data TYPE {Tk label} 549 | } 550 | widget {Tk label} _label_12 { 551 | configure -font {helvetica 10} 552 | configure -text {frames } 553 | geometry -column 6 554 | geometry -columnspan 1 555 | geometry -row 1 556 | geometry -rowspan 1 557 | geometry -sticky w 558 | geometry min_column {2 40} 559 | geometry min_row 2 560 | geometry pad_column {0 0} 561 | geometry pad_row 0 562 | geometry resize_column {3 3} 563 | geometry resize_row 0 564 | geometry weight_column {1 1} 565 | geometry weight_row 0 566 | data GROUP Tk 567 | data ID _label_12 568 | data MASTER _frame_4 569 | data TYPE {Tk label} 570 | } 571 | widget {Tk entry} _entry_6 { 572 | configure -justify center 573 | configure -textvariable diffusion_coefficient::arg(interval_from) 574 | configure -width 6 575 | geometry -column 1 576 | geometry -columnspan 1 577 | geometry -row 1 578 | geometry -rowspan 1 579 | geometry -sticky ew 580 | geometry min_column {2 40} 581 | geometry min_row 2 582 | geometry pad_column {0 0} 583 | geometry pad_row 0 584 | geometry resize_column {3 3} 585 | geometry resize_row 0 586 | geometry weight_column {1 1} 587 | geometry weight_row 0 588 | data GROUP Tk 589 | data ID _entry_6 590 | data MASTER _frame_4 591 | data TYPE {Tk entry} 592 | } 593 | widget {Tk label} _label_13 { 594 | configure -font {helvetica 10} 595 | configure -text Ready 596 | configure -textvariable diffusion_coefficient::status_text 597 | geometry -column 2 598 | geometry -columnspan 1 599 | geometry -row 11 600 | geometry -rowspan 1 601 | geometry -sticky {} 602 | geometry min_column {2 40} 603 | geometry min_row 2 604 | geometry pad_column {0 0} 605 | geometry pad_row 0 606 | geometry resize_column {3 3} 607 | geometry resize_row 0 608 | geometry weight_column {1 1} 609 | geometry weight_row 0 610 | data GROUP Tk 611 | data ID _label_13 612 | data MASTER {} 613 | data TYPE {Tk label} 614 | } 615 | widget {Tk label} _label_14 { 616 | configure -font {helvetica 10} 617 | configure -text to 618 | geometry -column 2 619 | geometry -columnspan 1 620 | geometry -row 1 621 | geometry -rowspan 1 622 | geometry -sticky {} 623 | geometry min_column {2 40} 624 | geometry min_row 2 625 | geometry pad_column {0 0} 626 | geometry pad_row 0 627 | geometry resize_column {3 3} 628 | geometry resize_row 0 629 | geometry weight_column {1 1} 630 | geometry weight_row 0 631 | data GROUP Tk 632 | data ID _label_14 633 | data MASTER _frame_4 634 | data TYPE {Tk label} 635 | } 636 | widget {Tk entry} _entry_7 { 637 | configure -justify center 638 | configure -textvariable diffusion_coefficient::arg(interval_to) 639 | configure -width 6 640 | geometry -column 3 641 | geometry -columnspan 1 642 | geometry -row 1 643 | geometry -rowspan 1 644 | geometry -sticky ew 645 | geometry min_column {2 40} 646 | geometry min_row 2 647 | geometry pad_column {0 0} 648 | geometry pad_row 0 649 | geometry resize_column {3 3} 650 | geometry resize_row 0 651 | geometry weight_column {1 1} 652 | geometry weight_row 0 653 | data GROUP Tk 654 | data ID _entry_7 655 | data MASTER _frame_4 656 | data TYPE {Tk entry} 657 | } 658 | widget {Tk label} _label_15 { 659 | configure -font {helvetica 10} 660 | configure -text step 661 | geometry -column 4 662 | geometry -columnspan 1 663 | geometry -row 1 664 | geometry -rowspan 1 665 | geometry -sticky {} 666 | geometry min_column {2 40} 667 | geometry min_row 2 668 | geometry pad_column {0 0} 669 | geometry pad_row 0 670 | geometry resize_column {3 3} 671 | geometry resize_row 0 672 | geometry weight_column {1 1} 673 | geometry weight_row 0 674 | data GROUP Tk 675 | data ID _label_15 676 | data MASTER _frame_4 677 | data TYPE {Tk label} 678 | } 679 | widget {Tk entry} _entry_8 { 680 | configure -justify center 681 | configure -textvariable diffusion_coefficient::arg(interval_stride) 682 | configure -width 6 683 | geometry -column 5 684 | geometry -columnspan 1 685 | geometry -row 1 686 | geometry -rowspan 1 687 | geometry -sticky ew 688 | geometry min_column {2 40} 689 | geometry min_row 2 690 | geometry pad_column {0 0} 691 | geometry pad_row 0 692 | geometry resize_column {3 3} 693 | geometry resize_row 0 694 | geometry weight_column {1 1} 695 | geometry weight_row 0 696 | data GROUP Tk 697 | data ID _entry_8 698 | data MASTER _frame_4 699 | data TYPE {Tk entry} 700 | } 701 | widget {Tk checkbutton} _checkbutton_4 { 702 | configure -font {helvetica 10} 703 | configure -text { Subtract center of mass drift} 704 | configure -variable diffusion_coefficient::arg(remove_drift) 705 | geometry -column 4 706 | geometry -columnspan 1 707 | geometry -row 1 708 | geometry -rowspan 1 709 | geometry -sticky {} 710 | geometry min_column {2 40} 711 | geometry min_row 2 712 | geometry pad_column {0 0} 713 | geometry pad_row 0 714 | geometry resize_column {3 3} 715 | geometry resize_row 0 716 | geometry weight_column {1 1} 717 | geometry weight_row 0 718 | data GROUP Tk 719 | data ID _checkbutton_4 720 | data MASTER _frame_1 721 | data TYPE {Tk checkbutton} 722 | } 723 | widget {Tk button} _button_1 { 724 | configure -font {helvetica 10} 725 | configure -text Defaults 726 | geometry -column 7 727 | geometry -columnspan 1 728 | geometry -row 1 729 | geometry -rowspan 1 730 | geometry -sticky {} 731 | geometry min_column {2 40} 732 | geometry min_row 2 733 | geometry pad_column {0 0} 734 | geometry pad_row 0 735 | geometry resize_column {3 3} 736 | geometry resize_row 0 737 | geometry weight_column {1 1} 738 | geometry weight_row 0 739 | data GROUP Tk 740 | data ID reset_lags_button 741 | data MASTER _frame_3 742 | data TYPE {Tk button} 743 | } 744 | widget {Tk button} _button_2 { 745 | configure -font {helvetica 10} 746 | configure -text Defaults 747 | geometry -column 7 748 | geometry -columnspan 1 749 | geometry -row 1 750 | geometry -rowspan 1 751 | geometry -sticky {} 752 | geometry min_column {2 40} 753 | geometry min_row 2 754 | geometry pad_column {0 0} 755 | geometry pad_row 0 756 | geometry resize_column {3 3} 757 | geometry resize_row 0 758 | geometry weight_column {1 1} 759 | geometry weight_row 0 760 | data GROUP Tk 761 | data ID reset_interval_button 762 | data MASTER _frame_4 763 | data TYPE {Tk button} 764 | } 765 | widget {Tk label} _label_7 { 766 | configure -font {helvetica 10} 767 | configure -justify right 768 | configure -text Plot... 769 | geometry -column 1 770 | geometry -columnspan 1 771 | geometry -row 9 772 | geometry -rowspan 1 773 | geometry -sticky e 774 | geometry min_column {2 40} 775 | geometry min_row 2 776 | geometry pad_column {0 0} 777 | geometry pad_row 0 778 | geometry resize_column {3 3} 779 | geometry resize_row 0 780 | geometry weight_column {1 1} 781 | geometry weight_row 0 782 | data GROUP Tk 783 | data ID _label_7 784 | data MASTER {} 785 | data TYPE {Tk label} 786 | } 787 | widget {Tk button} _button_5 { 788 | configure -bitmap questhead 789 | configure -borderwidth 1 790 | configure -font {helvetica 10 bold} 791 | configure -text ? 792 | geometry -column 1 793 | geometry -columnspan 1 794 | geometry -row 1 795 | geometry -rowspan 1 796 | geometry -sticky nsew 797 | geometry min_column {2 40} 798 | geometry min_row 2 799 | geometry pad_column {0 0} 800 | geometry pad_row 0 801 | geometry resize_column {3 3} 802 | geometry resize_row 0 803 | geometry weight_column {1 1} 804 | geometry weight_row 0 805 | data GROUP Tk 806 | data ID button_help 807 | data MASTER _frame_6 808 | data TYPE {Tk button} 809 | } 810 | widget {Tk label} _label_16 { 811 | configure -font {Helvetica 13} 812 | configure -text Documentation 813 | geometry -column 2 814 | geometry -columnspan 1 815 | geometry -row 1 816 | geometry -rowspan 1 817 | geometry -sticky w 818 | geometry min_column {2 40} 819 | geometry min_row 2 820 | geometry pad_column {0 0} 821 | geometry pad_row 0 822 | geometry resize_column {3 3} 823 | geometry resize_row 0 824 | geometry weight_column {1 1} 825 | geometry weight_row 0 826 | data GROUP Tk 827 | data ID _label_16 828 | data MASTER _frame_6 829 | data TYPE {Tk label} 830 | } 831 | widget {Tk button} _button_6 { 832 | configure -bitmap error 833 | configure -foreground #ff0000 834 | configure -state disabled 835 | configure -text _button_6 836 | geometry -column 4 837 | geometry -columnspan 1 838 | geometry -row 1 839 | geometry -rowspan 1 840 | geometry -sticky {} 841 | geometry min_column {2 40} 842 | geometry min_row 2 843 | geometry pad_column {0 0} 844 | geometry pad_row 0 845 | geometry resize_column {3 3} 846 | geometry resize_row 0 847 | geometry weight_column {1 1} 848 | geometry weight_row 0 849 | data GROUP Tk 850 | data ID abort_button 851 | data MASTER _frame_5 852 | data TYPE {Tk button} 853 | } 854 | widget {Tk button} _button_7 { 855 | configure -bitmap gray50 856 | configure -text _button_7 857 | geometry -column 3 858 | geometry -columnspan 1 859 | geometry -row 1 860 | geometry -rowspan 1 861 | geometry -sticky {} 862 | geometry min_column {2 40} 863 | geometry min_row 2 864 | geometry pad_column {0 0} 865 | geometry pad_row 0 866 | geometry resize_column {3 3} 867 | geometry resize_row 0 868 | geometry weight_column {1 1} 869 | geometry weight_row 0 870 | data GROUP Tk 871 | data ID save_button 872 | data MASTER _frame_5 873 | data TYPE {Tk button} 874 | } 875 | menu {Menu menu} MENU { 876 | data MASTER {} 877 | data level 0 878 | } 879 | menu {Menu cascade} menuitem1 { 880 | configure -label Help 881 | data MASTER MENU 882 | } 883 | menu {Menu command} menuitem2 { 884 | configure -command diffusion_coefficient_gui::help_docs 885 | configure -compound right 886 | configure -label Documentation... 887 | data MASTER menuitem1 888 | } 889 | menu {Menu command} menuitem3 { 890 | configure -command diffusion_coefficient_gui::help_about 891 | configure -label About 892 | data MASTER menuitem1 893 | } 894 | 895 | -------------------------------------------------------------------------------- /diffusion_coefficient_gui_ui.tcl: -------------------------------------------------------------------------------- 1 | # diffusion_coefficient_gui_ui.tcl -- 2 | # 3 | # UI generated by GUI Builder Build 146 on 2019-09-18 20:38:53 from: 4 | # /Users/toni/compile/vmd_diffusion_coefficient/diffusion_coefficient_gui.ui 5 | # THIS IS AN AUTOGENERATED FILE AND SHOULD NOT BE EDITED. 6 | # The associated callback file should be modified instead. 7 | # 8 | 9 | # Declare the namespace for this dialog 10 | namespace eval diffusion_coefficient_gui {} 11 | 12 | package require Tk 13 | # diffusion_coefficient_gui::ui -- 14 | # 15 | # Create the UI for this dialog. 16 | # 17 | # ARGS: 18 | # root the parent window for this form 19 | # args a catch-all for other args, but none are expected 20 | # 21 | proc diffusion_coefficient_gui::ui {root args} { 22 | # this handles '.' as a special case 23 | set base [expr {($root == ".") ? "" : $root}] 24 | variable ROOT $root 25 | variable BASE $base 26 | variable SCRIPTDIR ; # defined in main script 27 | 28 | 29 | # Widget Initialization 30 | variable _frame_1 [frame $BASE._frame_1] 31 | variable _frame_3 [frame $BASE._frame_3] 32 | variable _frame_4 [frame $BASE._frame_4] 33 | variable _frame_6 [frame $BASE._frame_6] 34 | variable _frame_5 [frame $BASE._frame_5] 35 | variable _label_1 [label $BASE._label_1 \ 36 | -font {Helvetica 13 bold} \ 37 | -pady 6 \ 38 | -text "VMD Diffusion Coefficient Tool"] 39 | variable _label_2 [label $BASE._label_2 \ 40 | -font {helvetica 10} \ 41 | -text "Compute one, two or three-dimensional mean squared displacements (MSD) of a molecular species, and associated diffusion coefficients" \ 42 | -wraplength 450] 43 | variable _label_3 [label $BASE._label_3 \ 44 | -font {helvetica 10} \ 45 | -text "Selection (one atom per molecule)"] 46 | variable _entry_1 [entry $BASE._entry_1 \ 47 | -invalidcommand [namespace code [list _entry_1_invalidcommand]] \ 48 | -justify "center" \ 49 | -textvariable "diffusion_coefficient::arg(selection)" \ 50 | -validatecommand [namespace code [list _entry_1_validatecommand]] \ 51 | -width 30 \ 52 | -xscrollcommand [namespace code [list _entry_1_xscrollcommand]]] 53 | variable _label_4 [label $BASE._label_4 \ 54 | -font {helvetica 10} \ 55 | -text "Real time between frames (ns)"] 56 | variable _entry_2 [entry $BASE._entry_2 \ 57 | -invalidcommand [namespace code [list _entry_2_invalidcommand]] \ 58 | -justify "center" \ 59 | -textvariable "diffusion_coefficient::arg(dt)" \ 60 | -validatecommand [namespace code [list _entry_2_validatecommand]] \ 61 | -width 12 \ 62 | -xscrollcommand [namespace code [list _entry_2_xscrollcommand]]] 63 | variable _label_5 [label $BASE._label_5 \ 64 | -font {helvetica 10} \ 65 | -text "Diffusion along"] 66 | variable _checkbutton_1 [checkbutton $BASE._checkbutton_1 \ 67 | -command [namespace code [list _checkbutton_1_command]] \ 68 | -font {helvetica 10} \ 69 | -text " x" \ 70 | -variable "diffusion_coefficient::arg(alongx)"] 71 | variable _checkbutton_2 [checkbutton $BASE._checkbutton_2 \ 72 | -command [namespace code [list _checkbutton_2_command]] \ 73 | -font {helvetica 10} \ 74 | -text " y" \ 75 | -variable "diffusion_coefficient::arg(alongy)"] 76 | variable _checkbutton_3 [checkbutton $BASE._checkbutton_3 \ 77 | -command [namespace code [list _checkbutton_3_command]] \ 78 | -font {helvetica 10} \ 79 | -takefocus 1 \ 80 | -text " z" \ 81 | -variable "diffusion_coefficient::arg(alongz)"] 82 | variable plot_msd_button [button $BASE.plot_msd_button \ 83 | -command [namespace code [list plot_msd_button_command]] \ 84 | -font {helvetica 10 bold} \ 85 | -text "MSD displacement"] 86 | variable plot_d_button [button $BASE.plot_d_button \ 87 | -command [namespace code [list plot_d_button_command]] \ 88 | -font {helvetica 10 bold} \ 89 | -text "Diffusion coefficient"] 90 | variable _label_6 [label $BASE._label_6 \ 91 | -font {helvetica 10} \ 92 | -text "Compute MSD at lag times \u03C4 from"] 93 | variable _entry_3 [entry $BASE._entry_3 \ 94 | -invalidcommand [namespace code [list _entry_3_invalidcommand]] \ 95 | -justify "center" \ 96 | -textvariable "diffusion_coefficient::arg(from)" \ 97 | -validatecommand [namespace code [list _entry_3_validatecommand]] \ 98 | -width 6 \ 99 | -xscrollcommand [namespace code [list _entry_3_xscrollcommand]]] 100 | variable _label_8 [label $BASE._label_8 \ 101 | -font {helvetica 10} \ 102 | -text "to"] 103 | variable _entry_4 [entry $BASE._entry_4 \ 104 | -invalidcommand [namespace code [list _entry_4_invalidcommand]] \ 105 | -justify "center" \ 106 | -textvariable "diffusion_coefficient::arg(to)" \ 107 | -validatecommand [namespace code [list _entry_4_validatecommand]] \ 108 | -width 6 \ 109 | -xscrollcommand [namespace code [list _entry_4_xscrollcommand]]] 110 | variable _entry_5 [entry $BASE._entry_5 \ 111 | -invalidcommand [namespace code [list _entry_5_invalidcommand]] \ 112 | -justify "center" \ 113 | -textvariable "diffusion_coefficient::arg(step)" \ 114 | -validatecommand [namespace code [list _entry_5_validatecommand]] \ 115 | -width 6 \ 116 | -xscrollcommand [namespace code [list _entry_5_xscrollcommand]]] 117 | variable _label_9 [label $BASE._label_9 \ 118 | -font {helvetica 10} \ 119 | -text "step"] 120 | variable _label_10 [label $BASE._label_10 \ 121 | -font {helvetica 10} \ 122 | -text "frames "] 123 | variable _label_11 [label $BASE._label_11 \ 124 | -font {helvetica 10} \ 125 | -text "Analysis interval from"] 126 | variable _label_12 [label $BASE._label_12 \ 127 | -font {helvetica 10} \ 128 | -text "frames "] 129 | variable _entry_6 [entry $BASE._entry_6 \ 130 | -invalidcommand [namespace code [list _entry_6_invalidcommand]] \ 131 | -justify "center" \ 132 | -textvariable "diffusion_coefficient::arg(interval_from)" \ 133 | -validatecommand [namespace code [list _entry_6_validatecommand]] \ 134 | -width 6 \ 135 | -xscrollcommand [namespace code [list _entry_6_xscrollcommand]]] 136 | variable _label_13 [label $BASE._label_13 \ 137 | -font {helvetica 10} \ 138 | -text "Ready" \ 139 | -textvariable "diffusion_coefficient::status_text"] 140 | variable _label_14 [label $BASE._label_14 \ 141 | -font {helvetica 10} \ 142 | -text "to"] 143 | variable _entry_7 [entry $BASE._entry_7 \ 144 | -invalidcommand [namespace code [list _entry_7_invalidcommand]] \ 145 | -justify "center" \ 146 | -textvariable "diffusion_coefficient::arg(interval_to)" \ 147 | -validatecommand [namespace code [list _entry_7_validatecommand]] \ 148 | -width 6 \ 149 | -xscrollcommand [namespace code [list _entry_7_xscrollcommand]]] 150 | variable _label_15 [label $BASE._label_15 \ 151 | -font {helvetica 10} \ 152 | -text "step"] 153 | variable _entry_8 [entry $BASE._entry_8 \ 154 | -invalidcommand [namespace code [list _entry_8_invalidcommand]] \ 155 | -justify "center" \ 156 | -textvariable "diffusion_coefficient::arg(interval_stride)" \ 157 | -validatecommand [namespace code [list _entry_8_validatecommand]] \ 158 | -width 6 \ 159 | -xscrollcommand [namespace code [list _entry_8_xscrollcommand]]] 160 | variable _checkbutton_4 [checkbutton $BASE._checkbutton_4 \ 161 | -command [namespace code [list _checkbutton_4_command]] \ 162 | -font {helvetica 10} \ 163 | -text " Subtract center of mass drift" \ 164 | -variable "diffusion_coefficient::arg(remove_drift)"] 165 | variable reset_lags_button [button $BASE.reset_lags_button \ 166 | -command [namespace code [list reset_lags_button_command]] \ 167 | -font {helvetica 10} \ 168 | -text "Defaults"] 169 | variable reset_interval_button [button $BASE.reset_interval_button \ 170 | -command [namespace code [list reset_interval_button_command]] \ 171 | -font {helvetica 10} \ 172 | -text "Defaults"] 173 | variable _label_7 [label $BASE._label_7 \ 174 | -font {helvetica 10} \ 175 | -justify "right" \ 176 | -text "Plot..."] 177 | variable button_help [button $BASE.button_help \ 178 | -bitmap "questhead" \ 179 | -borderwidth 1 \ 180 | -command [namespace code [list button_help_command]] \ 181 | -font {helvetica 10 bold} \ 182 | -text "?"] 183 | variable _label_16 [label $BASE._label_16 \ 184 | -font {Helvetica 13} \ 185 | -text "Documentation"] 186 | variable abort_button [button $BASE.abort_button \ 187 | -bitmap "error" \ 188 | -command [namespace code [list abort_button_command]] \ 189 | -foreground "#ff0000" \ 190 | -state "disabled" \ 191 | -text "_button_6"] 192 | variable save_button [button $BASE.save_button \ 193 | -bitmap "gray50" \ 194 | -command [namespace code [list save_button_command]] \ 195 | -text "_button_7"] 196 | variable menu [menu $BASE.menu] 197 | variable menuitem1 [menu $BASE.menuitem1 \ 198 | -tearoff 0] 199 | $BASE.menu add cascade \ 200 | -label "Help" \ 201 | -menu $BASE.menuitem1 202 | $BASE.menuitem1 add command \ 203 | -command "diffusion_coefficient_gui::help_docs" \ 204 | -compound "right" \ 205 | -label "Documentation..." 206 | $BASE.menuitem1 add command \ 207 | -command "diffusion_coefficient_gui::help_about" \ 208 | -label "About" 209 | 210 | 211 | # Geometry Management 212 | 213 | grid $BASE._frame_1 -in $root -row 4 -column 2 \ 214 | -columnspan 1 \ 215 | -ipadx 0 \ 216 | -ipady 0 \ 217 | -padx 0 \ 218 | -pady 0 \ 219 | -rowspan 1 \ 220 | -sticky "ew" 221 | grid $BASE._frame_3 -in $root -row 5 -column 2 \ 222 | -columnspan 1 \ 223 | -ipadx 0 \ 224 | -ipady 0 \ 225 | -padx 0 \ 226 | -pady 0 \ 227 | -rowspan 1 \ 228 | -sticky "news" 229 | grid $BASE._frame_4 -in $root -row 6 -column 2 \ 230 | -columnspan 1 \ 231 | -ipadx 0 \ 232 | -ipady 0 \ 233 | -padx 0 \ 234 | -pady 0 \ 235 | -rowspan 1 \ 236 | -sticky "news" 237 | grid $BASE._frame_6 -in $root -row 11 -column 1 \ 238 | -columnspan 1 \ 239 | -ipadx 0 \ 240 | -ipady 0 \ 241 | -padx 0 \ 242 | -pady 0 \ 243 | -rowspan 1 \ 244 | -sticky "ew" 245 | grid $BASE._frame_5 -in $root -row 9 -column 2 \ 246 | -columnspan 1 \ 247 | -ipadx 0 \ 248 | -ipady 0 \ 249 | -padx 0 \ 250 | -pady 0 \ 251 | -rowspan 1 \ 252 | -sticky "news" 253 | grid $BASE._label_1 -in $root -row 1 -column 1 \ 254 | -columnspan 2 \ 255 | -ipadx 0 \ 256 | -ipady 0 \ 257 | -padx 0 \ 258 | -pady 0 \ 259 | -rowspan 1 \ 260 | -sticky "ew" 261 | grid $BASE._label_2 -in $root -row 2 -column 1 \ 262 | -columnspan 2 \ 263 | -ipadx 0 \ 264 | -ipady 0 \ 265 | -padx 0 \ 266 | -pady 0 \ 267 | -rowspan 1 \ 268 | -sticky "" 269 | grid $BASE._label_3 -in $root -row 3 -column 1 \ 270 | -columnspan 1 \ 271 | -ipadx 0 \ 272 | -ipady 0 \ 273 | -padx 0 \ 274 | -pady 0 \ 275 | -rowspan 1 \ 276 | -sticky "e" 277 | grid $BASE._entry_1 -in $root -row 3 -column 2 \ 278 | -columnspan 1 \ 279 | -ipadx 0 \ 280 | -ipady 0 \ 281 | -padx 0 \ 282 | -pady 0 \ 283 | -rowspan 1 \ 284 | -sticky "ew" 285 | grid $BASE._label_4 -in $root -row 7 -column 1 \ 286 | -columnspan 1 \ 287 | -ipadx 0 \ 288 | -ipady 0 \ 289 | -padx 0 \ 290 | -pady 0 \ 291 | -rowspan 1 \ 292 | -sticky "e" 293 | grid $BASE._entry_2 -in $root -row 7 -column 2 \ 294 | -columnspan 1 \ 295 | -ipadx 0 \ 296 | -ipady 0 \ 297 | -padx 0 \ 298 | -pady 0 \ 299 | -rowspan 1 \ 300 | -sticky "w" 301 | grid $BASE._label_5 -in $root -row 4 -column 1 \ 302 | -columnspan 1 \ 303 | -ipadx 0 \ 304 | -ipady 0 \ 305 | -padx 0 \ 306 | -pady 0 \ 307 | -rowspan 1 \ 308 | -sticky "e" 309 | grid $BASE._checkbutton_1 -in $base._frame_1 -row 1 -column 1 \ 310 | -columnspan 1 \ 311 | -ipadx 0 \ 312 | -ipady 0 \ 313 | -padx 0 \ 314 | -pady 0 \ 315 | -rowspan 1 \ 316 | -sticky "" 317 | grid $BASE._checkbutton_2 -in $base._frame_1 -row 1 -column 2 \ 318 | -columnspan 1 \ 319 | -ipadx 0 \ 320 | -ipady 0 \ 321 | -padx 0 \ 322 | -pady 0 \ 323 | -rowspan 1 \ 324 | -sticky "" 325 | grid $BASE._checkbutton_3 -in $base._frame_1 -row 1 -column 3 \ 326 | -columnspan 1 \ 327 | -ipadx 0 \ 328 | -ipady 0 \ 329 | -padx 0 \ 330 | -pady 0 \ 331 | -rowspan 1 \ 332 | -sticky "" 333 | grid $BASE.plot_msd_button -in $base._frame_5 -row 1 -column 1 \ 334 | -columnspan 1 \ 335 | -ipadx 0 \ 336 | -ipady 0 \ 337 | -padx 0 \ 338 | -pady 0 \ 339 | -rowspan 1 \ 340 | -sticky "nsew" 341 | grid $BASE.plot_d_button -in $base._frame_5 -row 1 -column 2 \ 342 | -columnspan 1 \ 343 | -ipadx 0 \ 344 | -ipady 0 \ 345 | -padx 0 \ 346 | -pady 0 \ 347 | -rowspan 1 \ 348 | -sticky "nsew" 349 | grid $BASE._label_6 -in $root -row 5 -column 1 \ 350 | -columnspan 1 \ 351 | -ipadx 0 \ 352 | -ipady 0 \ 353 | -padx 0 \ 354 | -pady 0 \ 355 | -rowspan 1 \ 356 | -sticky "e" 357 | grid $BASE._entry_3 -in $base._frame_3 -row 1 -column 1 \ 358 | -columnspan 1 \ 359 | -ipadx 0 \ 360 | -ipady 0 \ 361 | -padx 0 \ 362 | -pady 0 \ 363 | -rowspan 1 \ 364 | -sticky "ew" 365 | grid $BASE._label_8 -in $base._frame_3 -row 1 -column 2 \ 366 | -columnspan 1 \ 367 | -ipadx 0 \ 368 | -ipady 0 \ 369 | -padx 0 \ 370 | -pady 0 \ 371 | -rowspan 1 \ 372 | -sticky "" 373 | grid $BASE._entry_4 -in $base._frame_3 -row 1 -column 3 \ 374 | -columnspan 1 \ 375 | -ipadx 0 \ 376 | -ipady 0 \ 377 | -padx 0 \ 378 | -pady 0 \ 379 | -rowspan 1 \ 380 | -sticky "ew" 381 | grid $BASE._entry_5 -in $base._frame_3 -row 1 -column 5 \ 382 | -columnspan 1 \ 383 | -ipadx 0 \ 384 | -ipady 0 \ 385 | -padx 0 \ 386 | -pady 0 \ 387 | -rowspan 1 \ 388 | -sticky "ew" 389 | grid $BASE._label_9 -in $base._frame_3 -row 1 -column 4 \ 390 | -columnspan 1 \ 391 | -ipadx 0 \ 392 | -ipady 0 \ 393 | -padx 0 \ 394 | -pady 0 \ 395 | -rowspan 1 \ 396 | -sticky "" 397 | grid $BASE._label_10 -in $base._frame_3 -row 1 -column 6 \ 398 | -columnspan 1 \ 399 | -ipadx 0 \ 400 | -ipady 0 \ 401 | -padx 0 \ 402 | -pady 0 \ 403 | -rowspan 1 \ 404 | -sticky "w" 405 | grid $BASE._label_11 -in $root -row 6 -column 1 \ 406 | -columnspan 1 \ 407 | -ipadx 0 \ 408 | -ipady 0 \ 409 | -padx 0 \ 410 | -pady 0 \ 411 | -rowspan 1 \ 412 | -sticky "e" 413 | grid $BASE._label_12 -in $base._frame_4 -row 1 -column 6 \ 414 | -columnspan 1 \ 415 | -ipadx 0 \ 416 | -ipady 0 \ 417 | -padx 0 \ 418 | -pady 0 \ 419 | -rowspan 1 \ 420 | -sticky "w" 421 | grid $BASE._entry_6 -in $base._frame_4 -row 1 -column 1 \ 422 | -columnspan 1 \ 423 | -ipadx 0 \ 424 | -ipady 0 \ 425 | -padx 0 \ 426 | -pady 0 \ 427 | -rowspan 1 \ 428 | -sticky "ew" 429 | grid $BASE._label_13 -in $root -row 11 -column 2 \ 430 | -columnspan 1 \ 431 | -ipadx 0 \ 432 | -ipady 0 \ 433 | -padx 0 \ 434 | -pady 0 \ 435 | -rowspan 1 \ 436 | -sticky "" 437 | grid $BASE._label_14 -in $base._frame_4 -row 1 -column 2 \ 438 | -columnspan 1 \ 439 | -ipadx 0 \ 440 | -ipady 0 \ 441 | -padx 0 \ 442 | -pady 0 \ 443 | -rowspan 1 \ 444 | -sticky "" 445 | grid $BASE._entry_7 -in $base._frame_4 -row 1 -column 3 \ 446 | -columnspan 1 \ 447 | -ipadx 0 \ 448 | -ipady 0 \ 449 | -padx 0 \ 450 | -pady 0 \ 451 | -rowspan 1 \ 452 | -sticky "ew" 453 | grid $BASE._label_15 -in $base._frame_4 -row 1 -column 4 \ 454 | -columnspan 1 \ 455 | -ipadx 0 \ 456 | -ipady 0 \ 457 | -padx 0 \ 458 | -pady 0 \ 459 | -rowspan 1 \ 460 | -sticky "" 461 | grid $BASE._entry_8 -in $base._frame_4 -row 1 -column 5 \ 462 | -columnspan 1 \ 463 | -ipadx 0 \ 464 | -ipady 0 \ 465 | -padx 0 \ 466 | -pady 0 \ 467 | -rowspan 1 \ 468 | -sticky "ew" 469 | grid $BASE._checkbutton_4 -in $base._frame_1 -row 1 -column 4 \ 470 | -columnspan 1 \ 471 | -ipadx 0 \ 472 | -ipady 0 \ 473 | -padx 0 \ 474 | -pady 0 \ 475 | -rowspan 1 \ 476 | -sticky "" 477 | grid $BASE.reset_lags_button -in $base._frame_3 -row 1 -column 7 \ 478 | -columnspan 1 \ 479 | -ipadx 0 \ 480 | -ipady 0 \ 481 | -padx 0 \ 482 | -pady 0 \ 483 | -rowspan 1 \ 484 | -sticky "" 485 | grid $BASE.reset_interval_button -in $base._frame_4 -row 1 -column 7 \ 486 | -columnspan 1 \ 487 | -ipadx 0 \ 488 | -ipady 0 \ 489 | -padx 0 \ 490 | -pady 0 \ 491 | -rowspan 1 \ 492 | -sticky "" 493 | grid $BASE._label_7 -in $root -row 9 -column 1 \ 494 | -columnspan 1 \ 495 | -ipadx 0 \ 496 | -ipady 0 \ 497 | -padx 0 \ 498 | -pady 0 \ 499 | -rowspan 1 \ 500 | -sticky "e" 501 | grid $BASE.button_help -in $base._frame_6 -row 1 -column 1 \ 502 | -columnspan 1 \ 503 | -ipadx 0 \ 504 | -ipady 0 \ 505 | -padx 0 \ 506 | -pady 0 \ 507 | -rowspan 1 \ 508 | -sticky "nsew" 509 | grid $BASE._label_16 -in $base._frame_6 -row 1 -column 2 \ 510 | -columnspan 1 \ 511 | -ipadx 0 \ 512 | -ipady 0 \ 513 | -padx 0 \ 514 | -pady 0 \ 515 | -rowspan 1 \ 516 | -sticky "w" 517 | grid $BASE.abort_button -in $base._frame_5 -row 1 -column 4 \ 518 | -columnspan 1 \ 519 | -ipadx 0 \ 520 | -ipady 0 \ 521 | -padx 0 \ 522 | -pady 0 \ 523 | -rowspan 1 \ 524 | -sticky "" 525 | grid $BASE.save_button -in $base._frame_5 -row 1 -column 3 \ 526 | -columnspan 1 \ 527 | -ipadx 0 \ 528 | -ipady 0 \ 529 | -padx 0 \ 530 | -pady 0 \ 531 | -rowspan 1 \ 532 | -sticky "" 533 | 534 | # Resize Behavior 535 | grid rowconfigure $root 1 -weight 0 -minsize 16 -pad 0 536 | grid rowconfigure $root 2 -weight 1 -minsize 24 -pad 0 537 | grid rowconfigure $root 3 -weight 0 -minsize 42 -pad 0 538 | grid rowconfigure $root 4 -weight 0 -minsize 12 -pad 0 539 | grid rowconfigure $root 5 -weight 0 -minsize 4 -pad 0 540 | grid rowconfigure $root 6 -weight 0 -minsize 2 -pad 0 541 | grid rowconfigure $root 7 -weight 0 -minsize 21 -pad 0 542 | grid rowconfigure $root 8 -weight 1 -minsize 15 -pad 0 543 | grid rowconfigure $root 9 -weight 0 -minsize 2 -pad 0 544 | grid rowconfigure $root 10 -weight 1 -minsize 13 -pad 0 545 | grid rowconfigure $root 11 -weight 1 -minsize 18 -pad 0 546 | grid columnconfigure $root 1 -weight 0 -minsize 40 -pad 0 547 | grid columnconfigure $root 2 -weight 1 -minsize 40 -pad 0 548 | grid rowconfigure $base._frame_1 1 -weight 0 -minsize 4 -pad 0 549 | grid columnconfigure $base._frame_1 1 -weight 0 -minsize 40 -pad 0 550 | grid columnconfigure $base._frame_1 2 -weight 0 -minsize 40 -pad 0 551 | grid columnconfigure $base._frame_1 3 -weight 0 -minsize 40 -pad 0 552 | grid columnconfigure $base._frame_1 4 -weight 1 -minsize 40 -pad 0 553 | grid rowconfigure $base._frame_3 1 -weight 0 -minsize 3 -pad 0 554 | grid columnconfigure $base._frame_3 1 -weight 0 -minsize 40 -pad 0 555 | grid columnconfigure $base._frame_3 2 -weight 0 -minsize 40 -pad 0 556 | grid columnconfigure $base._frame_3 3 -weight 0 -minsize 40 -pad 0 557 | grid columnconfigure $base._frame_3 4 -weight 0 -minsize 40 -pad 0 558 | grid columnconfigure $base._frame_3 5 -weight 0 -minsize 40 -pad 0 559 | grid columnconfigure $base._frame_3 6 -weight 1 -minsize 40 -pad 0 560 | grid columnconfigure $base._frame_3 7 -weight 0 -minsize 40 -pad 0 561 | grid rowconfigure $base._frame_4 1 -weight 0 -minsize 2 -pad 0 562 | grid columnconfigure $base._frame_4 1 -weight 0 -minsize 40 -pad 0 563 | grid columnconfigure $base._frame_4 2 -weight 0 -minsize 40 -pad 0 564 | grid columnconfigure $base._frame_4 3 -weight 0 -minsize 40 -pad 0 565 | grid columnconfigure $base._frame_4 4 -weight 0 -minsize 40 -pad 0 566 | grid columnconfigure $base._frame_4 5 -weight 0 -minsize 40 -pad 0 567 | grid columnconfigure $base._frame_4 6 -weight 1 -minsize 40 -pad 0 568 | grid columnconfigure $base._frame_4 7 -weight 0 -minsize 40 -pad 0 569 | grid rowconfigure $base._frame_5 1 -weight 0 -minsize 2 -pad 0 570 | grid columnconfigure $base._frame_5 1 -weight 1 -minsize 16 -pad 0 571 | grid columnconfigure $base._frame_5 2 -weight 1 -minsize 2 -pad 0 572 | grid columnconfigure $base._frame_5 3 -weight 0 -minsize 2 -pad 0 573 | grid columnconfigure $base._frame_5 4 -weight 0 -minsize 2 -pad 0 574 | grid rowconfigure $base._frame_6 1 -weight 0 -minsize 2 -pad 0 575 | grid columnconfigure $base._frame_6 1 -weight 0 -minsize 40 -pad 0 576 | grid columnconfigure $base._frame_6 2 -weight 1 -minsize 40 -pad 0 577 | $ROOT configure -menu $BASE.menu 578 | } 579 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | default: formulas.png 2 | 3 | formulas.png: formulas.tex 4 | pdflatex $< 5 | convert -density 100 -trim formulas.pdf $@ 6 | rm formulas.pdf formulas.aux formulas.log 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | Diffusion Coefficient Tool 2 | ========================== 3 | 4 | 5 | The [Diffusion Coefficient Tool](#) is an analysis plugin for VMD that computes one, two or three-dimensional mean squared displacements (MSD)-based diffusion coefficients of a chosen molecular species. 6 | 7 | 8 | 9 | 10 | Installation 11 | ------------ 12 | 13 | VMD 1.9.2 or later is required. For installation instructions, follow 14 | Method 1 explained 15 | [here](https://gist.github.com/tonigi/a9cfaf7642a7fbc13293). 16 | The statement to add in the custom dialog is: 17 | 18 | source /path/to/vmd_diffusion_coefficient/load.tcl 19 | 20 | The same command can be used in VMD's Tk Console to load the plugin 21 | manually. 22 | 23 | 24 | 25 | Test and example 26 | ---------------- 27 | 28 | To test, see the [regtest.tcl](../demo/regtest.tcl) script in the 29 | `demo` directory. E.g., in VMD's Tk Console, issue 30 | 31 | play regtest.tcl 32 | 33 | The test computes the lateral diffusion coefficient 34 | of cholesterol in a 1:1 POPC:CHL membrane on the basis of pre-computed 35 | simulation data from the *Case Study* supplement of [Guixà-González et 36 | al.](http://doi.org/10.1093/bioinformatics/btu037). The result, 0.55 ± 37 | 0.031 Ų/ns (at 310 °K), matches well the experimental value of 5.5 38 | 10-12 m²/s (at 308 °K) in Table 1 of [Filippov et 39 | al.](https://doi.org/10.1021/la034222x) (see below for units 40 | conversions). 41 | 42 | 43 | Usage (GUI) 44 | ----------- 45 | 46 | The plugin is accessible from VMD in *Extensions \> Analysis \> Diffusion Coefficient Tool*. The profile is computed for the currently loaded trajectory in the *top* molecule. The atom selection must match one atom per diffusing molecule; MSD values will be averaged over the matched atoms. 47 | 48 | Buttons are provided to 49 | 50 | - plot the **MSD displacement** MSD(τ); 51 | - plot the "instantaneous" **Diffusion coefficient** D(τ). The latter is computed with the Einstein relation as *D(τ)=MSD(τ)/2Eτ*, where *E* is the integer dimensionality of the system (1, 2 or 3). (Note that it's not a linear fit.); 52 | - save the results of the computation to a CSV file. 53 | 54 | In all cases, a linear fit of the MSD displacement over the selected range of τ is performed and the results (with standard error) are output on the status line, standard output, or written to the CSV file header as appropriate. 55 | 56 | The **Analysis interval** boxes allow to specify a subsection of the trajectory to be used for the MSD calculation. Only displacements in the subspace spanned by the **Diffusion along** axes will be considered. In other words, if *z* is deselected, motions along that axes will be irrelevant for the calculation of MSD and D. 57 | 58 | 59 | 60 | 61 | Usage (command line) 62 | -------------------- 63 | 64 | You need to load the package with `package require diffusion_coefficient`. The plugin can perform the following computations 65 | 66 | - MSD at a given lag time (in frames). The return value will be in 67 | Ų, and its value is independent of the time units. 68 | 69 | - MSD for an interval of lag times (`from`, `to`, `step` options) 70 | 71 | - D, computed as above, for an interval of lag times. The formula is 72 | only valid in the diffusive regime and with pointlike particles 73 | 74 | - D, computed by least-squares fitting MSD to a linear function in τ. 75 | This is the most commonly used method. 76 | 77 | Invocation is self-explanatory, i.e.: 78 | 79 | VMD Diffusion Coefficient tool. Computes one, two or three-dimensional 80 | MSD-based diffusion coefficients of a chosen molecular species. 81 | 82 | Usage: diffusion_coefficient 83 | 84 | Command is one of: 85 | -msd Compute mean squared displacement (MSD) at a tau of 86 | NN frames; equivalent to msd_interval -from NN -to NN. 87 | Returns a value as Angstrom^2 . This is the recommended 88 | way of using the plugin. 89 | -msd range Compute MSD for taus between -from and -to (mandatory) 90 | Returns two lists of {tau} {MSD(tau)} 91 | -d range Compute D(tau)=MSD(tau)/(2*D*tau) between -from and 92 | -to (mandatory). Returns two lists of {tau} {D(tau)} 93 | -fitD range Compute D by a linear fit of MSD over the specified 94 | range. Returns a list of {D D_err S S_err} where 95 | D is the MSD slope divided by 2D; S is the MSD intercept; 96 | and _err are the respective standard errors. 97 | 98 | 99 | The following table lists the correspondence between the GUI and 100 | function arguments. 101 | 102 | 103 | | GUI text | Function argument | Default value | 104 | |---------------------|-------------------|------------------------| 105 | | Selection | `-selection` | `water and noh` | 106 | | Diffusion along | `-alongx`, etc. | 3D | 107 | | Subtract drift | `-remove_drift` | Enabled | 108 | | τ from | `-from` | Trajectory length / 10 | 109 | | τ to | `-to` | Trajectory length / 2 | 110 | | τ step | `-step` | Trajectory length / 50 | 111 | | Analysis from | `-interval_from` | Trajectory start | 112 | | Analysis to | `-interval_to` | Trajectory end | 113 | | Analysis step | `-interval_step` | All frames | 114 | | Time between frames | `-dt` | 1 ns | 115 | 116 | 117 | 118 | Averaging 119 | --------- 120 | 121 | ![formulas.png](formulas.png) 122 | 123 | | Symbol above | GUI parameter name | Command line option | 124 | |---------------|------------------------|---------------------| 125 | | wf | Analysis interval from | `-interval_from` | 126 | | wt | Analysis interval to | `-interval_to` | 127 | | ws | Analysis interval step | `-interval_stride` | 128 | 129 | 130 | Units 131 | ----- 132 | 133 | The results are given in Å2/ns. Conversion factors: 134 | 135 | - 0.1 Å2/ns = 10-12 m2/s = 10-8 cm2/s = 1 μm2/s 136 | 137 | - 1 cm²/s = 107 Ų/ns 138 | 139 | - 1 m²/s = 1011 Ų/ns 140 | 141 | - 1 μm²/s = 0.1 Ų/ns 142 | 143 | - 1 Ų/ns = 10-7 cm²/s = 10-11 m²/s = 10 μm²/s 144 | 145 | 146 | 147 | Notes 148 | ----- 149 | 150 | - The Diffusion Coefficient Tool is not a magic box. It only 151 | computes mean squared displacements (MSD) at a variety of lag 152 | times (τ). The MSD is predicted by Einstein's relation to grow 153 | linearly with τ. Most often than not, this DOES NOT occur in 154 | practice, for a variety of reasons, including poor sampling or 155 | non-diffusive behavior. It is YOUR responsibility to understand 156 | why and, if you trust the linearity, to fit the slope. Please 157 | consider the following paper to be **mandatory reading**: [David 158 | Keffer, The Working Man's Guide to Obtaining Self Diffusion 159 | Coefficients from Molecular Dynamics 160 | Simulations](http://utkstair.org/clausius/docs/che548/pdf/selfD.pdf). 161 | 162 | - The point-wise formula for *D* is only valid for small particles 163 | in the diffusive (Brownian) regime. In general, you should instead 164 | perform a linear fit of MSD over a range of τ values, and discard 165 | the intercept (see [Martin et al., 2002](https://linkinghub.elsevier.com/retrieve/pii/S0006349502739714)). 166 | 167 | - Computing converged diffusion coefficients is likely beyond your 168 | sampling capacity and patience, unless done for plenty of 169 | molecules (ie. solvent). Don't draw premature conclusions: expect 170 | **microseconds** sampling. 171 | 172 | - The trajectory must not be wrapped. Some MD simulation software 173 | (notably GROMACS) tend to write trajectories in the *wrapped* 174 | format, i.e., with atom positions remapped to the "origin" 175 | periodic image. This format is inappropriate for MSD 176 | calculations: trajectories have to be unwrapped first (use the 177 | `pbc unwrap` or `gmx trjconv` tools). 178 | 179 | - A check is performed whether bonds exist between the selected 180 | atoms. This check may fail if wrong connectivity is inferred on 181 | molecule load. 182 | 183 | 184 | 185 | 186 | Screenshot 187 | ---------- 188 | 189 | ![gui.png](gui.png) 190 | 191 | 192 | 193 | Citation 194 | -------- 195 | 196 | Please cite the following publication: 197 | 198 | > Toni Giorgino, Computing diffusion coefficients in macromolecular simulations: the Diffusion Coefficient Tool for VMD. Journal of Open Source Software, 4(41), 1698, [doi:10.21105.joss.01698](http://doi.org/doi:10.21105.joss.01698) Available from [GitHub](https://github.com/giorginolab/vmd_diffusion_coefficient/). 199 | 200 | [![DOI](https://joss.theoj.org/papers/10.21105/joss.01698/status.svg)](https://doi.org/10.21105/joss.01698) 201 | 202 | Support 203 | ------- 204 | 205 | **NOTE: This code comes without any warranty of fitness for any 206 | use. It is UNSUPPORTED.** You may be able to get support by opening an 207 | issue in the tool's [GitHub 208 | repository](https://github.com/giorginolab/vmd_diffusion_coefficient/), 209 | or by posting to the [External 210 | tools](https://sourceforge.net/p/membplugin/discussion/external_tools/) 211 | forum hosted at the [MEMBPLUGIN](http://membplugin.sourceforge.net) 212 | site. Contributions may be provided via GitHub's *Pull Requests*. 213 | 214 | 215 | License 216 | ------- 217 | 218 | By downloading the software you agree to comply with the terms of the 219 | [3-clause BSD license](../LICENSE). The TCL linear fitting code is 220 | reproduced from TCLLIB's [linear-model](https://tools.ietf.org/doc/tcllib/html/statistics.html#23) 221 | function. Tcl/Tk [licensing terms](https://www.tcl.tk/software/tcltk/license.html) apply to it. 222 | 223 | 224 | 225 | Acknowledgments 226 | --------------- 227 | 228 | Work on this software started while at the CBBL of the Universitat 229 | Pompeu Fabra (GRIB-IMIM-UPF). Former support from the Agència de Gestió d'Ajuts Universitaris i de 230 | Recerca - Generalitat de Catalunya is gratefully acknowledged. 231 | 232 | -------------------------------------------------------------------------------- /doc/formulas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_diffusion_coefficient/a4ec010f616b7b346bb29c6ea64ba3adcb05accd/doc/formulas.png -------------------------------------------------------------------------------- /doc/formulas.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{amsmath} 3 | \begin{document} 4 | \thispagestyle{empty} 5 | \pagestyle{empty} 6 | % convert -density 150 -trim formulas.pdf formulas.png 7 | 8 | Mean squared displacement is the usual definition: 9 | % 10 | $$\mbox{MSD}(\tau)= \langle | \mathbf r (\tau) - \mathbf r(0) |^2 \rangle $$ 11 | 12 | The average, written explicitly, is done over windows of span $\tau$ 13 | that can be constructed in the interval $[w_f \dots w_t]$. To reduce 14 | computation requirements, this average will be done with a stride of $w_s$ (i.e.\ 15 | only one window every $w_s$ will be considered): 16 | % 17 | $$\mbox{MSD}(\tau)= \underbrace{ 18 | \frac{w_s}{w_t-w_f-\tau} 19 | \sum_{t_0=w_f \mbox{ \scriptsize every } w_s}^{w_t-\tau-1} 20 | }_{\mbox{Average over intervals of span $\tau$ }} 21 | \underbrace{ 22 | \frac{1}{N} 23 | \sum_{i=1}^N 24 | \left( 25 | \mathbf r_i(t_0+\tau) - \mathbf r_i(t_0) 26 | \right)^2 27 | }_{\mbox{Average over selected atoms}} 28 | $$ 29 | 30 | When the center of mass drift subtraction is enabled, the following 31 | replacement is applied to the above formula: 32 | % 33 | $$\mathbf r(t) \to \mathbf r(t)-\mathbf r_0(t)$$ 34 | % 35 | where $\mathbf r_0(t)$ is the position of the center 36 | of mass of the selected atoms at time $t$: 37 | % 38 | $$\mathbf r_0(t)=\sum_{i=1}^N \mathbf r_i(t) /N$$ 39 | 40 | 41 | 42 | 43 | \end{document} 44 | 45 | -------------------------------------------------------------------------------- /doc/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_diffusion_coefficient/a4ec010f616b7b346bb29c6ea64ba3adcb05accd/doc/gui.png -------------------------------------------------------------------------------- /load.tcl: -------------------------------------------------------------------------------- 1 | # Startup helper. 2 | 3 | 4 | set diffusion_coefficient_dir [file dirname [file normalize [info script]]] 5 | 6 | # source [file join $diffusion_coefficient_gui::SCRIPTDIR diffusion_coefficient_gui_ui.tcl] 7 | 8 | puts "diffusion_coefficient) Adding directory $diffusion_coefficient_dir to auto_path and registering the menu" 9 | 10 | lappend auto_path $diffusion_coefficient_dir 11 | package require diffusion_coefficient_gui 12 | ::diffusion_coefficient_gui::register_menu 13 | 14 | -------------------------------------------------------------------------------- /paper/drawing-source.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 29 | 35 | 36 | 44 | 50 | 51 | 59 | 65 | 66 | 74 | 80 | 81 | 89 | 95 | 96 | 104 | 110 | 111 | 112 | 135 | 140 | 141 | 143 | 144 | 146 | image/svg+xml 147 | 149 | 150 | 151 | 152 | 153 | 158 | 164 | 170 | 177 | Analysis interval 188 | 190 | 195 | 200 | 206 | 207 | 213 | 219 | -interval_from 230 | -interval_to 241 | 0 252 | T 263 | Trajectory length 274 | Lagτ 300 | 302 | 307 | 312 | 318 | 319 | 321 | 326 | 331 | 337 | 338 | 343 | 349 | -interval_step 360 | 361 | 362 | -------------------------------------------------------------------------------- /paper/drawing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_diffusion_coefficient/a4ec010f616b7b346bb29c6ea64ba3adcb05accd/paper/drawing.pdf -------------------------------------------------------------------------------- /paper/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_diffusion_coefficient/a4ec010f616b7b346bb29c6ea64ba3adcb05accd/paper/gui.png -------------------------------------------------------------------------------- /paper/paper.bib: -------------------------------------------------------------------------------- 1 | 2 | @article{humphrey_vmd_1996, 3 | title = {{VMD}: {Visual} molecular dynamics}, 4 | volume = {14}, 5 | issn = {0263-7855}, 6 | shorttitle = {{VMD}}, 7 | url = {http://www.sciencedirect.com/science/article/pii/0263785596000185}, 8 | doi = {10.1016/0263-7855(96)00018-5}, 9 | abstract = {VMD is a molecular graphics program designed for the display and analysis of molecular assemblies, in particular biopolymers such as proteins and nucleic acids. VMD can simultaneously display any number of structures using a wide variety of rendering styles and coloring methods. Molecules are displayed as one or more “representations,” in which each representation embodies a particular rendering method and coloring scheme for a selected subset of atoms. The atoms displayed in each representation are chosen using an extensive atom selection syntax, which includes Boolean operators and regular expressions. VMD provides a complete graphical user interface for program control, as well as a text interface using the Tcl embeddable parser to allow for complex scripts with variable substitution, control loops, and function calls. Full session logging is supported, which produces a VMD command script for later playback. High-resolution raster images of displayed molecules may be produced by generating input scripts for use by a number of photorealistic image-rendering applications. VMD has also been expressly designed with the ability to animate molecular dynamics (MD) simulation trajectories, imported either from files or from a direct connection to a running MD simulation. VMD is the visualization component of MDScope, a set of tools for interactive problem solving in structural biology, which also includes the parallel MD program NAMD, and the MDCOMM software used to connect the visualization and simulation programs. VMD is written in C++, using an object-oriented design; the program, including source code and extensive documentation, is freely available via anonymous ftp and through the World Wide Web.}, 10 | number = {1}, 11 | urldate = {2012-11-13}, 12 | journal = {Journal of Molecular Graphics}, 13 | author = {Humphrey, William and Dalke, Andrew and Schulten, Klaus}, 14 | month = feb, 15 | year = {1996}, 16 | keywords = {molecular modeling, Computer Graphics; Computer Simulation; Computers; Models, molecular dynamics visualization, Molecular; Nucleic Acids, interactive visualization, chemistry; User-Computer Interface, chemistry; Proteins}, 17 | pages = {33--38}, 18 | annote = {Added to JabRef: 2009.06.06}, 19 | annote = {Owner: toni} 20 | } 21 | 22 | 23 | @article{dainese_membrane_2014, 24 | title = {Membrane lipids are key modulators of the endocannabinoid-hydrolase {FAAH}}, 25 | volume = {457}, 26 | url = {http://www.biochemj.org/bj/457/bj4570463.htm}, 27 | doi = {10.1042/BJ20130960}, 28 | abstract = {Lipid composition is expected to play an important role in modulating membrane enzyme activity, in particular if the substrates are themselves lipid molecules. A paradigmatic case is FAAH (fatty acid amide hydrolase), an enzyme critical in terminating endocannabinoid signalling and an important therapeutic target. In the present study, using a combined experimental and computational approach, we show that membrane lipids modulate the structure, subcellular localization and activity of FAAH. We report that the FAAH dimer is stabilized by the lipid bilayer and shows a higher membrane-binding affinity and enzymatic activity within membranes containing both cholesterol and the natural FAAH substrate AEA (anandamide). Additionally, co-localization of cholesterol, AEA and FAAH in mouse neuroblastoma cells suggests a mechanism through which cholesterol increases the substrate accessibility of FAAH.}, 29 | number = {3}, 30 | journal = {Biochemical Journal}, 31 | author = {Dainese, Enrico and De Fabritiis, Gianni and Sabatucci, Annalaura and Oddi, Sergio and Angelucci, Clotilde Beatrice and Di Pancrazio, Chiara and Giorgino, Toni and Stanley, Nathaniel and Del Carlo, Michele and Cravatt, Benjamin F. and Maccarrone, Mauro}, 32 | month = feb, 33 | year = {2014}, 34 | pages = {463--472}, 35 | file = {Dainese et al_2014_Membrane lipids are key modulators of the endocannabinoid-hydrolase FAAH.pdf:/home/toni/Sync/literature/zotero/Toni/Toni_1_Journals/Dainese et al_2014_Membrane lipids are key modulators of the endocannabinoid-hydrolase FAAH.pdf:application/pdf;Dainese et al_2014_Membrane lipids are key modulators of the endocannabinoid-hydrolase FAAH.pdf:/home/toni/Sync/literature/zotero/Toni/Toni_1_Journals/Dainese et al_2014_Membrane lipids are key modulators of the endocannabinoid-hydrolase FAAH2.pdf:application/pdf} 36 | } 37 | 38 | 39 | @article{guixa-gonzalez_membrane_2016, 40 | title = {Membrane omega-3 fatty acids modulate the oligomerisation kinetics of adenosine {A}$_{\textrm{2A}}$ and dopamine {D}$_{\textrm{2}}$ receptors}, 41 | volume = {6}, 42 | copyright = {2016 Nature Publishing Group}, 43 | issn = {2045-2322}, 44 | url = {https://www.nature.com/articles/srep19839}, 45 | doi = {10.1038/srep19839}, 46 | abstract = {Membrane levels of docosahexaenoic acid (DHA), an essential omega-3 polyunsaturated fatty acid (ω-3 PUFA), are decreased in common neuropsychiatric disorders. DHA modulates key cell membrane properties like fluidity, thereby affecting the behaviour of transmembrane proteins like G protein-coupled receptors (GPCRs). These receptors, which have special relevance for major neuropsychiatric disorders have recently been shown to form dimers or higher order oligomers, and evidence suggests that DHA levels affect GPCR function by modulating oligomerisation. In this study, we assessed the effect of membrane DHA content on the formation of a class of protein complexes with particular relevance for brain disease: adenosine A2A and dopamine D2 receptor oligomers. Using extensive multiscale computer modelling, we find a marked propensity of DHA for interaction with both A2A and D2 receptors, which leads to an increased rate of receptor oligomerisation. Bioluminescence resonance energy transfer (BRET) experiments performed on living cells suggest that this DHA effect on the oligomerisation of A2A and D2 receptors is purely kinetic. This work reveals for the first time that membrane ω-3 PUFAs play a key role in GPCR oligomerisation kinetics, which may have important implications for neuropsychiatric conditions like schizophrenia or Parkinson’s disease.}, 47 | language = {en}, 48 | urldate = {2019-05-27}, 49 | journal = {Scientific Reports}, 50 | author = {Guixà-González, Ramon and Javanainen, Matti and Gómez-Soler, Maricel and Cordobilla, Begoña and Domingo, Joan Carles and Sanz, Ferran and Pastor, Manuel and Ciruela, Francisco and Martinez-Seara, Hector and Selent, Jana}, 51 | month = jan, 52 | year = {2016}, 53 | pages = {19839}, 54 | file = {Guixà-González et al_2016_Membrane omega-3 fatty acids modulate the oligomerisation kinetics of adenosine.pdf:/Users/toni/Sync/literature/zotero/Targets/GPCR/Guixà-González et al_2016_Membrane omega-3 fatty acids modulate the oligomerisation kinetics of adenosine.pdf:application/pdf;Snapshot:/Users/toni/Zotero/storage/8RIHZDNH/srep19839.html:text/html} 55 | } 56 | 57 | 58 | @article{lemkul_proteins_2019, 59 | title = {From {Proteins} to {Perturbed} {Hamiltonians}: {A} {Suite} of {Tutorials} for the {GROMACS}-2018 {Molecular} {Simulation} {Package} [{Article} v1.0]}, 60 | volume = {1}, 61 | issn = {25756524}, 62 | shorttitle = {From {Proteins} to {Perturbed} {Hamiltonians}}, 63 | url = {https://www.livecomsjournal.org/article/5068-from-proteins-to-perturbed-hamiltonians-a-suite-of-tutorials-for-the-gromacs-2018-molecular-simulation-package-article-v1-0}, 64 | doi = {10.33011/livecoms.1.1.5068}, 65 | abstract = {Molecular dynamics (MD) simulations are a popular technique for studying the atomistic behavior of any molecular system. Performing MD simulations requires a user to become familiar with the commands, options, and file formats of the chosen simulation software, none of which are consistent across different programs. Beyond these requirements, users are expected to be familiar with various aspects of physics, mathematics, computer programming, and interaction with a command-line environment, presenting critical barriers to entry in the MD simulation field. This article presents seven tutorials for instructing users in the proper methods for preparing and carrying out different types of MD simulations in the popular GROMACS simulation package. GROMACS is an open-source, free, and flexible MD package that is consistently among the fastest in the world. The tutorials presented here range from a "simple" system of a protein in aqueous solution to more advanced concepts such as force field organization and modification for a membrane-protein system, two methods of calculating free energy differences (umbrella sampling and "alchemical" methods), biphasic systems, protein-ligand complexes, and the use of virtual sites in MD simulations. In this article, users are provided the rationale and a theoretical explanation for the command-line syntax in each step in the online tutorials (available at http://www.mdtutorials.com/gmx) and the underlying settings and algorithms necessary to perform robust MD simulations in each scenario.}, 66 | language = {en}, 67 | number = {1}, 68 | urldate = {2019-08-23}, 69 | journal = {Living Journal of Computational Molecular Science}, 70 | author = {Lemkul, Justin}, 71 | year = {2019}, 72 | file = {Lemkul_2019_From Proteins to Perturbed Hamiltonians.pdf:/Users/toni/Sync/literature/zotero/MD/Software/Lemkul_2019_From Proteins to Perturbed Hamiltonians.pdf:application/pdf} 73 | } 74 | 75 | 76 | @article{martin_apparent_2002, 77 | title = {Apparent {Subdiffusion} {Inherent} to {Single} {Particle} {Tracking}}, 78 | volume = {83}, 79 | issn = {00063495}, 80 | url = {https://linkinghub.elsevier.com/retrieve/pii/S0006349502739714}, 81 | doi = {10.1016/S0006-3495(02)73971-4}, 82 | abstract = {Subdiffusion and its causes in both in vivo and in vitro lipid membranes have become the focus of recent research. We report apparent subdiffusion, observed via single particle tracking (SPT), in a homogeneous system that only allows normal diffusion (a DMPC monolayer in the fluid state). The apparent subdiffusion arises from slight errors in finding the actual particle position due to noise inherent in all experimental SPT systems. A model is presented that corrects this artifact, and predicts the time scales after which the effect becomes negligible. The techniques and results presented in this paper should be of use in all SPT experiments studying normal and anomalous diffusion.}, 83 | language = {en}, 84 | number = {4}, 85 | urldate = {2019-08-28}, 86 | journal = {Biophysical Journal}, 87 | author = {Martin, Douglas S. and Forstner, Martin B. and Käs, Josef A.}, 88 | month = oct, 89 | year = {2002}, 90 | pages = {2109--2117}, 91 | file = {Martin et al_2002_Apparent Subdiffusion Inherent to Single Particle Tracking.pdf:/Users/toni/Sync/literature/zotero/MD/Didactic/Martin et al_2002_Apparent Subdiffusion Inherent to Single Particle Tracking.pdf:application/pdf} 92 | } 93 | 94 | 95 | @article{guixa-gonzalez_membplugin:_2014, 96 | title = {{MEMBPLUGIN}: studying membrane complexity in {VMD}}, 97 | volume = {30}, 98 | issn = {1367-4803, 1460-2059}, 99 | shorttitle = {{MEMBPLUGIN}}, 100 | url = {http://bioinformatics.oxfordjournals.org/content/30/10/1478}, 101 | doi = {10.1093/bioinformatics/btu037}, 102 | abstract = {Summary: Computer simulations are giving way to more complex and accurate studies of biological membranes by molecular dynamics (MD) simulations. The analysis of MD trajectories comprises the biophysical characterization of membrane properties or the study of protein–lipid interactions and dynamics. However, there is a lack of automated tools to analyse MD simulations of complex membrane or membrane-protein systems. Here we present MEMBPLUGIN, a plugin for the Visual Molecular Dynamics package that provides algorithms to measure a host of essential biophysical properties in simulated membranes. MEMBPLUGIN features are accessible both through a user-friendly graphical interface and as command-line procedures to be invoked in analysis scripts. 103 | Availability and implementation: MEMBPLUGIN is a VMD extension written in Tcl. Multi-platform source code, documentation and tutorials are freely available at http://membplugin.sourceforge.net. 104 | Contact: toni.giorgino@isib.cnr.it or jana.selent@upf.edu 105 | Supplementary information: Supplementary data are available at Bioinformatics online.}, 106 | language = {en}, 107 | number = {10}, 108 | urldate = {2014-05-19}, 109 | journal = {Bioinformatics}, 110 | author = {Guixà-González, Ramon and Rodriguez-Espigares, Ismael and Ramírez-Anguita, Juan Manuel and Carrió-Gaspar, Pau and Martinez-Seara, Hector and Giorgino, Toni and Selent, Jana}, 111 | month = may, 112 | year = {2014}, 113 | pmid = {24451625}, 114 | pages = {1478--1480}, 115 | file = {Guixà-González et al_2014_MEMBPLUGIN.pdf:/Users/toni/Sync/literature/zotero/Toni/Toni_1_Journals/Guixà-González et al_2014_MEMBPLUGIN.pdf:application/pdf;Snapshot:/Users/toni/Zotero/storage/NTSIR699/1478.html:text/html;Snapshot:/Users/toni/Zotero/storage/Q7J25QFJ/bioinformatics.html:text/html} 116 | } 117 | 118 | -------------------------------------------------------------------------------- /paper/paper.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Computing diffusion coefficients in macromolecular simulations: the Diffusion Coefficient Tool for VMD' 3 | tags: 4 | - VMD 5 | - diffusion coefficient 6 | - molecular dynamics 7 | - trajectory 8 | authors: 9 | - name: Toni Giorgino 10 | orcid: 0000-0001-6449-0596 11 | affiliation: 1 12 | affiliations: 13 | - name: Institute of Biophysics (IBF-CNR), National Research Council of Italy 14 | index: 1 15 | date: 15 August 2019 16 | bibliography: paper.bib 17 | --- 18 | 19 | # Summary 20 | 21 | Computing diffusion coefficients from classical molecular dynamics 22 | (MD) simulations is a common task when assessing solvent and lipid 23 | dynamics both in bulk and in confined regions. Solute-modulated 24 | lateral diffusion of lipids is especially interesting in biological 25 | membranes, where it plays a role in receptor activity and raft 26 | formation [@dainese_membrane_2014]. 27 | 28 | The Diffusion Coefficient Tool is an analysis plugin for the Visual 29 | Molecular Dynamics (VMD) analysis environment [@humphrey_vmd_1996], 30 | which computes various types of diffusion coefficients for a molecular 31 | species from simulated trajectories. 32 | 33 | 34 | # Method 35 | 36 | Diffusion coefficients are computed on the basis of time- and 37 | ensemble-averaged squared displacement (MSD) of the chosen molecular 38 | species. The MSD $M(\tau)$ is defined by fixing an arbitrary time 39 | origin and a *lag time* $\tau$ as the mean displacement over that 40 | interval: 41 | 42 | $$ M(\tau) = \langle | \mathbf r (\tau) - \mathbf r(0) |^2 \rangle $$ 43 | 44 | where $\mathbf r(t)$ indicates the position of a particle at time $t$, 45 | and the angle brackets indicate an average over all particles of the 46 | species under analysis. In practice, to improve convergence, the MSD 47 | analysis is repeated using different time origins, under the 48 | equilibrium assumption. If the system is in a diffusive regime and 49 | the position measurement error is negligible, the diffusion 50 | coefficient can be obtained through Einstein's relation: 51 | 52 | $$ D(\tau) = M(\tau) / 2E\tau $$ 53 | 54 | where $E$ is the dimensionality of the system (integer, $1 \leq E \leq 3$). 55 | In general, MSD values at multiple lag times are computed from the 56 | same trajectory to check their linearity and asymptotic slope in 57 | $\tau$ to check diffusivity and average out measurement errors 58 | [@martin_apparent_2002]. 59 | 60 | 61 | 62 | 63 | # Implementation 64 | 65 | After installation, the plugin is accessible from VMD in the *Extensions - 66 | Analysis - Diffusion Coefficient Tool* menu. The analysis is run on the 67 | currently loaded trajectory in the *top* molecule (Figure 1). 68 | The diffusion coefficient tool can be used either interactively with 69 | its graphical user interface (GUI, Figure 1), or calling the 70 | `diffusion_coefficient` procedure in VMD's embedded TCL language. 71 | 72 | The tool can compute the following quantities: 73 | 74 | * $M(\tau)$ ("MSD displacement" GUI button, or procedure argument `-msd`) 75 | * "Instantaneous" $D(\tau) = M(\tau)/2E\tau$, valid as long as diffusivity holds and position errors are small (button "Diffusion coefficient", argument `-d`) 76 | * $D$ (and its standard error) through least-squares fitting of $M(\tau)$ to $2 E D \tau + \sigma$ (button "Linear fit", argument `-fitD`). 77 | 78 | The results are either plotted (GUI) or returned as a list (procedure 79 | call). The following table lists the correspondence between the GUI 80 | and procedure arguments. 81 | 82 | 83 | | GUI text | Procedure argument | Default value | 84 | |---------------------+-------------------+------------------------| 85 | | Selection | `-selection` | `water and noh` | 86 | | Diffusion along | `-alongx`, etc. | 3D | 87 | | Subtract drift | `-remove_drift` | Enabled | 88 | | $\tau$ from | `-from` | Trajectory length / 10 | 89 | | $\tau$ to | `-to` | Trajectory length / 2 | 90 | | $\tau$ step | `-step` | Trajectory length / 50 | 91 | | Analysis from | `-interval_from` | Trajectory start | 92 | | Analysis to | `-interval_to` | Trajectory end | 93 | | Analysis step | `-interval_step` | All frames | 94 | | Time between frames | `-dt` | 1 ns | 95 | 96 | 97 | 98 | ![The main window of Diffusion Coefficient Tool](gui.png) 99 | 100 | 101 | The time averaging scheme and interpretation of the interval window 102 | parameters is shown in Figure 2: averaging occurs over the windows of 103 | span $\tau$ that can be constructed in the analysis interval, strided 104 | by an *interval step*. The analysis is repeated for the chosen values 105 | of $\tau$, ranging from a minimum to a maximum, again with a stride. 106 | 107 | ![The interval selection parameters and time-averaging scheme. The MSD 108 | samples being averaged are indicated by shades of grey.](drawing.pdf) 109 | 110 | Note that obtaining *converged* MSD values from MD simulations requires 111 | an aggregated sampling much larger than the characteristic time $\tau$. 112 | In common MD regimes such sampling can only be achieved as long 113 | as several equivalent atoms are available for averaging. For this 114 | reason, the plugin provides an atom selection, which must match one 115 | atom per diffusing molecule, for MSD values to be averaged over. 116 | 117 | 118 | 119 | # Related tools 120 | 121 | MEMBPLUGIN is a VMD plugin which implements additional analysis types 122 | specifically for quasi-planar bilayer simulations 123 | [@guixa-gonzalez_membplugin:_2014]. This tool's regression test is based 124 | on the case study trajectories provided with MEMBPLUGIN. 125 | The `gmx msd` utility is distributed with GROMACS and 126 | performs a similar MSD calculation from the command line shell 127 | [@lemkul_proteins_2019]. 128 | 129 | 130 | 131 | # References 132 | -------------------------------------------------------------------------------- /pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | # Tcl package index file, version 1.1 2 | # This file is generated by the "pkg_mkIndex" command 3 | # and sourced either when an application starts up or 4 | # by a "package unknown" script. It invokes the 5 | # "package ifneeded" command to set up package-related 6 | # information so that packages will be loaded automatically 7 | # in response to "package require" commands. When this 8 | # script is sourced, the variable $dir must contain the 9 | # full path name of this file's directory. 10 | 11 | package ifneeded diffusion_coefficient 1.2 [list source [file join $dir diffusion_coefficient.tcl]] 12 | package ifneeded diffusion_coefficient_gui 1.2 [list source [file join $dir diffusion_coefficient_gui.tcl]] 13 | 14 | 15 | # The package used to misuse this file to register the plugin as 16 | # follows. However, this does not work reliably in every 17 | # configuration. Sourcing the included load.tcl file is safer. 18 | 19 | # catch { 20 | # source [file join $dir diffusion_coefficient_gui.tcl] 21 | # diffusion_coefficient_gui::register_menu 22 | # } 23 | 24 | # catch { package require diffusion_coefficient_gui; diffusion_coefficient_gui::register_menu; } 25 | 26 | --------------------------------------------------------------------------------