(1) PBC wrap:
Not these:
# pbc wrap -center com -centersel "[atomselect top index $idx1]"
-first $iframe -last $iframe
# pbc wrap -center com -centersel "$sel1" -first $iframe -last $iframe
But this:
# pbc wrap -center com -centersel "index $idx1"
-first $iframe -last $iframe
(2) To rotate a group of atoms (g1) about a bond between the centers mass
of two groups of atoms (g2 and g3) by 'theta' degrees:
set g1 [atomselect top "serial 388 389 391 392 396 397 398 400 401"]
set g2 [atomselect top "serial 379 380 385 386 402 404 407"]
set g3 [atomselect top "serial 411 412 415 417 418 434 436 439"]
set coor1 [measure center $g1 weight mass]
set coor2 [measure center $g2 weight mass]
set coor3 [measure center $g3 weight mass]
$g1 move [trans bond $coor2 $coor3 theta deg]
(3) To get the minimum and maximum values of x, y, z coordinates of a
given set of atoms:
set mmx [measure minmax [atomselect top all]]
set xmin [lindex $mmx 0 0]
set ymin [lindex $mmx 0 1]
set zmin [lindex $mmx 0 2]
set xmax [lindex $mmx 1 0]
set ymax [lindex $mmx 1 1]
set zmax [lindex $mmx 1 2]
To get the dimensions of a rectangular bounding box circumscribing
this set of atoms:
vecsub [lindex $mmx 1] [lindex $mmx 0]
(4) To open/write/close a file, the name of which contains a common
string and a variable:
option 1 (best!):
open:
set fname z_time_series_sodium_${idx2}.dat
set output_file_${idx2} [open "$fname" w]
write:
puts [expr \$output_file_$idx2] "$tz"
close:
close output_file_${idx2}
option 2:
open:
set fname [join "z_time_series_sodium_ $idx2 .dat" ""]
set [join "output_file_ $idx2" ""] [open "$fname" w]
write:
puts [expr \$[join "output_file_ $idx2" ""]] "$tz"
close:
close [join "output_file_ $idx2" ""]
(5) To select a complete fragment or residue in which at least one atom satisfies a given set of conditions:
Option: same <keyword> as <atomselection> in the atomselect command
please refer: http://www.ks.uiuc.edu/Research/vmd/vmd-1.3/ug/node142.html
example:
- set sel [atomselect top "same residue as (name OH2 and (sqr(x)+sqr(y)+sqr(z)) <= $r2)"]
- set waterdrop [atomselect top "same fragment as (name OH2 and (sqr(x)+sqr(y)+sqr(z)) <= $r2)"]
(6) To print log information on the console:
- open Tk console
- type: logfile /dev/tty (to print on the screen)
(or) type: logfile filename (to print on a logfile)
(7) arguments in vmd tcl:
vmd -dispdev text < vmd_select.tcl -args argument0 argument1 argument2
(here < is used for auto-exit)
set ifile [lindex $argv 0]
set rangle [lindex $argv 1]
set ofile [lindex $argv 2]
(8) To load an xtc trajectory:
mol load pdb file.pdb xtc traj.xtc
(9) serial = index + 1
(10) To load a selected number of frames in a dcd file:
mol load psf filename.psf
mol addfile filename.dcd first 1 last 100
(11) To create a vmd logfile: (you need to type these commands in tcl/tk console)
logfile filename (log is stored in a file named "filename")
logfile off (to turn off logging)
logfile /dev/tty (to print the log information on the console)