├── Makefile ├── README.md ├── density_profile.tcl ├── density_profile_gui.tcl ├── density_profile_gui.ui ├── density_profile_gui_ui.tcl ├── doc ├── ChangeLog ├── NOTE.txt.private ├── POPC-e-density-profile.png ├── POPC-waters-mass-density-profile.png ├── README.md └── Screenshot-Density Profile Tool.png ├── examples ├── Readme.md ├── example.tcl └── popc │ ├── popc_box.psf │ └── popc_box.xtc ├── load.tcl └── pkgIndex.tcl /Makefile: -------------------------------------------------------------------------------- 1 | .SILENT: 2 | 3 | VMFILES = pkgIndex.tcl density_profile_gui.tcl density_profile_gui_ui.tcl density_profile.tcl 4 | VMVERSION = 1.2 5 | DIR = $(PLUGINDIR)/noarch/tcl/density_profile(VMVERSION) 6 | 7 | 8 | bins: 9 | win32bins: 10 | dynlibs: 11 | staticlibs: 12 | win32staticlibs: 13 | 14 | distrib: 15 | @echo "Copying density_profile $(VMVERSION) files to $(DIR)" 16 | mkdir -p $(DIR) 17 | cp $(VMFILES) $(DIR) 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | VMD Density Profile Tool 2 | ======================================== 3 | 4 | 5 | The Density Profile Tool is a VMD [1] analysis plugin that computes 6 | 1-D projections of various atomic densities. The computation may be 7 | performed in a single frame, a trajectory, or averaged over multiple 8 | frames. 9 | 10 | * Number density, i.e. average number of atoms per unit volume 11 | * Mass density 12 | * Charge density 13 | * Electron density, i.e. average number of electrons. 14 | 15 | [1] Visual Molecular Dynamics (VMD), http://www.ks.uiuc.edu/Research/vmd/ 16 | 17 | 18 | Author 19 | ---------------------------------------- 20 | Toni Giorgino
21 | National Research Council of Italy (CNR)
22 | toni.giorgino at cnr.it 23 | 24 | 25 | 26 | Citation 27 | ---------------------------------------- 28 | 29 | Please cite this paper when publishing results obtained with the 30 | Density Profile Tool: 31 | 32 | * Giorgino T. *Computing 1-D atomic densities in macromolecular 33 | simulations: The density profile tool for VMD.* Computer Physics 34 | Communications. 2014 Jan;185(1):317–22. Available from 35 | [doi:10.1016/j.cpc.2013.08.022](https://www.sciencedirect.com/science/article/pii/S0010465513002956) 36 | or preprint at [arXiv:1308.5873](https://arxiv.org/abs/1308.5873) 37 | 38 | 39 | 40 | Installation 41 | ---------------------------------------- 42 | 43 | See instructions [here](https://gist.github.com/tonigi/a9cfaf7642a7fbc13293). 44 | 45 | 46 | 47 | 48 | 49 | Documentation 50 | --------------------- 51 | 52 | Further documentation is available in the `doc` subdirectory. 53 | 54 | For an extensive description of the tool, together with the comparison 55 | with experimental data, see the [Density Profile paper](http://www.sciencedirect.com/science/article/pii/S0010465513002956) 56 | 57 | 58 | 59 | 60 | 61 | 62 | Quickstart 63 | ---------------------------------------- 64 | 65 | Once correctly installed, a menu item should appear in VMD's 66 | Extensions menu, under "Extensions>Analysis>Density Profile Tool". 67 | 68 | The plugin can be used interactively or via a scripting interface. See 69 | the included test script (example.tcl) for an example of in-script 70 | usage. The script 71 | 72 | 1. loads Klauda's equilibrated membranes 73 | (http://terpconnect.umd.edu/~jbklauda/research/download.html), POPC 74 | Bilayer (303.00K, NPT, 35ns, 72 lipids); 75 | 2. computes the mass density profile for water molecules, showing 76 | it as a table and a plot; 77 | 3. computes the electron density profile for the whole system, showing 78 | it as a plot. 79 | 80 | Sample output for point 2.: 81 | 82 | ~~~~~~ 83 | | Bin breaks coordinates: (z, Angstroms) 84 | | Density of water in each bin: (g/mol/A^3) 85 | -35.00 0.00 86 | -34.00 0.28 87 | -33.00 0.65 88 | -32.00 0.61 89 | -31.00 0.62 90 | -30.00 0.60 91 | -29.00 0.62 92 | -28.00 0.56 93 | -27.00 0.56 94 | -26.00 0.61 95 | -25.00 0.55 96 | [...] 97 | 28.00 0.58 98 | 29.00 0.64 99 | 30.00 0.56 100 | 31.00 0.57 101 | 32.00 0.60 102 | 33.00 0.25 103 | 34.00 0.00 104 | ~~~~~~ 105 | 106 | 107 | 108 | License 109 | --------------- 110 | 111 | Density Profile Plugin 112 | Copyright (C) 2012 113 | 114 | This program is free software: you can redistribute it and/or modify 115 | it under the terms of the GNU General Public License as published by 116 | the Free Software Foundation, either version 3 of the License, or 117 | (at your option) any later version. 118 | 119 | This program is distributed in the hope that it will be useful, 120 | but WITHOUT ANY WARRANTY; without even the implied warranty of 121 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 122 | GNU General Public License for more details. 123 | 124 | You should have received a copy of the GNU General Public License 125 | along with this program. If not, see . 126 | -------------------------------------------------------------------------------- /density_profile.tcl: -------------------------------------------------------------------------------- 1 | # Core functions for computing density profiles. The Density Profile 2 | # Tool is a VMD analysis plugin that computes 1-D projections of 3 | # various atomic densities. The computation is performed in a single 4 | # frame, a trajectory, or averaged over multiple frames. 5 | 6 | # Toni Giorgino, ISIB-Consiglio Nazionale delle Ricerche, 2012 7 | # http://doi.org/10.1016/j.cpc.2013.08.022 8 | # https://github.com/giorginolab/vmd_density_profile 9 | 10 | 11 | package provide density_profile 1.1 12 | package require topotools 13 | package require pbctools 14 | 15 | # Declare the namespace for this dialog 16 | namespace eval ::density_profile:: { 17 | # Variables matching command line options 18 | variable dp_args 19 | variable dp_args_defaults { 20 | rho number 21 | selection all 22 | axis z 23 | resolution 1 24 | Zsource mass 25 | partial_charges 1 26 | frame_from now 27 | frame_to now 28 | frame_step 1 29 | average 0 30 | } 31 | array set dp_args $dp_args_defaults 32 | 33 | # List of args in "preferred" order 34 | variable dp_args_list {rho selection axis resolution Zsource partial_charges \ 35 | frame_from frame_to frame_step average} 36 | 37 | } 38 | 39 | 40 | # User-accessible proc 41 | proc density_profile { args } { return [eval ::density_profile::density_profile $args] } 42 | 43 | 44 | # Help 45 | proc ::density_profile::density_profile_usage { } { 46 | variable dp_args 47 | variable dp_args_list 48 | puts "VMD Density Profile tool. Computes 1-D projections of various atomic densities." 49 | puts "The computation is performed in a single frame, a trajectory, or averaged" 50 | puts "over multiple frames. You probably want to wrap your trajectory." 51 | puts " " 52 | puts "Usage: density_profile " 53 | puts "Args (with defaults):" 54 | foreach k $dp_args_list { 55 | puts " -$k $dp_args($k)" 56 | } 57 | puts " " 58 | puts "Density -rho is one of {number|mass|charge|electrons}" 59 | puts "See documentation at https://github.com/giorginolab/vmd_density_profile" 60 | } 61 | 62 | 63 | # Command line parsing (sets namespace variables). TODO: allow short 64 | # substrings, e.g. -sel 65 | proc ::density_profile::parse_args {args} { 66 | variable dp_args 67 | foreach {a v} $args { 68 | if {![regexp {^-} $a]} { 69 | error "Argument should start with -: $a" 70 | } 71 | set a [string trimleft $a -] 72 | if {![info exists dp_args($a)]} { 73 | error "Unknown argument: $a" 74 | } 75 | set dp_args($a) $v 76 | } 77 | } 78 | 79 | 80 | # Main entry point. 81 | proc ::density_profile::density_profile {args} { 82 | variable dp_args 83 | variable dp_args_defaults 84 | array set dp_args $dp_args_defaults 85 | if {[llength $args]==0} { 86 | density_profile_usage 87 | return 88 | } 89 | eval parse_args $args 90 | 91 | # parray dp_args 92 | 93 | # Compute the bare histogram 94 | set lhist [compute] 95 | 96 | # Reformat the histogram and return it 97 | set xbreaks [hist_to_xbreaks $lhist] 98 | set framelist [get_framelist] 99 | set values [hist_to_values $lhist] 100 | 101 | # If averaging or single-frame, flatten inner list 102 | if { $dp_args(average)==1 || [llength $framelist]==1 } { 103 | set values [average_sublists $values] 104 | } 105 | 106 | return [list $values $xbreaks] 107 | 108 | } 109 | 110 | 111 | # Convert histogram into lists of values. If resolution=2 and 112 | # hist(2,-3)=0.23 ; hist(2,-1)=0.21; 113 | # hist(4,-2)=0.42 ; hist(4,0)=0.40 => 114 | 115 | # Convert histogram into list of breaks => {-6, -4, -2, 0} 116 | proc ::density_profile::hist_to_xbreaks {lhist} { 117 | variable dp_args 118 | array set hist $lhist 119 | lassign [get_x_range [array names hist]] binmin binmax 120 | 121 | set xbreaks {} 122 | for {set bin $binmin} {$bin<=$binmax} {incr bin} { 123 | lappend xbreaks [expr $bin*$dp_args(resolution)] 124 | } 125 | return $xbreaks 126 | } 127 | 128 | 129 | # Values, return { {0.23 0} {0 0.42} {0.21 0} {0 0.40} } 130 | proc ::density_profile::hist_to_values {lhist} { 131 | variable dp_args 132 | array set hist $lhist 133 | lassign [get_x_range [array names hist]] binmin binmax 134 | set framelist [get_framelist] 135 | 136 | # Outer cycle is on bins 137 | set v {} 138 | set nbins [expr $binmax-$binmin+1] 139 | 140 | for {set idx 0} {$idx<$nbins} {incr idx} { 141 | set bin [expr $idx+$binmin] 142 | set tmp {} 143 | # Inner cycle on frames 144 | foreach f $framelist { 145 | lappend tmp $hist($f,$bin) 146 | } 147 | lappend v $tmp 148 | } 149 | return $v 150 | } 151 | 152 | 153 | # Average sublists: { {0.23 0} {0 0.42} {0.21 0} {0 0.40} } -> { 0.125 154 | # 0.21 0.105 0.20 }. Also useful for flattening in case of one frame 155 | proc ::density_profile::average_sublists {vl} { 156 | set res {} 157 | foreach l $vl { 158 | lappend res [vecmean $l] 159 | } 160 | return $res 161 | } 162 | 163 | 164 | 165 | # Similar to average_sublists, but returns standard deviation of each bin. 166 | proc ::density_profile::stddev_sublists {vl} { 167 | set res {} 168 | foreach l $vl { 169 | lappend res [vecstddev $l] 170 | } 171 | return $res 172 | } 173 | 174 | 175 | 176 | 177 | # Compute and return the bare histogram. Relation between bins and 178 | # coordinate is implicit; note that [0..$resolution) goes in bin 0, 179 | # and so on. 180 | # 181 | # This is the workhorse function, assumes namespace variables are 182 | # properly set. 183 | # 184 | # bin = [expr int(floor($x/$resolution))] 185 | # xmin = $bin * $resolution 186 | # 187 | # hist(frame,bin) 188 | # 189 | # The hist structure is contrieved because we don't know the bins 190 | # until all of the frames have been scanned 191 | 192 | proc ::density_profile::compute { } { 193 | variable dp_args 194 | 195 | set resolution $dp_args(resolution) 196 | set axis $dp_args(axis) 197 | 198 | # Check if PBC box is set 199 | set area [transverse_area] 200 | set area_len [llength $area] 201 | if { $area_len == 1 } { 202 | if { $area == -1 } { 203 | puts "Warning: No periodic cell information. Computing linear densities instead of volume densities." 204 | set area [lrepeat [molinfo top get numframes] 1.0] 205 | } elseif { $area <= -2 } { 206 | error "Cannot compute density, check arguments." 207 | } 208 | } 209 | 210 | # Values 211 | set rho [get_rho] 212 | 213 | # Build atomselection 214 | set as [atomselect top $dp_args(selection)] 215 | 216 | # Start loop over frames 217 | array unset hist 218 | set framelist [get_framelist] 219 | foreach f $framelist { 220 | $as frame $f 221 | set xval [$as get $axis] 222 | 223 | # get area now and normalize density 224 | # TODO profile 225 | set area_now [lindex $area $f] 226 | set rho_norm [vecscale [expr 1./$area_now/$resolution] $rho] 227 | 228 | # make histogram: hist(frame,bin) 229 | foreach x $xval vn $rho_norm { 230 | # bin 231 | set bin [expr int(floor($x/$resolution))] 232 | if {! [info exists hist($f,$bin)] } { set hist($f,$bin) 0.0 } 233 | set hist($f,$bin) [expr $hist($f,$bin)+$vn] 234 | } 235 | } 236 | $as delete 237 | 238 | # make bins for never-seen values 239 | fill_keys hist 240 | 241 | # Return histogram 242 | return [array get hist] 243 | 244 | } 245 | 246 | 247 | 248 | # Sanity check on PBC. Return values 249 | # -1 if LINEAR densities can be still computed, 250 | # -2 if non-orthorhombic 251 | # -3 if wrong axis 252 | # else return a list of the transversal PBC area per frame 253 | proc ::density_profile::transverse_area { } { 254 | variable dp_args 255 | set axis $dp_args(axis) 256 | set pb_list [pbc get -all] 257 | set area_list {}; # to hold results 258 | 259 | foreach pb $pb_list { 260 | lassign $pb a b c alpha beta gamma 261 | # heuristic for unset box 262 | if {$a<2 || $b<2 || $c<2} { 263 | return -1; # immediately 264 | } elseif {$alpha!= 90 || $beta!=90 || $gamma!=90} { 265 | puts "Only orthorombic cells are supported" 266 | return -2; # immediately 267 | } else { 268 | switch -- $axis { 269 | x { set area [expr $b*$c] } 270 | y { set area [expr $a*$c] } 271 | z { set area [expr $a*$b] } 272 | default { 273 | puts "Wrong axis $axis, must be one of x,y or z" 274 | set area -3 275 | } 276 | } 277 | lappend area_list $area 278 | } 279 | } 280 | return $area_list 281 | } 282 | 283 | 284 | 285 | 286 | # return the range over the 1st and 2nd dimension of a pseudo-2d array 287 | # e.g. {2,3 5,4 2,4} -> {3 4} 288 | proc ::density_profile::get_x_range {kk} { 289 | foreach k $kk { 290 | lappend xlist [lindex [split $k ,] 1] 291 | } 292 | set xlist [lsort -uniq -integer $xlist] 293 | set xmin [lindex $xlist 0] 294 | set xmax [lindex $xlist end] 295 | return [list $xmin $xmax] 296 | } 297 | 298 | 299 | # fill histogram keys so that there is one integer bin per each value 300 | # between mi and max 301 | # 302 | proc ::density_profile::fill_keys arr { 303 | upvar $arr inp 304 | set keys [array names inp] 305 | lassign [get_x_range $keys] xmin xmax 306 | set framelist [get_framelist] 307 | # puts "Filling frames $framelist, bins $xmin..$xmax" 308 | 309 | foreach f $framelist { 310 | for {set x $xmin} {$x<=$xmax} {incr x} { 311 | if { ![info exists inp($f,$x)] } { 312 | set inp($f,$x) 0 313 | } 314 | } 315 | } 316 | } 317 | 318 | 319 | # Auxiliary function, returns {from to step}, after possibly fixing 320 | # "now". TODO first, last 321 | proc ::density_profile::get_framelist {} { 322 | variable dp_args 323 | set f $dp_args(frame_from) 324 | set t $dp_args(frame_to) 325 | set s $dp_args(frame_step) 326 | 327 | # Should be the atom selection frame? 328 | if { $f=="now" } { set f [molinfo top get frame] } 329 | if { $t=="now" } { set t [molinfo top get frame] } 330 | 331 | for {set i $f} {$i<=$t} {incr i $s} { 332 | lappend fl $i 333 | } 334 | return $fl 335 | } 336 | 337 | 338 | # Return the values of the selected property, as a list of one value 339 | # per selected atom. These will not change per-frame. 340 | # 341 | proc ::density_profile::get_rho {} { 342 | variable dp_args 343 | set as [atomselect top $dp_args(selection)] 344 | if { [$as num]==0 } { 345 | $as delete 346 | error "Atom selection did not match any atom." 347 | } 348 | switch $dp_args(rho) { 349 | number { 350 | set tval [lrepeat [$as num] 1] 351 | } 352 | mass { 353 | set tval [$as get mass] 354 | } 355 | charge { 356 | set tval [$as get charge] 357 | } 358 | electrons { 359 | set tval [getZ $as] 360 | if {$dp_args(partial_charges)==1} { 361 | set pch [$as get charge] 362 | set tval [vecsub $tval $pch] 363 | } 364 | } 365 | default { 366 | $as delete 367 | error "Unknown rho, must be one of {number|mass|charge|electrons}" 368 | } 369 | } 370 | $as delete 371 | return $tval 372 | } 373 | 374 | 375 | # Similar to [atomselect get ...] , but get Z number, based on the 376 | # $Zsource option . Requires an atomselection 377 | proc ::density_profile::getZ {as} { 378 | variable dp_args 379 | set attr $dp_args(Zsource) 380 | 381 | # If anything different than element was required, use 382 | # topotools. This will modify the "element" attribute, so make a 383 | # backup and restore when done. 384 | if { $attr == "element" } { 385 | set res [$as get atomicnumber] 386 | } else { 387 | set o_Z [$as get atomicnumber] 388 | topo guessatom element $attr 389 | set res [$as get atomicnumber] 390 | $as set atomicnumber $o_Z 391 | } 392 | 393 | # Z=0 or Z=-1 means unidentified 394 | if { [lsearch $res 0 ] != -1 || 395 | [lsearch $res -1] != -1} { 396 | error "Could not guess element for some atoms." 397 | } 398 | 399 | return $res 400 | } 401 | 402 | 403 | -------------------------------------------------------------------------------- /density_profile_gui.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env wish# density_profile_gui.tcl -- 2 | # 3 | # UI generated by GUI Builder Build 146 on 2012-12-18 18:22:59 from: 4 | # /home/toni/compile/vmd-utils/vmd_density_profile/density_profile_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 density_profile_gui {} 16 | 17 | # Source the ui file, which must exist 18 | set density_profile_gui::SCRIPTDIR [file dirname [info script]] 19 | source [file join $density_profile_gui::SCRIPTDIR density_profile_gui_ui.tcl] 20 | 21 | # BEGIN USER CODE 22 | # ---------------------------------------- 23 | # GUI functions for computing density profiles. 24 | # ---------------------------------------- 25 | 26 | # This code is a mess because it can be loaded back in guibuilder. 27 | package provide density_profile_gui 1.1 28 | 29 | namespace eval density_profile_gui { 30 | variable already_registered 0 31 | } 32 | 33 | # VMD-specific stuff. If invoked from VMD, load the backed functions 34 | # (in package density_profile) and setup some defaults. 35 | set density_profile_gui::in_vmd [string length [info proc vmd_install_extension]] 36 | if { $density_profile_gui::in_vmd } { 37 | package require density_profile 38 | } else { 39 | # Kludge to run outside VMD 40 | namespace eval ::density_profile:: {} 41 | array set ::density_profile::dp_args {} 42 | } 43 | 44 | # Called right upon menu action 45 | proc density_profile_gui::density_profile_tk {} { 46 | variable density_profile_window 47 | 48 | if { [winfo exists .density_profile] } { 49 | wm deiconify $density_profile_window 50 | } else { 51 | set density_profile_window [ toplevel ".density_profile" ] 52 | wm title $density_profile_window "Density Profile Tool" 53 | density_profile_gui::ui $density_profile_window; 54 | } 55 | return $density_profile_window 56 | } 57 | 58 | # Register menu if possible 59 | proc density_profile_gui::register_menu {} { 60 | variable already_registered 61 | if {$already_registered==0} { 62 | incr already_registered 63 | vmd_install_extension density_profile_gui density_profile_gui::density_profile_tk "Analysis/Density Profile Tool" 64 | } 65 | } 66 | 67 | 68 | 69 | # Only enable Z-related controls for electron densities 70 | proc density_profile_gui::update_Zsource_state {} { 71 | variable ::density_profile::dp_args 72 | variable density_profile_window 73 | set rho $dp_args(rho) 74 | set state disabled 75 | if {$rho=="electrons"} { 76 | set state normal 77 | } 78 | $density_profile_window.radiobutton_Zsource_element configure -state $state 79 | $density_profile_window.radiobutton_Zsource_mass configure -state $state 80 | $density_profile_window.radiobutton_Zsource_name configure -state $state 81 | $density_profile_window.radiobutton_Zsource_type configure -state $state 82 | $density_profile_window.checkbox_Zsource_partial configure -state $state 83 | } 84 | 85 | 86 | 87 | # Return the title to show on the vertical axis. For now simply 88 | # returns rho 89 | proc density_profile_gui::get_title {} { 90 | set rho $::density_profile::dp_args(rho) 91 | return $rho 92 | } 93 | 94 | # Return the unit to show on the vertical axis 95 | proc density_profile_gui::get_units {} { 96 | set rho $::density_profile::dp_args(rho) 97 | array set ylabel {number atoms mass amu charge e electrons el} 98 | return $ylabel($rho) 99 | } 100 | 101 | # Nested list transpose http://wiki.tcl.tk/2748 102 | proc density_profile_gui::transpose {matrix} { 103 | for {set index 0} {$index < [llength [lindex $matrix 0]]} {incr index} { 104 | lappend res [lsearch -all -inline -subindices -index $index $matrix *] 105 | } 106 | return $res 107 | } 108 | 109 | proc density_profile_gui::help_docs {} { 110 | vmd_open_url https://doi.org/10.1016/j.cpc.2013.08.022 111 | } 112 | 113 | proc density_profile_gui::help_about {} { 114 | variable density_profile_window 115 | tk_messageBox -title "About" -parent $density_profile_window -message \ 116 | " 117 | VMD Density Profile Tool 118 | 119 | Version [package versions density_profile] 120 | 121 | Toni Giorgino 122 | National Research Council of Italy (CNR) 123 | 124 | Until 2011: 125 | Computational Biophysics Group 126 | Research Programme on Biomedical Informatics (GRIB-IMIM) 127 | Universitat Pompeu Fabra (UPF) 128 | 129 | " 130 | 131 | } 132 | 133 | 134 | # Uses density_profile::compute to do the backend computation 135 | proc density_profile_gui::do_plot {} { 136 | variable ::density_profile::dp_args 137 | variable density_profile_window 138 | 139 | set selection $dp_args(selection) 140 | set axis $dp_args(axis) 141 | set resolution $dp_args(resolution) 142 | set average $dp_args(average) 143 | 144 | # Make sure pbcs are set or warn 145 | set area [density_profile::transverse_area] 146 | if { [llength $area] == 1 && $area == -1 } { 147 | set answer [ tk_messageBox -icon question -message "No periodic cell information. Will compute linear densities instead of volume densities. Continue?" \ 148 | -type okcancel -parent $density_profile_window] 149 | switch -- $answer { 150 | ok { set area 1 } 151 | cancel { error "Cancelled" } 152 | } 153 | } elseif { [llength $area] == 1 && $area == -2 } { 154 | tk_messageBox -icon error -message "Only orthorombic cells are supported" -title Error -parent $density_profile_window 155 | error "Only orthorombic cells are supported" 156 | } 157 | 158 | 159 | # Compute 160 | set lhist [density_profile::compute] 161 | 162 | set framelist [density_profile::get_framelist] 163 | set values [density_profile::hist_to_values $lhist] 164 | 165 | # breaks -> bin centers 166 | set xbreaks [density_profile::hist_to_xbreaks $lhist] 167 | foreach b $xbreaks { 168 | lappend xcenters [expr $b+0.5*$resolution] 169 | } 170 | 171 | # Title and Y axis label 172 | if {$average==1} { 173 | set title "Average [get_title] density profile (\u00B1 s.d.)" 174 | } else { 175 | set title "[string totitle [get_title]] density profile" 176 | } 177 | set ylabel [get_units] 178 | if {$area == 1} { 179 | set ylabel "$ylabel/\uc5" 180 | } else { 181 | set ylabel "$ylabel/\uc5\ub3" 182 | } 183 | set xlabel "Bin center (\u212B)" 184 | 185 | 186 | # do plot, average case 187 | if {$average} { 188 | set avg [density_profile::average_sublists $values] 189 | set std [density_profile::stddev_sublists $values] 190 | 191 | set avgpstd [vecadd $avg $std] 192 | set avgmstd [vecsub $avg $std] 193 | 194 | set ph [multiplot -x $xcenters -y $avg \ 195 | -ylabel $ylabel \ 196 | -xlabel $xlabel \ 197 | -title $title \ 198 | -marker point -radius 2 -fillcolor "#ff0000" -color "#ff0000" ] 199 | $ph add $xcenters $avgpstd -dash "," -linecolor "#000000" 200 | $ph add $xcenters $avgmstd -dash "," -linecolor "#000000" 201 | $ph replot 202 | } else { 203 | # Iterate over frames, build a vector, plot it 204 | set ph [multiplot -title $title \ 205 | -ylabel $ylabel \ 206 | -xlabel $xlabel ] 207 | set values_t [transpose $values] 208 | foreach tmp $values_t { 209 | $ph add $xcenters $tmp -linecolor "#000000" 210 | } 211 | $ph replot 212 | } 213 | 214 | } 215 | # END USER CODE 216 | 217 | # BEGIN CALLBACK CODE 218 | # ONLY EDIT CODE INSIDE THE PROCS. 219 | 220 | # density_profile_gui::_checkbutton_2_command -- 221 | # 222 | # Callback to handle _checkbutton_2 widget option -command 223 | # 224 | # ARGS: 225 | # 226 | # 227 | proc density_profile_gui::_checkbutton_2_command args {} 228 | 229 | # density_profile_gui::_entry_1_invalidcommand -- 230 | # 231 | # Callback to handle _entry_1 widget option -invalidcommand 232 | # 233 | # ARGS: 234 | # 235 | # 236 | proc density_profile_gui::_entry_1_invalidcommand args {} 237 | 238 | # density_profile_gui::_entry_1_validatecommand -- 239 | # 240 | # Callback to handle _entry_1 widget option -validatecommand 241 | # 242 | # ARGS: 243 | # 244 | # 245 | proc density_profile_gui::_entry_1_validatecommand args {} 246 | 247 | # density_profile_gui::_entry_1_xscrollcommand -- 248 | # 249 | # Callback to handle _entry_1 widget option -xscrollcommand 250 | # 251 | # ARGS: 252 | # 253 | # 254 | proc density_profile_gui::_entry_1_xscrollcommand args {} 255 | 256 | # density_profile_gui::_entry_2_invalidcommand -- 257 | # 258 | # Callback to handle _entry_2 widget option -invalidcommand 259 | # 260 | # ARGS: 261 | # 262 | # 263 | proc density_profile_gui::_entry_2_invalidcommand args {} 264 | 265 | # density_profile_gui::_entry_2_validatecommand -- 266 | # 267 | # Callback to handle _entry_2 widget option -validatecommand 268 | # 269 | # ARGS: 270 | # 271 | # 272 | proc density_profile_gui::_entry_2_validatecommand args {} 273 | 274 | # density_profile_gui::_entry_2_xscrollcommand -- 275 | # 276 | # Callback to handle _entry_2 widget option -xscrollcommand 277 | # 278 | # ARGS: 279 | # 280 | # 281 | proc density_profile_gui::_entry_2_xscrollcommand args {} 282 | 283 | # density_profile_gui::_entry_3_invalidcommand -- 284 | # 285 | # Callback to handle _entry_3 widget option -invalidcommand 286 | # 287 | # ARGS: 288 | # 289 | # 290 | proc density_profile_gui::_entry_3_invalidcommand args {} 291 | 292 | # density_profile_gui::_entry_3_validatecommand -- 293 | # 294 | # Callback to handle _entry_3 widget option -validatecommand 295 | # 296 | # ARGS: 297 | # 298 | # 299 | proc density_profile_gui::_entry_3_validatecommand args {} 300 | 301 | # density_profile_gui::_entry_3_xscrollcommand -- 302 | # 303 | # Callback to handle _entry_3 widget option -xscrollcommand 304 | # 305 | # ARGS: 306 | # 307 | # 308 | proc density_profile_gui::_entry_3_xscrollcommand args {} 309 | 310 | # density_profile_gui::_entry_4_invalidcommand -- 311 | # 312 | # Callback to handle _entry_4 widget option -invalidcommand 313 | # 314 | # ARGS: 315 | # 316 | # 317 | proc density_profile_gui::_entry_4_invalidcommand args {} 318 | 319 | # density_profile_gui::_entry_4_validatecommand -- 320 | # 321 | # Callback to handle _entry_4 widget option -validatecommand 322 | # 323 | # ARGS: 324 | # 325 | # 326 | proc density_profile_gui::_entry_4_validatecommand args {} 327 | 328 | # density_profile_gui::_entry_4_xscrollcommand -- 329 | # 330 | # Callback to handle _entry_4 widget option -xscrollcommand 331 | # 332 | # ARGS: 333 | # 334 | # 335 | proc density_profile_gui::_entry_4_xscrollcommand args {} 336 | 337 | # density_profile_gui::_entry_5_invalidcommand -- 338 | # 339 | # Callback to handle _entry_5 widget option -invalidcommand 340 | # 341 | # ARGS: 342 | # 343 | # 344 | proc density_profile_gui::_entry_5_invalidcommand args {} 345 | 346 | # density_profile_gui::_entry_5_validatecommand -- 347 | # 348 | # Callback to handle _entry_5 widget option -validatecommand 349 | # 350 | # ARGS: 351 | # 352 | # 353 | proc density_profile_gui::_entry_5_validatecommand args {} 354 | 355 | # density_profile_gui::_entry_5_xscrollcommand -- 356 | # 357 | # Callback to handle _entry_5 widget option -xscrollcommand 358 | # 359 | # ARGS: 360 | # 361 | # 362 | proc density_profile_gui::_entry_5_xscrollcommand args {} 363 | 364 | # density_profile_gui::_radiobutton_2_command -- 365 | # 366 | # Callback to handle _radiobutton_2 widget option -command 367 | # 368 | # ARGS: 369 | # 370 | # 371 | proc density_profile_gui::_radiobutton_2_command args {} 372 | 373 | # density_profile_gui::_radiobutton_3_command -- 374 | # 375 | # Callback to handle _radiobutton_3 widget option -command 376 | # 377 | # ARGS: 378 | # 379 | # 380 | proc density_profile_gui::_radiobutton_3_command args {} 381 | 382 | # density_profile_gui::_radiobutton_4_command -- 383 | # 384 | # Callback to handle _radiobutton_4 widget option -command 385 | # 386 | # ARGS: 387 | # 388 | # 389 | proc density_profile_gui::_radiobutton_4_command args {} 390 | 391 | # density_profile_gui::checkbox_Zsource_partial_command -- 392 | # 393 | # Callback to handle checkbox_Zsource_partial widget option -command 394 | # 395 | # ARGS: 396 | # 397 | # 398 | proc density_profile_gui::checkbox_Zsource_partial_command args {} 399 | 400 | # density_profile_gui::close_command -- 401 | # 402 | # Callback to handle close widget option -command 403 | # 404 | # ARGS: 405 | # 406 | # 407 | proc density_profile_gui::close_command args { 408 | wm withdraw .density_profile 409 | } 410 | 411 | # density_profile_gui::help_command -- 412 | # 413 | # Callback to handle help widget option -command 414 | # 415 | # ARGS: 416 | # 417 | # 418 | proc density_profile_gui::help_command args { 419 | help_docs 420 | } 421 | 422 | # density_profile_gui::plot_command -- 423 | # 424 | # Callback to handle plot widget option -command 425 | # 426 | # ARGS: 427 | # 428 | # 429 | proc density_profile_gui::plot_command args { 430 | do_plot 431 | } 432 | 433 | # density_profile_gui::radiobutton_atoms_command -- 434 | # 435 | # Callback to handle radiobutton_atoms widget option -command 436 | # 437 | # ARGS: 438 | # 439 | # 440 | proc density_profile_gui::radiobutton_atoms_command args {update_Zsource_state} 441 | 442 | # density_profile_gui::radiobutton_charge_command -- 443 | # 444 | # Callback to handle radiobutton_charge widget option -command 445 | # 446 | # ARGS: 447 | # 448 | # 449 | proc density_profile_gui::radiobutton_charge_command args {update_Zsource_state} 450 | 451 | # density_profile_gui::radiobutton_electrons_command -- 452 | # 453 | # Callback to handle radiobutton_electrons widget option -command 454 | # 455 | # ARGS: 456 | # 457 | # 458 | proc density_profile_gui::radiobutton_electrons_command args {update_Zsource_state} 459 | 460 | # density_profile_gui::radiobutton_mass_command -- 461 | # 462 | # Callback to handle radiobutton_mass widget option -command 463 | # 464 | # ARGS: 465 | # 466 | # 467 | proc density_profile_gui::radiobutton_mass_command args {update_Zsource_state} 468 | 469 | # density_profile_gui::radiobutton_Zsource_element_command -- 470 | # 471 | # Callback to handle radiobutton_Zsource_element widget option -command 472 | # 473 | # ARGS: 474 | # 475 | # 476 | proc density_profile_gui::radiobutton_Zsource_element_command args {} 477 | 478 | # density_profile_gui::radiobutton_Zsource_mass_command -- 479 | # 480 | # Callback to handle radiobutton_Zsource_mass widget option -command 481 | # 482 | # ARGS: 483 | # 484 | # 485 | proc density_profile_gui::radiobutton_Zsource_mass_command args {} 486 | 487 | # density_profile_gui::radiobutton_Zsource_name_command -- 488 | # 489 | # Callback to handle radiobutton_Zsource_name widget option -command 490 | # 491 | # ARGS: 492 | # 493 | # 494 | proc density_profile_gui::radiobutton_Zsource_name_command args {} 495 | 496 | # density_profile_gui::radiobutton_Zsource_type_command -- 497 | # 498 | # Callback to handle radiobutton_Zsource_type widget option -command 499 | # 500 | # ARGS: 501 | # 502 | # 503 | proc density_profile_gui::radiobutton_Zsource_type_command args {} 504 | 505 | # END CALLBACK CODE 506 | 507 | # density_profile_gui::init -- 508 | # 509 | # Call the optional userinit and initialize the dialog. 510 | # DO NOT EDIT THIS PROCEDURE. 511 | # 512 | # Arguments: 513 | # root the root window to load this dialog into 514 | # 515 | # Results: 516 | # dialog will be created, or a background error will be thrown 517 | # 518 | proc density_profile_gui::init {root args} { 519 | # Catch this in case the user didn't define it 520 | catch {density_profile_gui::userinit} 521 | if {[info exists embed_args]} { 522 | # we are running in the plugin 523 | density_profile_gui::ui $root 524 | } elseif {$::argv0 == [info script]} { 525 | # we are running in stand-alone mode 526 | wm title $root density_profile_gui 527 | if {[catch { 528 | # Create the UI 529 | density_profile_gui::ui $root 530 | } err]} { 531 | bgerror $err ; exit 1 532 | } 533 | } 534 | catch {density_profile_gui::run $root} 535 | } 536 | density_profile_gui::init . 537 | 538 | -------------------------------------------------------------------------------- /density_profile_gui.ui: -------------------------------------------------------------------------------- 1 | # GUIBUILDER FILE Build 146 2 | # Created: 2012-12-18 18:22:52 by GUI Builder Build 146 3 | language tcl 8.4 4 | widget {Tk frame} f { 5 | geometry min_column {40 119} 6 | geometry min_row {17 44 40 38 48 40 45 2 27} 7 | geometry pad_column {0 0} 8 | geometry pad_row {0 0 0 0 0 0 0 0 0} 9 | geometry resize_column {0 3} 10 | geometry resize_row {1 3 0 1 0 0 0 1 1} 11 | geometry weight_column {0 1} 12 | geometry weight_row {0 1 0 0 0 0 0 0 0} 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 5 23 | geometry -rowspan 1 24 | geometry -sticky w 25 | geometry min_column {40 40 40 40 40} 26 | geometry min_row 7 27 | geometry pad_column {0 0 0 0 0} 28 | geometry pad_row 0 29 | geometry resize_column {1 1 1 1 1} 30 | geometry resize_row 0 31 | geometry weight_column {0 0 0 0 0} 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_2 { 40 | geometry -column 2 41 | geometry -columnspan 1 42 | geometry -row 6 43 | geometry -rowspan 1 44 | geometry -sticky w 45 | geometry min_column {40 40 40 40 40} 46 | geometry min_row 16 47 | geometry pad_column {0 0 0 0 0} 48 | geometry pad_row 0 49 | geometry resize_column {0 0 1 1 0} 50 | geometry resize_row 0 51 | geometry weight_column {0 0 0 0 0} 52 | geometry weight_row 0 53 | data GROUP Tk 54 | data ID frame_Zsource 55 | data MASTER {} 56 | data TYPE {Tk frame} 57 | data level 1 58 | } 59 | widget {Tk frame} _frame_3 { 60 | geometry -column 2 61 | geometry -columnspan 1 62 | geometry -row 3 63 | geometry -rowspan 1 64 | geometry -sticky w 65 | geometry min_column {40 40 40 40} 66 | geometry min_row 15 67 | geometry pad_column {0 0 0 0} 68 | geometry pad_row 0 69 | geometry resize_column {0 0 0 0} 70 | geometry resize_row 0 71 | geometry weight_column {0 0 0 0} 72 | geometry weight_row 0 73 | data GROUP Tk 74 | data ID _frame_3 75 | data MASTER {} 76 | data TYPE {Tk frame} 77 | data level 1 78 | } 79 | widget {Tk frame} _frame_4 { 80 | geometry -column 1 81 | geometry -columnspan 2 82 | geometry -row 9 83 | geometry -rowspan 1 84 | geometry -sticky news 85 | geometry min_column {40 40 40} 86 | geometry min_row 10 87 | geometry pad_column {0 0 0} 88 | geometry pad_row 0 89 | geometry resize_column {0 3 3} 90 | geometry resize_row 1 91 | geometry weight_column {0 1 1} 92 | geometry weight_row 0 93 | data GROUP Tk 94 | data ID _frame_4 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 7 103 | geometry -rowspan 1 104 | geometry -sticky ew 105 | geometry min_column {40 24 40 27 40 78} 106 | geometry min_row 2 107 | geometry pad_column {0 0 0 0 0 0} 108 | geometry pad_row 0 109 | geometry resize_column {3 0 3 0 3 1} 110 | geometry resize_row 0 111 | geometry weight_column {1 0 1 0 1 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 10} 121 | configure -text {Atom selection} 122 | geometry -column 1 123 | geometry -columnspan 1 124 | geometry -row 4 125 | geometry -rowspan 1 126 | geometry -sticky e 127 | geometry min_column {40 40 40 40 40} 128 | geometry min_row 40 129 | geometry pad_column {0 0 0 0 0} 130 | geometry pad_row 0 131 | geometry resize_column {0 0 0 0 0} 132 | geometry resize_row 0 133 | geometry weight_column {0 0 0 0 0} 134 | geometry weight_row 0 135 | data GROUP Tk 136 | data ID _label_1 137 | data MASTER {} 138 | data TYPE {Tk label} 139 | } 140 | widget {Tk label} _label_2 { 141 | configure -font {helvetica 10} 142 | configure -text {Projection axis} 143 | geometry -column 1 144 | geometry -columnspan 1 145 | geometry -row 5 146 | geometry -rowspan 1 147 | geometry -sticky e 148 | geometry min_column {40 40 40 40 40} 149 | geometry min_row 40 150 | geometry pad_column {0 0 0 0 0} 151 | geometry pad_row 0 152 | geometry resize_column {0 0 0 0 0} 153 | geometry resize_row 0 154 | geometry weight_column {0 0 0 0 0} 155 | geometry weight_row 0 156 | data GROUP Tk 157 | data ID _label_2 158 | data MASTER {} 159 | data TYPE {Tk label} 160 | } 161 | widget {Tk label} _label_3 { 162 | configure -font {helvetica 10} 163 | configure -text {Resolution (Å)} 164 | geometry -column 4 165 | geometry -columnspan 1 166 | geometry -row 1 167 | geometry -rowspan 1 168 | geometry -sticky e 169 | geometry min_column {40 40 40 40 40} 170 | geometry min_row 40 171 | geometry pad_column {0 0 0 0 0} 172 | geometry pad_row 0 173 | geometry resize_column {0 0 0 0 0} 174 | geometry resize_row 0 175 | geometry weight_column {0 0 0 0 0} 176 | geometry weight_row 0 177 | data GROUP Tk 178 | data ID _label_3 179 | data MASTER _frame_1 180 | data TYPE {Tk label} 181 | } 182 | widget {Tk label} _label_5 { 183 | configure -font {helvetica 10} 184 | configure -justify right 185 | configure -text {Guess atomic number Z\nfrom attribute} 186 | geometry -column 1 187 | geometry -columnspan 1 188 | geometry -row 6 189 | geometry -rowspan 1 190 | geometry -sticky e 191 | geometry min_column {40 40 40 40 40} 192 | geometry min_row 40 193 | geometry pad_column {0 0 0 0 0} 194 | geometry pad_row 0 195 | geometry resize_column {0 0 0 0 0} 196 | geometry resize_row 0 197 | geometry weight_column {0 0 0 0 0} 198 | geometry weight_row 0 199 | data GROUP Tk 200 | data ID _label_5 201 | data MASTER {} 202 | data TYPE {Tk label} 203 | } 204 | widget {Tk entry} _entry_1 { 205 | configure -font {helvetica 10} 206 | configure -justify center 207 | configure -textvariable density_profile::dp_args(selection) 208 | geometry -column 2 209 | geometry -columnspan 1 210 | geometry -row 4 211 | geometry -rowspan 1 212 | geometry -sticky ew 213 | geometry min_column {40 40 40 40 40} 214 | geometry min_row 40 215 | geometry pad_column {0 0 0 0 0} 216 | geometry pad_row 0 217 | geometry resize_column {0 0 0 0 0} 218 | geometry resize_row 0 219 | geometry weight_column {0 0 0 0 0} 220 | geometry weight_row 0 221 | data GROUP Tk 222 | data ID _entry_1 223 | data MASTER {} 224 | data TYPE {Tk entry} 225 | } 226 | widget {Tk label} _label_6 { 227 | configure -font {helvetica 10 bold} 228 | configure -text {VMD Density Profile Tool} 229 | geometry -column 1 230 | geometry -columnspan 2 231 | geometry -row 1 232 | geometry -rowspan 1 233 | geometry -sticky s 234 | geometry min_column {40 40 40 40 40} 235 | geometry min_row 40 236 | geometry pad_column {0 0 0 0 0} 237 | geometry pad_row 0 238 | geometry resize_column {0 0 0 0 0} 239 | geometry resize_row 0 240 | geometry weight_column {0 0 0 0 0} 241 | geometry weight_row 0 242 | data GROUP Tk 243 | data ID _label_6 244 | data MASTER {} 245 | data TYPE {Tk label} 246 | } 247 | widget {Tk radiobutton} _radiobutton_2 { 248 | configure -font {helvetica 10} 249 | configure -text x 250 | configure -value x 251 | configure -variable density_profile::dp_args(axis) 252 | geometry -column 1 253 | geometry -columnspan 1 254 | geometry -row 1 255 | geometry -rowspan 1 256 | geometry -sticky ew 257 | geometry min_column {40 40 40 40 40} 258 | geometry min_row 40 259 | geometry pad_column {0 0 0 0 0} 260 | geometry pad_row 0 261 | geometry resize_column {0 0 0 0 0} 262 | geometry resize_row 0 263 | geometry weight_column {0 0 0 0 0} 264 | geometry weight_row 0 265 | data GROUP Tk 266 | data ID _radiobutton_2 267 | data MASTER _frame_1 268 | data TYPE {Tk radiobutton} 269 | } 270 | widget {Tk radiobutton} _radiobutton_3 { 271 | configure -font {helvetica 10} 272 | configure -text y 273 | configure -value y 274 | configure -variable density_profile::dp_args(axis) 275 | geometry -column 2 276 | geometry -columnspan 1 277 | geometry -row 1 278 | geometry -rowspan 1 279 | geometry -sticky ew 280 | geometry min_column {40 40 40 40 40} 281 | geometry min_row 40 282 | geometry pad_column {0 0 0 0 0} 283 | geometry pad_row 0 284 | geometry resize_column {0 0 0 0 0} 285 | geometry resize_row 0 286 | geometry weight_column {0 0 0 0 0} 287 | geometry weight_row 0 288 | data GROUP Tk 289 | data ID _radiobutton_3 290 | data MASTER _frame_1 291 | data TYPE {Tk radiobutton} 292 | } 293 | widget {Tk radiobutton} _radiobutton_4 { 294 | configure -font {helvetica 10} 295 | configure -text z 296 | configure -value z 297 | configure -variable density_profile::dp_args(axis) 298 | geometry -column 3 299 | geometry -columnspan 1 300 | geometry -row 1 301 | geometry -rowspan 1 302 | geometry -sticky ew 303 | geometry min_column {40 40 40 40 40} 304 | geometry min_row 40 305 | geometry pad_column {0 0 0 0 0} 306 | geometry pad_row 0 307 | geometry resize_column {0 0 0 0 0} 308 | geometry resize_row 0 309 | geometry weight_column {0 0 0 0 0} 310 | geometry weight_row 0 311 | data GROUP Tk 312 | data ID _radiobutton_4 313 | data MASTER _frame_1 314 | data TYPE {Tk radiobutton} 315 | } 316 | widget {Tk entry} _entry_2 { 317 | configure -justify center 318 | configure -textvariable density_profile::dp_args(resolution) 319 | configure -width 8 320 | geometry -column 5 321 | geometry -columnspan 1 322 | geometry -row 1 323 | geometry -rowspan 1 324 | geometry -sticky ew 325 | geometry min_column {40 40 40 40 40} 326 | geometry min_row 40 327 | geometry pad_column {0 0 0 0 0} 328 | geometry pad_row 0 329 | geometry resize_column {0 0 0 0 0} 330 | geometry resize_row 0 331 | geometry weight_column {0 0 0 0 0} 332 | geometry weight_row 0 333 | data GROUP Tk 334 | data ID _entry_2 335 | data MASTER _frame_1 336 | data TYPE {Tk entry} 337 | } 338 | widget {Tk radiobutton} _radiobutton_5 { 339 | configure -font {helvetica 10} 340 | configure -state disabled 341 | configure -text name 342 | configure -value name 343 | configure -variable density_profile::dp_args(Zsource) 344 | geometry -column 3 345 | geometry -columnspan 1 346 | geometry -row 1 347 | geometry -rowspan 1 348 | geometry -sticky {} 349 | geometry min_column {40 40 40 40 40} 350 | geometry min_row 40 351 | geometry pad_column {0 0 0 0 0} 352 | geometry pad_row 0 353 | geometry resize_column {0 0 0 0 0} 354 | geometry resize_row 0 355 | geometry weight_column {0 0 0 0 0} 356 | geometry weight_row 0 357 | data GROUP Tk 358 | data ID radiobutton_Zsource_name 359 | data MASTER _frame_2 360 | data TYPE {Tk radiobutton} 361 | } 362 | widget {Tk radiobutton} _radiobutton_6 { 363 | configure -font {helvetica 10} 364 | configure -state disabled 365 | configure -text type 366 | configure -value type 367 | configure -variable density_profile::dp_args(Zsource) 368 | geometry -column 4 369 | geometry -columnspan 1 370 | geometry -row 1 371 | geometry -rowspan 1 372 | geometry -sticky {} 373 | geometry min_column {40 40 40 40 40} 374 | geometry min_row 40 375 | geometry pad_column {0 0 0 0 0} 376 | geometry pad_row 0 377 | geometry resize_column {0 0 0 0 0} 378 | geometry resize_row 0 379 | geometry weight_column {0 0 0 0 0} 380 | geometry weight_row 0 381 | data GROUP Tk 382 | data ID radiobutton_Zsource_type 383 | data MASTER _frame_2 384 | data TYPE {Tk radiobutton} 385 | } 386 | widget {Tk radiobutton} _radiobutton_7 { 387 | configure -font {helvetica 10} 388 | configure -state disabled 389 | configure -text element 390 | configure -value element 391 | configure -variable density_profile::dp_args(Zsource) 392 | geometry -column 2 393 | geometry -columnspan 1 394 | geometry -row 1 395 | geometry -rowspan 1 396 | geometry -sticky {} 397 | geometry min_column {40 40 40 40 40} 398 | geometry min_row 40 399 | geometry pad_column {0 0 0 0 0} 400 | geometry pad_row 0 401 | geometry resize_column {0 0 0 0 0} 402 | geometry resize_row 0 403 | geometry weight_column {0 0 0 0 0} 404 | geometry weight_row 0 405 | data GROUP Tk 406 | data ID radiobutton_Zsource_element 407 | data MASTER _frame_2 408 | data TYPE {Tk radiobutton} 409 | } 410 | widget {Tk label} _label_7 { 411 | configure -font {helvetica 10} 412 | configure -text {Density profile of} 413 | geometry -column 1 414 | geometry -columnspan 1 415 | geometry -row 3 416 | geometry -rowspan 1 417 | geometry -sticky e 418 | geometry min_column {40 40 40 40 40} 419 | geometry min_row 40 420 | geometry pad_column {0 0 0 0 0} 421 | geometry pad_row 0 422 | geometry resize_column {0 0 0 0 0} 423 | geometry resize_row 0 424 | geometry weight_column {0 0 0 0 0} 425 | geometry weight_row 0 426 | data GROUP Tk 427 | data ID _label_7 428 | data MASTER {} 429 | data TYPE {Tk label} 430 | } 431 | widget {Tk radiobutton} _radiobutton_9 { 432 | configure -font {helvetica 10} 433 | configure -text mass 434 | configure -value mass 435 | configure -variable density_profile::dp_args(rho) 436 | geometry -column 2 437 | geometry -columnspan 1 438 | geometry -row 1 439 | geometry -rowspan 1 440 | geometry -sticky {} 441 | geometry min_column {40 40 40 40 40} 442 | geometry min_row 40 443 | geometry pad_column {0 0 0 0 0} 444 | geometry pad_row 0 445 | geometry resize_column {0 0 0 0 0} 446 | geometry resize_row 0 447 | geometry weight_column {0 0 0 0 0} 448 | geometry weight_row 0 449 | data GROUP Tk 450 | data ID radiobutton_mass 451 | data MASTER _frame_3 452 | data TYPE {Tk radiobutton} 453 | } 454 | widget {Tk radiobutton} _radiobutton_10 { 455 | configure -font {helvetica 10} 456 | configure -text charge 457 | configure -value charge 458 | configure -variable density_profile::dp_args(rho) 459 | geometry -column 3 460 | geometry -columnspan 1 461 | geometry -row 1 462 | geometry -rowspan 1 463 | geometry -sticky {} 464 | geometry min_column {40 40 40 40 40} 465 | geometry min_row 40 466 | geometry pad_column {0 0 0 0 0} 467 | geometry pad_row 0 468 | geometry resize_column {0 0 0 0 0} 469 | geometry resize_row 0 470 | geometry weight_column {0 0 0 0 0} 471 | geometry weight_row 0 472 | data GROUP Tk 473 | data ID radiobutton_charge 474 | data MASTER _frame_3 475 | data TYPE {Tk radiobutton} 476 | } 477 | widget {Tk radiobutton} _radiobutton_11 { 478 | configure -font {helvetica 10} 479 | configure -text electrons 480 | configure -value electrons 481 | configure -variable density_profile::dp_args(rho) 482 | geometry -column 4 483 | geometry -columnspan 1 484 | geometry -row 1 485 | geometry -rowspan 1 486 | geometry -sticky {} 487 | geometry min_column {40 40 40 40 40} 488 | geometry min_row 40 489 | geometry pad_column {0 0 0 0 0} 490 | geometry pad_row 0 491 | geometry resize_column {0 0 0 0 0} 492 | geometry resize_row 0 493 | geometry weight_column {0 0 0 0 0} 494 | geometry weight_row 0 495 | data GROUP Tk 496 | data ID radiobutton_electrons 497 | data MASTER _frame_3 498 | data TYPE {Tk radiobutton} 499 | } 500 | widget {Tk button} _button_1 { 501 | configure -font {helvetica 10 bold} 502 | configure -text Plot 503 | geometry -column 2 504 | geometry -columnspan 1 505 | geometry -row 1 506 | geometry -rowspan 1 507 | geometry -sticky nsew 508 | geometry min_column {40 40 40 40 40} 509 | geometry min_row 40 510 | geometry pad_column {0 0 0 0 0} 511 | geometry pad_row 0 512 | geometry resize_column {0 0 0 0 0} 513 | geometry resize_row 0 514 | geometry weight_column {0 0 0 0 0} 515 | geometry weight_row 0 516 | data GROUP Tk 517 | data ID plot 518 | data MASTER _frame_4 519 | data TYPE {Tk button} 520 | } 521 | widget {Tk button} _button_2 { 522 | configure -font {helvetica 10 bold} 523 | configure -text Close 524 | geometry -column 3 525 | geometry -columnspan 1 526 | geometry -row 1 527 | geometry -rowspan 1 528 | geometry -sticky nsew 529 | geometry min_column {40 40 40 40 40} 530 | geometry min_row 40 531 | geometry pad_column {0 0 0 0 0} 532 | geometry pad_row 0 533 | geometry resize_column {0 0 0 0 0} 534 | geometry resize_row 0 535 | geometry weight_column {0 0 0 0 0} 536 | geometry weight_row 0 537 | data GROUP Tk 538 | data ID close 539 | data MASTER _frame_4 540 | data TYPE {Tk button} 541 | } 542 | widget {Tk radiobutton} _radiobutton_1 { 543 | configure -font {helvetica 10} 544 | configure -text number 545 | configure -value number 546 | configure -variable density_profile::dp_args(rho) 547 | geometry -column 1 548 | geometry -columnspan 1 549 | geometry -row 1 550 | geometry -rowspan 1 551 | geometry -sticky {} 552 | geometry min_column {40 40 40 40 40} 553 | geometry min_row 40 554 | geometry pad_column {0 0 0 0 0} 555 | geometry pad_row 0 556 | geometry resize_column {0 0 0 0 0} 557 | geometry resize_row 0 558 | geometry weight_column {0 0 0 0 0} 559 | geometry weight_row 0 560 | data GROUP Tk 561 | data ID radiobutton_atoms 562 | data MASTER _frame_3 563 | data TYPE {Tk radiobutton} 564 | } 565 | widget {Tk checkbutton} _checkbutton_1 { 566 | configure -font {helvetica 10} 567 | configure -state disabled 568 | configure -text {Consider partial charges} 569 | configure -variable density_profile::dp_args(partial_charges) 570 | geometry -column 5 571 | geometry -columnspan 1 572 | geometry -row 1 573 | geometry -rowspan 1 574 | geometry -sticky w 575 | geometry min_column {40 40 40 40 40} 576 | geometry min_row 40 577 | geometry pad_column {0 0 0 0 0} 578 | geometry pad_row 0 579 | geometry resize_column {0 0 0 0 0} 580 | geometry resize_row 0 581 | geometry weight_column {0 0 0 0 0} 582 | geometry weight_row 0 583 | data GROUP Tk 584 | data ID checkbox_Zsource_partial 585 | data MASTER _frame_2 586 | data TYPE {Tk checkbutton} 587 | } 588 | widget {Tk label} _label_4 { 589 | configure -font {helvetica 10} 590 | configure -pady 6 591 | configure -text {Computes 1-D projections of various atomic densities. The computation is performed in a single frame, a trajectory, or averaged over multiple frames.} 592 | configure -wraplength 400 593 | geometry -column 1 594 | geometry -columnspan 2 595 | geometry -row 2 596 | geometry -rowspan 1 597 | geometry -sticky nsew 598 | geometry min_column {40 40 40 40 40} 599 | geometry min_row 40 600 | geometry pad_column {0 0 0 0 0} 601 | geometry pad_row 0 602 | geometry resize_column {0 0 0 0 0} 603 | geometry resize_row 0 604 | geometry weight_column {0 0 0 0 0} 605 | geometry weight_row 0 606 | data GROUP Tk 607 | data ID _label_4 608 | data MASTER {} 609 | data TYPE {Tk label} 610 | } 611 | widget {Tk label} _label_8 { 612 | configure -font {helvetica 10} 613 | configure -text {Frames from} 614 | geometry -column 1 615 | geometry -columnspan 1 616 | geometry -row 7 617 | geometry -rowspan 1 618 | geometry -sticky e 619 | geometry min_column {40 40 40 40 40} 620 | geometry min_row 40 621 | geometry pad_column {0 0 0 0 0} 622 | geometry pad_row 0 623 | geometry resize_column {0 0 0 0 0} 624 | geometry resize_row 0 625 | geometry weight_column {0 0 0 0 0} 626 | geometry weight_row 0 627 | data GROUP Tk 628 | data ID _label_8 629 | data MASTER {} 630 | data TYPE {Tk label} 631 | } 632 | widget {Tk label} _label_9 { 633 | configure -font {helvetica 10} 634 | configure -text First 635 | geometry -column 1 636 | geometry -columnspan 1 637 | geometry -row 1 638 | geometry -rowspan 1 639 | geometry -sticky {} 640 | geometry min_column {40 40 40 40 40} 641 | geometry min_row 40 642 | geometry pad_column {0 0 0 0 0} 643 | geometry pad_row 0 644 | geometry resize_column {0 0 0 0 0} 645 | geometry resize_row 0 646 | geometry weight_column {0 0 0 0 0} 647 | geometry weight_row 0 648 | data GROUP Tk 649 | data ID _label_9 650 | data MASTER _frame_5 651 | data TYPE {Tk label} 652 | } 653 | widget {Tk entry} _entry_3 { 654 | configure -justify center 655 | configure -textvariable density_profile::dp_args(frame_from) 656 | configure -width 8 657 | geometry -column 1 658 | geometry -columnspan 1 659 | geometry -row 1 660 | geometry -rowspan 1 661 | geometry -sticky ew 662 | geometry min_column {40 40 40 40 40} 663 | geometry min_row 40 664 | geometry pad_column {0 0 0 0 0} 665 | geometry pad_row 0 666 | geometry resize_column {0 0 0 0 0} 667 | geometry resize_row 0 668 | geometry weight_column {0 0 0 0 0} 669 | geometry weight_row 0 670 | data GROUP Tk 671 | data ID _entry_3 672 | data MASTER _frame_5 673 | data TYPE {Tk entry} 674 | } 675 | widget {Tk label} _label_10 { 676 | configure -font {helvetica 10} 677 | configure -text { to} 678 | geometry -column 2 679 | geometry -columnspan 1 680 | geometry -row 1 681 | geometry -rowspan 1 682 | geometry -sticky e 683 | geometry min_column {40 40 40 40 40} 684 | geometry min_row 40 685 | geometry pad_column {0 0 0 0 0} 686 | geometry pad_row 0 687 | geometry resize_column {0 0 0 0 0} 688 | geometry resize_row 0 689 | geometry weight_column {0 0 0 0 0} 690 | geometry weight_row 0 691 | data GROUP Tk 692 | data ID _label_10 693 | data MASTER _frame_5 694 | data TYPE {Tk label} 695 | } 696 | widget {Tk checkbutton} _checkbutton_2 { 697 | configure -font {helvetica 10} 698 | configure -text Average 699 | configure -variable density_profile::dp_args(average) 700 | geometry -column 6 701 | geometry -columnspan 1 702 | geometry -row 1 703 | geometry -rowspan 1 704 | geometry -sticky e 705 | geometry min_column {40 40 40 40 40} 706 | geometry min_row 40 707 | geometry pad_column {0 0 0 0 0} 708 | geometry pad_row 0 709 | geometry resize_column {0 0 0 0 0} 710 | geometry resize_row 0 711 | geometry weight_column {0 0 0 0 0} 712 | geometry weight_row 0 713 | data GROUP Tk 714 | data ID _checkbutton_2 715 | data MASTER _frame_5 716 | data TYPE {Tk checkbutton} 717 | } 718 | widget {Tk entry} _entry_4 { 719 | configure -justify center 720 | configure -textvariable density_profile::dp_args(frame_to) 721 | configure -width 8 722 | geometry -column 3 723 | geometry -columnspan 1 724 | geometry -row 1 725 | geometry -rowspan 1 726 | geometry -sticky ew 727 | geometry min_column {40 40 40 40 40} 728 | geometry min_row 40 729 | geometry pad_column {0 0 0 0 0} 730 | geometry pad_row 0 731 | geometry resize_column {0 0 0 0 0} 732 | geometry resize_row 0 733 | geometry weight_column {0 0 0 0 0} 734 | geometry weight_row 0 735 | data GROUP Tk 736 | data ID _entry_4 737 | data MASTER _frame_5 738 | data TYPE {Tk entry} 739 | } 740 | widget {Tk label} _label_11 { 741 | configure -font {helvetica 10} 742 | configure -text { step} 743 | geometry -column 4 744 | geometry -columnspan 1 745 | geometry -row 1 746 | geometry -rowspan 1 747 | geometry -sticky e 748 | geometry min_column {40 40 40 40 40} 749 | geometry min_row 40 750 | geometry pad_column {0 0 0 0 0} 751 | geometry pad_row 0 752 | geometry resize_column {0 0 0 0 0} 753 | geometry resize_row 0 754 | geometry weight_column {0 0 0 0 0} 755 | geometry weight_row 0 756 | data GROUP Tk 757 | data ID _label_11 758 | data MASTER _frame_5 759 | data TYPE {Tk label} 760 | } 761 | widget {Tk entry} _entry_5 { 762 | configure -justify center 763 | configure -textvariable density_profile::dp_args(frame_step) 764 | configure -width 8 765 | geometry -column 5 766 | geometry -columnspan 1 767 | geometry -row 1 768 | geometry -rowspan 1 769 | geometry -sticky ew 770 | geometry min_column {40 40 40 40 40} 771 | geometry min_row 40 772 | geometry pad_column {0 0 0 0 0} 773 | geometry pad_row 0 774 | geometry resize_column {0 0 0 0 0} 775 | geometry resize_row 0 776 | geometry weight_column {0 0 0 0 0} 777 | geometry weight_row 0 778 | data GROUP Tk 779 | data ID _entry_5 780 | data MASTER _frame_5 781 | data TYPE {Tk entry} 782 | } 783 | widget {Tk label} _label_12 { 784 | configure -font {helvetica 10} 785 | configure -pady 6 786 | configure -text {See console for information and data files} 787 | geometry -column 1 788 | geometry -columnspan 2 789 | geometry -row 8 790 | geometry -rowspan 1 791 | geometry -sticky {} 792 | geometry min_column {40 40 40 40 40} 793 | geometry min_row 40 794 | geometry pad_column {0 0 0 0 0} 795 | geometry pad_row 0 796 | geometry resize_column {0 0 0 0 0} 797 | geometry resize_row 0 798 | geometry weight_column {0 0 0 0 0} 799 | geometry weight_row 0 800 | data GROUP Tk 801 | data ID _label_12 802 | data MASTER {} 803 | data TYPE {Tk label} 804 | } 805 | widget {Tk button} _button_3 { 806 | configure -bitmap questhead 807 | configure -font {helvetica 10 bold} 808 | configure -text ? 809 | geometry -column 1 810 | geometry -columnspan 1 811 | geometry -row 1 812 | geometry -rowspan 1 813 | geometry -sticky nsew 814 | geometry min_column {40 40 40 40 40} 815 | geometry min_row 40 816 | geometry pad_column {0 0 0 0 0} 817 | geometry pad_row 0 818 | geometry resize_column {0 0 0 0 0} 819 | geometry resize_row 0 820 | geometry weight_column {0 0 0 0 0} 821 | geometry weight_row 0 822 | data GROUP Tk 823 | data ID help 824 | data MASTER _frame_4 825 | data TYPE {Tk button} 826 | } 827 | widget {Tk radiobutton} _radiobutton_8 { 828 | configure -font {helvetica 10} 829 | configure -state disabled 830 | configure -text mass 831 | configure -value mass 832 | configure -variable density_profile::dp_args(Zsource) 833 | geometry -column 1 834 | geometry -columnspan 1 835 | geometry -row 1 836 | geometry -rowspan 1 837 | geometry -sticky {} 838 | geometry min_column {40 40 40 40 40} 839 | geometry min_row 40 840 | geometry pad_column {0 0 0 0 0} 841 | geometry pad_row 0 842 | geometry resize_column {0 0 0 0 0} 843 | geometry resize_row 0 844 | geometry weight_column {0 0 0 0 0} 845 | geometry weight_row 0 846 | data GROUP Tk 847 | data ID radiobutton_Zsource_mass 848 | data MASTER _frame_2 849 | data TYPE {Tk radiobutton} 850 | } 851 | menu {Menu menu} MENU { 852 | data MASTER {} 853 | data level 0 854 | } 855 | menu {Menu cascade} menuitem1 { 856 | configure -label Help 857 | data MASTER MENU 858 | } 859 | menu {Menu command} menuitem2 { 860 | configure -command density_profile_gui::help_docs 861 | configure -label Documentation... 862 | data MASTER menuitem1 863 | } 864 | menu {Menu command} menuitem3 { 865 | configure -command density_profile_gui::help_about 866 | configure -label About... 867 | data MASTER menuitem1 868 | } 869 | 870 | -------------------------------------------------------------------------------- /density_profile_gui_ui.tcl: -------------------------------------------------------------------------------- 1 | # density_profile_gui_ui.tcl -- 2 | # 3 | # UI generated by GUI Builder Build 146 on 2012-12-18 18:22:52 from: 4 | # /home/toni/compile/vmd-utils/vmd_density_profile/density_profile_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 density_profile_gui {} 11 | 12 | package require Tk 13 | # density_profile_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 density_profile_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_Zsource [frame $BASE.frame_Zsource] 32 | variable _frame_3 [frame $BASE._frame_3] 33 | variable _frame_4 [frame $BASE._frame_4] 34 | variable _frame_5 [frame $BASE._frame_5] 35 | variable _label_1 [label $BASE._label_1 \ 36 | -font {helvetica 10} \ 37 | -text "Atom selection"] 38 | variable _label_2 [label $BASE._label_2 \ 39 | -font {helvetica 10} \ 40 | -text "Projection axis"] 41 | variable _label_3 [label $BASE._label_3 \ 42 | -font {helvetica 10} \ 43 | -text "Resolution (\u00C5)"] 44 | variable _label_5 [label $BASE._label_5 \ 45 | -font {helvetica 10} \ 46 | -justify "right" \ 47 | -text "Guess atomic number Z\nfrom attribute"] 48 | variable _entry_1 [entry $BASE._entry_1 \ 49 | -font {helvetica 10} \ 50 | -invalidcommand [namespace code [list _entry_1_invalidcommand]] \ 51 | -justify "center" \ 52 | -textvariable "density_profile::dp_args(selection)" \ 53 | -validatecommand [namespace code [list _entry_1_validatecommand]] \ 54 | -xscrollcommand [namespace code [list _entry_1_xscrollcommand]]] 55 | variable _label_6 [label $BASE._label_6 \ 56 | -font {helvetica 10 bold} \ 57 | -text "VMD Density Profile Tool"] 58 | variable _radiobutton_2 [radiobutton $BASE._radiobutton_2 \ 59 | -command [namespace code [list _radiobutton_2_command]] \ 60 | -font {helvetica 10} \ 61 | -text "x" \ 62 | -value "x" \ 63 | -variable "density_profile::dp_args(axis)"] 64 | variable _radiobutton_3 [radiobutton $BASE._radiobutton_3 \ 65 | -command [namespace code [list _radiobutton_3_command]] \ 66 | -font {helvetica 10} \ 67 | -text "y" \ 68 | -value "y" \ 69 | -variable "density_profile::dp_args(axis)"] 70 | variable _radiobutton_4 [radiobutton $BASE._radiobutton_4 \ 71 | -command [namespace code [list _radiobutton_4_command]] \ 72 | -font {helvetica 10} \ 73 | -text "z" \ 74 | -value "z" \ 75 | -variable "density_profile::dp_args(axis)"] 76 | variable _entry_2 [entry $BASE._entry_2 \ 77 | -invalidcommand [namespace code [list _entry_2_invalidcommand]] \ 78 | -justify "center" \ 79 | -textvariable "density_profile::dp_args(resolution)" \ 80 | -validatecommand [namespace code [list _entry_2_validatecommand]] \ 81 | -width 8 \ 82 | -xscrollcommand [namespace code [list _entry_2_xscrollcommand]]] 83 | variable radiobutton_Zsource_name [radiobutton $BASE.radiobutton_Zsource_name \ 84 | -command [namespace code [list radiobutton_Zsource_name_command]] \ 85 | -font {helvetica 10} \ 86 | -state "disabled" \ 87 | -text "name" \ 88 | -value "name" \ 89 | -variable "density_profile::dp_args(Zsource)"] 90 | variable radiobutton_Zsource_type [radiobutton $BASE.radiobutton_Zsource_type \ 91 | -command [namespace code [list radiobutton_Zsource_type_command]] \ 92 | -font {helvetica 10} \ 93 | -state "disabled" \ 94 | -text "type" \ 95 | -value "type" \ 96 | -variable "density_profile::dp_args(Zsource)"] 97 | variable radiobutton_Zsource_element [radiobutton $BASE.radiobutton_Zsource_element \ 98 | -command [namespace code [list radiobutton_Zsource_element_command]] \ 99 | -font {helvetica 10} \ 100 | -state "disabled" \ 101 | -text "element" \ 102 | -value "element" \ 103 | -variable "density_profile::dp_args(Zsource)"] 104 | variable _label_7 [label $BASE._label_7 \ 105 | -font {helvetica 10} \ 106 | -text "Density profile of"] 107 | variable radiobutton_mass [radiobutton $BASE.radiobutton_mass \ 108 | -command [namespace code [list radiobutton_mass_command]] \ 109 | -font {helvetica 10} \ 110 | -text "mass" \ 111 | -value "mass" \ 112 | -variable "density_profile::dp_args(rho)"] 113 | variable radiobutton_charge [radiobutton $BASE.radiobutton_charge \ 114 | -command [namespace code [list radiobutton_charge_command]] \ 115 | -font {helvetica 10} \ 116 | -text "charge" \ 117 | -value "charge" \ 118 | -variable "density_profile::dp_args(rho)"] 119 | variable radiobutton_electrons [radiobutton $BASE.radiobutton_electrons \ 120 | -command [namespace code [list radiobutton_electrons_command]] \ 121 | -font {helvetica 10} \ 122 | -text "electrons" \ 123 | -value "electrons" \ 124 | -variable "density_profile::dp_args(rho)"] 125 | variable plot [button $BASE.plot \ 126 | -command [namespace code [list plot_command]] \ 127 | -font {helvetica 10 bold} \ 128 | -text "Plot"] 129 | variable close [button $BASE.close \ 130 | -command [namespace code [list close_command]] \ 131 | -font {helvetica 10 bold} \ 132 | -text "Close"] 133 | variable radiobutton_atoms [radiobutton $BASE.radiobutton_atoms \ 134 | -command [namespace code [list radiobutton_atoms_command]] \ 135 | -font {helvetica 10} \ 136 | -text "number" \ 137 | -value "number" \ 138 | -variable "density_profile::dp_args(rho)"] 139 | variable checkbox_Zsource_partial [checkbutton $BASE.checkbox_Zsource_partial \ 140 | -command [namespace code [list checkbox_Zsource_partial_command]] \ 141 | -font {helvetica 10} \ 142 | -state "disabled" \ 143 | -text "Consider partial charges" \ 144 | -variable "density_profile::dp_args(partial_charges)"] 145 | variable _label_4 [label $BASE._label_4 \ 146 | -font {helvetica 10} \ 147 | -pady 6 \ 148 | -text "Computes 1-D projections of various atomic densities. The computation is performed in a single frame, a trajectory, or averaged over multiple frames." \ 149 | -wraplength 400] 150 | variable _label_8 [label $BASE._label_8 \ 151 | -font {helvetica 10} \ 152 | -text "Frames from"] 153 | variable _label_9 [label $BASE._label_9 \ 154 | -font {helvetica 10} \ 155 | -text "First"] 156 | variable _entry_3 [entry $BASE._entry_3 \ 157 | -invalidcommand [namespace code [list _entry_3_invalidcommand]] \ 158 | -justify "center" \ 159 | -textvariable "density_profile::dp_args(frame_from)" \ 160 | -validatecommand [namespace code [list _entry_3_validatecommand]] \ 161 | -width 8 \ 162 | -xscrollcommand [namespace code [list _entry_3_xscrollcommand]]] 163 | variable _label_10 [label $BASE._label_10 \ 164 | -font {helvetica 10} \ 165 | -text " to"] 166 | variable _checkbutton_2 [checkbutton $BASE._checkbutton_2 \ 167 | -command [namespace code [list _checkbutton_2_command]] \ 168 | -font {helvetica 10} \ 169 | -text "Average" \ 170 | -variable "density_profile::dp_args(average)"] 171 | variable _entry_4 [entry $BASE._entry_4 \ 172 | -invalidcommand [namespace code [list _entry_4_invalidcommand]] \ 173 | -justify "center" \ 174 | -textvariable "density_profile::dp_args(frame_to)" \ 175 | -validatecommand [namespace code [list _entry_4_validatecommand]] \ 176 | -width 8 \ 177 | -xscrollcommand [namespace code [list _entry_4_xscrollcommand]]] 178 | variable _label_11 [label $BASE._label_11 \ 179 | -font {helvetica 10} \ 180 | -text " step"] 181 | variable _entry_5 [entry $BASE._entry_5 \ 182 | -invalidcommand [namespace code [list _entry_5_invalidcommand]] \ 183 | -justify "center" \ 184 | -textvariable "density_profile::dp_args(frame_step)" \ 185 | -validatecommand [namespace code [list _entry_5_validatecommand]] \ 186 | -width 8 \ 187 | -xscrollcommand [namespace code [list _entry_5_xscrollcommand]]] 188 | variable _label_12 [label $BASE._label_12 \ 189 | -font {helvetica 10} \ 190 | -pady 6 \ 191 | -text "See console for information and data files"] 192 | variable help [button $BASE.help \ 193 | -bitmap "questhead" \ 194 | -command [namespace code [list help_command]] \ 195 | -font {helvetica 10 bold} \ 196 | -text "?"] 197 | variable radiobutton_Zsource_mass [radiobutton $BASE.radiobutton_Zsource_mass \ 198 | -command [namespace code [list radiobutton_Zsource_mass_command]] \ 199 | -font {helvetica 10} \ 200 | -state "disabled" \ 201 | -text "mass" \ 202 | -value "mass" \ 203 | -variable "density_profile::dp_args(Zsource)"] 204 | variable menu [menu $BASE.menu] 205 | variable menuitem1 [menu $BASE.menuitem1 \ 206 | -tearoff 0] 207 | $BASE.menu add cascade \ 208 | -label "Help" \ 209 | -menu $BASE.menuitem1 210 | $BASE.menuitem1 add command \ 211 | -command "density_profile_gui::help_docs" \ 212 | -label "Documentation..." 213 | $BASE.menuitem1 add command \ 214 | -command "density_profile_gui::help_about" \ 215 | -label "About..." 216 | 217 | 218 | # Geometry Management 219 | 220 | grid $BASE._frame_1 -in $root -row 5 -column 2 \ 221 | -columnspan 1 \ 222 | -ipadx 0 \ 223 | -ipady 0 \ 224 | -padx 0 \ 225 | -pady 0 \ 226 | -rowspan 1 \ 227 | -sticky "w" 228 | grid $BASE.frame_Zsource -in $root -row 6 -column 2 \ 229 | -columnspan 1 \ 230 | -ipadx 0 \ 231 | -ipady 0 \ 232 | -padx 0 \ 233 | -pady 0 \ 234 | -rowspan 1 \ 235 | -sticky "w" 236 | grid $BASE._frame_3 -in $root -row 3 -column 2 \ 237 | -columnspan 1 \ 238 | -ipadx 0 \ 239 | -ipady 0 \ 240 | -padx 0 \ 241 | -pady 0 \ 242 | -rowspan 1 \ 243 | -sticky "w" 244 | grid $BASE._frame_4 -in $root -row 9 -column 1 \ 245 | -columnspan 2 \ 246 | -ipadx 0 \ 247 | -ipady 0 \ 248 | -padx 0 \ 249 | -pady 0 \ 250 | -rowspan 1 \ 251 | -sticky "news" 252 | grid $BASE._frame_5 -in $root -row 7 -column 2 \ 253 | -columnspan 1 \ 254 | -ipadx 0 \ 255 | -ipady 0 \ 256 | -padx 0 \ 257 | -pady 0 \ 258 | -rowspan 1 \ 259 | -sticky "ew" 260 | grid $BASE._label_1 -in $root -row 4 -column 1 \ 261 | -columnspan 1 \ 262 | -ipadx 0 \ 263 | -ipady 0 \ 264 | -padx 0 \ 265 | -pady 0 \ 266 | -rowspan 1 \ 267 | -sticky "e" 268 | grid $BASE._label_2 -in $root -row 5 -column 1 \ 269 | -columnspan 1 \ 270 | -ipadx 0 \ 271 | -ipady 0 \ 272 | -padx 0 \ 273 | -pady 0 \ 274 | -rowspan 1 \ 275 | -sticky "e" 276 | grid $BASE._label_3 -in $base._frame_1 -row 1 -column 4 \ 277 | -columnspan 1 \ 278 | -ipadx 0 \ 279 | -ipady 0 \ 280 | -padx 0 \ 281 | -pady 0 \ 282 | -rowspan 1 \ 283 | -sticky "e" 284 | grid $BASE._label_5 -in $root -row 6 -column 1 \ 285 | -columnspan 1 \ 286 | -ipadx 0 \ 287 | -ipady 0 \ 288 | -padx 0 \ 289 | -pady 0 \ 290 | -rowspan 1 \ 291 | -sticky "e" 292 | grid $BASE._entry_1 -in $root -row 4 -column 2 \ 293 | -columnspan 1 \ 294 | -ipadx 0 \ 295 | -ipady 0 \ 296 | -padx 0 \ 297 | -pady 0 \ 298 | -rowspan 1 \ 299 | -sticky "ew" 300 | grid $BASE._label_6 -in $root -row 1 -column 1 \ 301 | -columnspan 2 \ 302 | -ipadx 0 \ 303 | -ipady 0 \ 304 | -padx 0 \ 305 | -pady 0 \ 306 | -rowspan 1 \ 307 | -sticky "s" 308 | grid $BASE._radiobutton_2 -in $base._frame_1 -row 1 -column 1 \ 309 | -columnspan 1 \ 310 | -ipadx 0 \ 311 | -ipady 0 \ 312 | -padx 0 \ 313 | -pady 0 \ 314 | -rowspan 1 \ 315 | -sticky "ew" 316 | grid $BASE._radiobutton_3 -in $base._frame_1 -row 1 -column 2 \ 317 | -columnspan 1 \ 318 | -ipadx 0 \ 319 | -ipady 0 \ 320 | -padx 0 \ 321 | -pady 0 \ 322 | -rowspan 1 \ 323 | -sticky "ew" 324 | grid $BASE._radiobutton_4 -in $base._frame_1 -row 1 -column 3 \ 325 | -columnspan 1 \ 326 | -ipadx 0 \ 327 | -ipady 0 \ 328 | -padx 0 \ 329 | -pady 0 \ 330 | -rowspan 1 \ 331 | -sticky "ew" 332 | grid $BASE._entry_2 -in $base._frame_1 -row 1 -column 5 \ 333 | -columnspan 1 \ 334 | -ipadx 0 \ 335 | -ipady 0 \ 336 | -padx 0 \ 337 | -pady 0 \ 338 | -rowspan 1 \ 339 | -sticky "ew" 340 | grid $BASE.radiobutton_Zsource_name -in $base.frame_Zsource -row 1 -column 3 \ 341 | -columnspan 1 \ 342 | -ipadx 0 \ 343 | -ipady 0 \ 344 | -padx 0 \ 345 | -pady 0 \ 346 | -rowspan 1 \ 347 | -sticky "" 348 | grid $BASE.radiobutton_Zsource_type -in $base.frame_Zsource -row 1 -column 4 \ 349 | -columnspan 1 \ 350 | -ipadx 0 \ 351 | -ipady 0 \ 352 | -padx 0 \ 353 | -pady 0 \ 354 | -rowspan 1 \ 355 | -sticky "" 356 | grid $BASE.radiobutton_Zsource_element -in $base.frame_Zsource -row 1 -column 2 \ 357 | -columnspan 1 \ 358 | -ipadx 0 \ 359 | -ipady 0 \ 360 | -padx 0 \ 361 | -pady 0 \ 362 | -rowspan 1 \ 363 | -sticky "" 364 | grid $BASE._label_7 -in $root -row 3 -column 1 \ 365 | -columnspan 1 \ 366 | -ipadx 0 \ 367 | -ipady 0 \ 368 | -padx 0 \ 369 | -pady 0 \ 370 | -rowspan 1 \ 371 | -sticky "e" 372 | grid $BASE.radiobutton_mass -in $base._frame_3 -row 1 -column 2 \ 373 | -columnspan 1 \ 374 | -ipadx 0 \ 375 | -ipady 0 \ 376 | -padx 0 \ 377 | -pady 0 \ 378 | -rowspan 1 \ 379 | -sticky "" 380 | grid $BASE.radiobutton_charge -in $base._frame_3 -row 1 -column 3 \ 381 | -columnspan 1 \ 382 | -ipadx 0 \ 383 | -ipady 0 \ 384 | -padx 0 \ 385 | -pady 0 \ 386 | -rowspan 1 \ 387 | -sticky "" 388 | grid $BASE.radiobutton_electrons -in $base._frame_3 -row 1 -column 4 \ 389 | -columnspan 1 \ 390 | -ipadx 0 \ 391 | -ipady 0 \ 392 | -padx 0 \ 393 | -pady 0 \ 394 | -rowspan 1 \ 395 | -sticky "" 396 | grid $BASE.plot -in $base._frame_4 -row 1 -column 2 \ 397 | -columnspan 1 \ 398 | -ipadx 0 \ 399 | -ipady 0 \ 400 | -padx 0 \ 401 | -pady 0 \ 402 | -rowspan 1 \ 403 | -sticky "nsew" 404 | grid $BASE.close -in $base._frame_4 -row 1 -column 3 \ 405 | -columnspan 1 \ 406 | -ipadx 0 \ 407 | -ipady 0 \ 408 | -padx 0 \ 409 | -pady 0 \ 410 | -rowspan 1 \ 411 | -sticky "nsew" 412 | grid $BASE.radiobutton_atoms -in $base._frame_3 -row 1 -column 1 \ 413 | -columnspan 1 \ 414 | -ipadx 0 \ 415 | -ipady 0 \ 416 | -padx 0 \ 417 | -pady 0 \ 418 | -rowspan 1 \ 419 | -sticky "" 420 | grid $BASE.checkbox_Zsource_partial -in $base.frame_Zsource -row 1 -column 5 \ 421 | -columnspan 1 \ 422 | -ipadx 0 \ 423 | -ipady 0 \ 424 | -padx 0 \ 425 | -pady 0 \ 426 | -rowspan 1 \ 427 | -sticky "w" 428 | grid $BASE._label_4 -in $root -row 2 -column 1 \ 429 | -columnspan 2 \ 430 | -ipadx 0 \ 431 | -ipady 0 \ 432 | -padx 0 \ 433 | -pady 0 \ 434 | -rowspan 1 \ 435 | -sticky "nsew" 436 | grid $BASE._label_8 -in $root -row 7 -column 1 \ 437 | -columnspan 1 \ 438 | -ipadx 0 \ 439 | -ipady 0 \ 440 | -padx 0 \ 441 | -pady 0 \ 442 | -rowspan 1 \ 443 | -sticky "e" 444 | grid $BASE._label_9 -in $base._frame_5 -row 1 -column 1 \ 445 | -columnspan 1 \ 446 | -ipadx 0 \ 447 | -ipady 0 \ 448 | -padx 0 \ 449 | -pady 0 \ 450 | -rowspan 1 \ 451 | -sticky "" 452 | grid $BASE._entry_3 -in $base._frame_5 -row 1 -column 1 \ 453 | -columnspan 1 \ 454 | -ipadx 0 \ 455 | -ipady 0 \ 456 | -padx 0 \ 457 | -pady 0 \ 458 | -rowspan 1 \ 459 | -sticky "ew" 460 | grid $BASE._label_10 -in $base._frame_5 -row 1 -column 2 \ 461 | -columnspan 1 \ 462 | -ipadx 0 \ 463 | -ipady 0 \ 464 | -padx 0 \ 465 | -pady 0 \ 466 | -rowspan 1 \ 467 | -sticky "e" 468 | grid $BASE._checkbutton_2 -in $base._frame_5 -row 1 -column 6 \ 469 | -columnspan 1 \ 470 | -ipadx 0 \ 471 | -ipady 0 \ 472 | -padx 0 \ 473 | -pady 0 \ 474 | -rowspan 1 \ 475 | -sticky "e" 476 | grid $BASE._entry_4 -in $base._frame_5 -row 1 -column 3 \ 477 | -columnspan 1 \ 478 | -ipadx 0 \ 479 | -ipady 0 \ 480 | -padx 0 \ 481 | -pady 0 \ 482 | -rowspan 1 \ 483 | -sticky "ew" 484 | grid $BASE._label_11 -in $base._frame_5 -row 1 -column 4 \ 485 | -columnspan 1 \ 486 | -ipadx 0 \ 487 | -ipady 0 \ 488 | -padx 0 \ 489 | -pady 0 \ 490 | -rowspan 1 \ 491 | -sticky "e" 492 | grid $BASE._entry_5 -in $base._frame_5 -row 1 -column 5 \ 493 | -columnspan 1 \ 494 | -ipadx 0 \ 495 | -ipady 0 \ 496 | -padx 0 \ 497 | -pady 0 \ 498 | -rowspan 1 \ 499 | -sticky "ew" 500 | grid $BASE._label_12 -in $root -row 8 -column 1 \ 501 | -columnspan 2 \ 502 | -ipadx 0 \ 503 | -ipady 0 \ 504 | -padx 0 \ 505 | -pady 0 \ 506 | -rowspan 1 \ 507 | -sticky "" 508 | grid $BASE.help -in $base._frame_4 -row 1 -column 1 \ 509 | -columnspan 1 \ 510 | -ipadx 0 \ 511 | -ipady 0 \ 512 | -padx 0 \ 513 | -pady 0 \ 514 | -rowspan 1 \ 515 | -sticky "nsew" 516 | grid $BASE.radiobutton_Zsource_mass -in $base.frame_Zsource -row 1 -column 1 \ 517 | -columnspan 1 \ 518 | -ipadx 0 \ 519 | -ipady 0 \ 520 | -padx 0 \ 521 | -pady 0 \ 522 | -rowspan 1 \ 523 | -sticky "" 524 | 525 | # Resize Behavior 526 | grid rowconfigure $root 1 -weight 0 -minsize 17 -pad 0 527 | grid rowconfigure $root 2 -weight 1 -minsize 44 -pad 0 528 | grid rowconfigure $root 3 -weight 0 -minsize 40 -pad 0 529 | grid rowconfigure $root 4 -weight 0 -minsize 38 -pad 0 530 | grid rowconfigure $root 5 -weight 0 -minsize 48 -pad 0 531 | grid rowconfigure $root 6 -weight 0 -minsize 40 -pad 0 532 | grid rowconfigure $root 7 -weight 0 -minsize 45 -pad 0 533 | grid rowconfigure $root 8 -weight 0 -minsize 2 -pad 0 534 | grid rowconfigure $root 9 -weight 0 -minsize 27 -pad 0 535 | grid columnconfigure $root 1 -weight 0 -minsize 40 -pad 0 536 | grid columnconfigure $root 2 -weight 1 -minsize 119 -pad 0 537 | grid rowconfigure $base._frame_1 1 -weight 0 -minsize 7 -pad 0 538 | grid columnconfigure $base._frame_1 1 -weight 0 -minsize 40 -pad 0 539 | grid columnconfigure $base._frame_1 2 -weight 0 -minsize 40 -pad 0 540 | grid columnconfigure $base._frame_1 3 -weight 0 -minsize 40 -pad 0 541 | grid columnconfigure $base._frame_1 4 -weight 0 -minsize 40 -pad 0 542 | grid columnconfigure $base._frame_1 5 -weight 0 -minsize 40 -pad 0 543 | grid rowconfigure $base.frame_Zsource 1 -weight 0 -minsize 16 -pad 0 544 | grid columnconfigure $base.frame_Zsource 1 -weight 0 -minsize 40 -pad 0 545 | grid columnconfigure $base.frame_Zsource 2 -weight 0 -minsize 40 -pad 0 546 | grid columnconfigure $base.frame_Zsource 3 -weight 0 -minsize 40 -pad 0 547 | grid columnconfigure $base.frame_Zsource 4 -weight 0 -minsize 40 -pad 0 548 | grid columnconfigure $base.frame_Zsource 5 -weight 0 -minsize 40 -pad 0 549 | grid rowconfigure $base._frame_3 1 -weight 0 -minsize 15 -pad 0 550 | grid columnconfigure $base._frame_3 1 -weight 0 -minsize 40 -pad 0 551 | grid columnconfigure $base._frame_3 2 -weight 0 -minsize 40 -pad 0 552 | grid columnconfigure $base._frame_3 3 -weight 0 -minsize 40 -pad 0 553 | grid columnconfigure $base._frame_3 4 -weight 0 -minsize 40 -pad 0 554 | grid rowconfigure $base._frame_4 1 -weight 0 -minsize 10 -pad 0 555 | grid columnconfigure $base._frame_4 1 -weight 0 -minsize 40 -pad 0 556 | grid columnconfigure $base._frame_4 2 -weight 1 -minsize 40 -pad 0 557 | grid columnconfigure $base._frame_4 3 -weight 1 -minsize 40 -pad 0 558 | grid rowconfigure $base._frame_5 1 -weight 0 -minsize 2 -pad 0 559 | grid columnconfigure $base._frame_5 1 -weight 1 -minsize 40 -pad 0 560 | grid columnconfigure $base._frame_5 2 -weight 0 -minsize 24 -pad 0 561 | grid columnconfigure $base._frame_5 3 -weight 1 -minsize 40 -pad 0 562 | grid columnconfigure $base._frame_5 4 -weight 0 -minsize 27 -pad 0 563 | grid columnconfigure $base._frame_5 5 -weight 1 -minsize 40 -pad 0 564 | grid columnconfigure $base._frame_5 6 -weight 0 -minsize 78 -pad 0 565 | $ROOT configure -menu $BASE.menu 566 | } 567 | -------------------------------------------------------------------------------- /doc/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-02-02 Toni 2 | 3 | * 1.3 Moved docs 4 | 5 | 2014-06-11 Toni 6 | 7 | * 1.2 Moved to GitHub 8 | 9 | 2013-08-09 Toni <...@...> 10 | 11 | * 1.1 Added support for variable cell sizes 12 | 13 | 2013-05-13 Toni <...@...> 14 | 15 | * 1.0 Initial release 16 | 17 | -------------------------------------------------------------------------------- /doc/NOTE.txt.private: -------------------------------------------------------------------------------- 1 | ::MultiPlot::Plot5::plothandle configure -hline {.333 -dash "." -fill blue} -plot 2 | 3 | 4 | export TCLLIBPATH=$PWD 5 | 6 | 7 | 8 | 9 | structure of a split plugin 10 | 11 | package provide chirality_gui 1.1 12 | namespace eval ::chirality::GUI:: { 13 | proc chirality_gui { } { return [eval ::chirality::GUI::chirality_gui] } 14 | 15 | 16 | ... 17 | 18 | package provide chirality 1.1 19 | namespace eval ::chirality:: { 20 | 21 | 22 | CHIRALITY 23 | Core Gui 24 | namespace ::what:: ::what::GUI:: 25 | package what what_gui 26 | filename what.tcl what_gui.tcl 27 | 28 | MINE 29 | Core Gui 30 | namespace ::what:: ::what:: 31 | package what what_gui (free) 32 | filename what_core.tcl what.tcl (= namespace) 33 | 34 | 35 | 36 | Guibuilder uses the namespace (first level) given as file name 37 | 38 | Saving as nnn::mmm works, but may create problems in windows 39 | 40 | Solution: do not use sub-namespace, but make a different package 41 | 42 | 43 | -------------------------------------------------------------------------------- /doc/POPC-e-density-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_density_profile/4f3861a66935475add76642d46cbd812438ec502/doc/POPC-e-density-profile.png -------------------------------------------------------------------------------- /doc/POPC-waters-mass-density-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_density_profile/4f3861a66935475add76642d46cbd812438ec502/doc/POPC-waters-mass-density-profile.png -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | VMD Density Profile Tool (1.3) 2 | ============================== 3 | 4 | 5 | The *Density Profile Tool* is a VMD analysis plugin that computes 1-D projections of various atomic densities. The computation can be performed in a single frame, a trajectory, or averaged over multiple frames. 6 | 7 | - Atomic (number) density, i.e. average number of atoms 8 | 9 | - Mass density 10 | 11 | - Charge density 12 | 13 | - Electron density, i.e. number density of electrons. 14 | 15 | This tool is fully described in the reference given below. This page serves only as a quick-reference. 16 | 17 | 18 | 19 | 20 | 21 | Installation 22 | ---------------------------------------- 23 | 24 | See instructions [here](https://gist.github.com/tonigi/a9cfaf7642a7fbc13293). 25 | 26 | 27 | **NOTE: This code comes without any warranty of fitness for any use. It is UNSUPPORTED. After you download it, you are on your own.** By downloading the software you agree to comply with the terms of the 28 | 3-clause BSD license. 29 | 30 | 31 | You may or may not be able to get support by posting to the [External tools](https://sourceforge.net/p/membplugin/discussion/external_tools/) forum hosted at the [MEMBPLUGIN](http://membplugin.sourceforge.net) site. 32 | 33 | 34 | 35 | Citation 36 | -------- 37 | 38 | Please cite the following publication: 39 | 40 | - Toni Giorgino, Computing 1-D atomic densities in macromolecular simulations: the Density Profile Tool for VMD, *Computer Physics Communications* Volume 185, Issue 1, January 2014, Pages 317–322, [doi:10.1016/j.cpc.2013.08.022](http://dx.doi.org/10.1016/j.cpc.2013.08.022) – [arXiv:1308.5873](http://arxiv.org/abs/1308.5873) 41 | 42 | Usage (GUI) 43 | ----------- 44 | 45 | The plugin is accessible from VMD in *Extensions \> Analysis \> Density Profile Tool*. By default, the profile is computed for the current frame in the *top* molecule. For mass and charge computation, a topology file must be loaded. 46 | 47 | When dealing with a trajectory, the behaviour depends on the *average* check box: if selected, density profiles for all of the frames will be plotted; otherwise, the average plus or minus the standard deviation will be displayed. 48 | 49 | If periodic cell information is available in the molecule (e.g. as set in *pbctools*), the density will be properly normalized with respect to the volume. Otherwise, it will be simply projected along a linear axis. **IMPORTANT: you will still need to wrap the trajectory yourself.** 50 | 51 | *Electron density* calculations require the atomic number *Z* (i.e., the element) to be known for each atom. This information may be obtained from either the *mass*, *name*, *type*, or *element* atom properties (see VMD manual). Selecting ***mass* is highly recommended** because *element* is usually unset, and guessing from *type* or *name* requires error-prone heuristics. Atomic number guessing is based on the [topotools guessatom](http://www.ks.uiuc.edu/Research/vmd/plugins/topotools/#TOC-guessatom-property-from-) function and algorithm. Note that the heuristics will likely be inappropriate in the case of united atom/coarse grain forcefields. 52 | 53 | 54 | ![Screenshot](Screenshot-Density%20Profile%20Tool.png) 55 | 56 | 57 | Usage (command line) 58 | -------------------- 59 | 60 | A command line interface is available to perform the same calculations as the GUI. See help with 61 | 62 | vmd > package require density_profile 63 | vmd > density_profile 64 | 65 | Usage: density_profile 66 | Args (with defaults): 67 | -rho electrons 68 | -selection name P11 69 | -axis z 70 | -resolution 1 71 | -Zsource type 72 | -partial_charges 1 73 | -frame_from 0 74 | -frame_to 130 75 | -frame_step 1 76 | -average 1 77 | 78 | Where `-rho` is one of *number, mass, charge* or *electrons*. In the latter case, `-Zsource` must be one of *mass, element, name, type*. The function returns two lists: 79 | 80 | - The **lower coordinate** of each bin, i.e. a list of bin breaks. 81 | 82 | - A list of **densities for each bin**. Each element of the list is 83 | 84 | - a single value, if only one frame is selected, or *average* is 1 85 | 86 | - a list of density values, one for each of the frames computed 87 | 88 | **IMPORTANT: when used on the command line, bin BREAKS are returned. When plotting, dots are placed in bin CENTERS.** 89 | 90 | Units 91 | ----- 92 | 93 | Assuming that periodic box information is available, results are given in the following units: 94 | 95 | - Atomic density: atoms/Å3 96 | 97 | - Mass density: amu/Å3=Da/Å3 98 | 99 | - Charge density: e/Å3 100 | 101 | - Electron density: electrons/Å3 102 | 103 | **Unit conversions:** 104 | 105 | - in moles per liter, multiply by 1661 ų mol/l (or the value appropriate at your temperature) 106 | 107 | - 1 amu/Å3 = 1.66 g/cm3 = 1660 kg/m3 108 | 109 | 110 | 111 | Example 112 | ------- 113 | 114 | See attached screenshots. 115 | 116 | Solvent density profile around a POPC membrane. Note how the water density in bulk goes to the macroscopic value of 18/30 amu/ų. 117 | 118 | ![attachment:POPC-waters-mass-density-profile.png](POPC-waters-mass-density-profile.png) 119 | 120 | 121 | Electron density profile of a POPC membrane (solvent included). 122 | 123 | ![attachment:POPC-e-density-profile.png](POPC-e-density-profile.png) 124 | 125 | 126 | 127 | Limitations 128 | ----------- 129 | 130 | - Atoms are assumed as point-like; 131 | 132 | - only orthorhombic cells are supported; 133 | 134 | - to compute volumetric densities, cell information must be present for *all* frames. 135 | 136 | 137 | 138 | 139 | 140 | Acknowledgments 141 | --------------- 142 | 143 | Former support from the Agència de Gestió d'Ajuts Universitaris i de Recerca - Generalitat de Catalunya is gratefully acknowledged. 144 | 145 | -------------------------------------------------------------------------------- /doc/Screenshot-Density Profile Tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_density_profile/4f3861a66935475add76642d46cbd812438ec502/doc/Screenshot-Density Profile Tool.png -------------------------------------------------------------------------------- /examples/Readme.md: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | 4 | This directory contains miscellaneous examples for the Density Profile tool. 5 | 6 | File | Description 7 | ----------- | ---------------- 8 | example.tcl | Downloads and computes various profiles on Klauda's *popc72-c36npt* simulations. 9 | popc/ | A few ns of a trivial POPC simulation 10 | 11 | Data for the paper *Computing 1-D atomic densities in macromolecular simulations: The density profile tool for VMD* are available on request. 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/example.tcl: -------------------------------------------------------------------------------- 1 | # Test script for the Density Profile Plugin 2 | 3 | # The script can also be used from the GUI (VMD Main 4 | # window->Extensions->Analysis->Density Profile Tool). This script 5 | # only illustrates the command-line interface. 6 | 7 | 8 | 9 | # Initialization: load Klauda's equilibrated membranes, 10 | # http://terpconnect.umd.edu/~jbklauda/research/download.html POPC 11 | # Bilayer (303.00K, NPT, 35ns, 72 lipids): PDB, CHARMM PSF, CHARMM36 12 | # Current directory needs be writable. 13 | 14 | mol delete all 15 | vmd_mol_urlload http://terpconnect.umd.edu/~jbklauda/research/download/popc72-c36npt.pdb popc72-c36npt.pdb 16 | vmd_mol_urlload http://terpconnect.umd.edu/~jbklauda/research/download/popc72-c36npt.psf popc72-c36npt.psf 17 | mol new popc72-c36npt.psf waitfor all 18 | mol addfile popc72-c36npt.pdb waitfor all 19 | pbc set { 48.4331 48.4331 66.913 }; # Set box size 20 | 21 | 22 | # Define a convenience function to pretty-print two lists 23 | proc pptable {l1 l2} { foreach i1 $l1 i2 $l2 { puts " [format %6.2f $i1]\t[format %6.2f $i2]" } } 24 | 25 | 26 | 27 | # Begin analysis 28 | 29 | # - Load package 30 | package require density_profile 31 | 32 | # - Compute mass density for water molecules only 33 | set wdens [density_profile -rho mass -selection water] 34 | 35 | # - In $wdens we now have 36 | # index 0: list of densities [g/mol/A^3]: from 0 (center) to ~0.6 (bulk) 37 | # index 1: list of bin breaks [A]: -35, -34, ... 34 38 | 39 | # - Show output as a table 40 | puts "**************************************************" 41 | puts "| Bin breaks coordinates: (z, Angstroms)" 42 | puts "\t| Density of water in each bin: (g/mol/A^3)" 43 | pptable [lindex $wdens 1] [lindex $wdens 0] 44 | 45 | 46 | # - The same as plots (assume you have a graphics terminal) 47 | multiplot -x [lindex $wdens 1] -y [lindex $wdens 0] -marker point -plot \ 48 | -title "Water mass density (g/mol/A^3); dots: bulk value" \ 49 | -xlabel "Distance from membrane center z (A)" \ 50 | -hline {0.6 -dash .} 51 | 52 | 53 | 54 | # - Compute the electron density of full system (small membrane, only 55 | # one frame: lower resolution); show graphically. 56 | set edens [density_profile -rho electrons -selection all -resolution 2] 57 | multiplot -x [lindex $edens 1] -y [lindex $edens 0] -marker point -plot \ 58 | -title "Electron density (1/A^3); dots: value for bulk water" \ 59 | -xlabel "Distance from membrane center z (A)" \ 60 | -hline {0.33 -dash .} 61 | 62 | -------------------------------------------------------------------------------- /examples/popc/popc_box.xtc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giorginolab/vmd_density_profile/4f3861a66935475add76642d46cbd812438ec502/examples/popc/popc_box.xtc -------------------------------------------------------------------------------- /load.tcl: -------------------------------------------------------------------------------- 1 | set density_profile_dir [file dirname [file normalize [info script]]] 2 | 3 | puts "density_profile) Adding directory $density_profile_dir to auto_path and registering the menu" 4 | 5 | lappend auto_path $density_profile_dir 6 | package require density_profile_gui 7 | ::density_profile_gui::register_menu 8 | -------------------------------------------------------------------------------- /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 | 12 | package ifneeded density_profile 1.1 [list source [file join $dir density_profile.tcl]] 13 | package ifneeded density_profile_gui 1.1 [list source [file join $dir density_profile_gui.tcl]] 14 | 15 | # Piggy-back the pkgIndex mechanism to register in extension menu (only once) 16 | catch { package require density_profile_gui; density_profile_gui::register_menu; } 17 | 18 | --------------------------------------------------------------------------------