Scripting In VMD With Tcl - Huji.ac.il

2y ago
123 Views
5 Downloads
508.54 KB
24 Pages
Last View : 27d ago
Last Download : 3m ago
Upload by : Wren Viola
Transcription

Scripting in VMD with tcl My email: shaharsu@gmail.com1

VMD becomes ultra powerful withscripts!!! VMD has many useful options But usually we will require a very specificanalysis OR we don’t trust what VMD gives us. The solution – DIY with a tcl script2

About tcl A simple, easy to use scripting language Available also as a shell (tclsh) Many good tutorials and resources availableonline Acess to tcl through the Tk console under“Extensions”3

(Very) short tcl primerAssigning and using variables:set variable value sets the value of the variableputs variable Prints out the vairable.Examples:% set x 10% puts "the value of x is: x"% set text "some text"% puts "the value of text is: text."4

(Very) short tcl primerMathematical expressions:expr [expression]Calculates the expression in the brackets[expr [expression]]Interprets and sends the actual value of theexpression5

(Very) short tcl primerLogicals :if {conditional} {script} elseif{conditional} {script} else {script}Example:% set a 30% if { a 30} {puts “ a is seq 30”}else {puts “ a is larger than 30”}6

(Very) short tcl primerLoops :for {initialization} {conditional}{increment} {commands}Or:foreach variable name list {commands}Example:% For {set i 0} { i 10} {incr i 1} {puts“i is i”}% Set m {0 1 2 3 4 5}% Foreach i m {puts “two times m is [expr i *2]”7

Executing scripts with VMD Calling a script from the tcl/Tk window:% source script file From command line: vmd –dispdev text coordinate file topologyfile script [& log file &]8

VMD-specific tcl commands VMD contains several facilities that extend tcland make working with pdb’s and trajectoriesvery convinient9

atomselect Atomselections saves a list of atoms, with allproperties included, of your selection% atomselect mol # “ selection ” [frame frame # ] selection can be: index, residue, resname, chain,etc. If you need help, or want to know why it isn’tworking - all selections are viewable from the“representation” window, or by typing% Atomselect keywords10

atomselect selections can contain more complexexpressions:same selection as selection within/exwithin distance of selection any combination with logical and, or, notbetween the selections.11

atomselect examples% atomselect top “index 23”% atomselect top “resname TIP3 or index 1 to50” frame 3% atomselect top “same resid as name OHexwithin 5 of chain A” wildcards possible (slight syntax change):% atomselect top {name “[O.*]”}12

Let’s use our atomselect In order to save your selection:set selection name [ atomselect command ] Now we can get some characteristics from ouratomselection selection name function Function list available by typing atomselection 13

Some useful examples%%%%%%set a [atomselect top protein] a frame 11 a get num a get “x y z” a get index a set chain A Remember that all of these results can be putin variables!14

measure Another useful facility that works onatomselect objects or atom indices some useful inmaxrgyrsasaangle/bond/dihed15

molinfo provides various parameters on the entiremolecule. allows to set the frame and other properties.molinfo mol num./top get/set keywords % molinfo top get a% molinfo top get filename% molinfo top get numframes16

Analysis of a sample script This script will measure the end to enddistance of a peptide in a 1 ns trajectory. The peptide is composed of 16 amino-acids,and we will use the Ca of residues 2 and 17 tomeasure the end to end distance. We assume the trajectory has already beenfixed in terms of the periodic boundary (ie,molecules stay whole throughout).17

end-to-end distance12345678910111213set outfile [open e2e.dat w]set n [molinfo top get numframes]for {set i 1} { i n} {incr i} {set a [atomselect top "resid 2 and name CA" frame i]set apos [lindex [ a get "x y z"] 0] a deleteset b [atomselect top "resid 17 and name CA" frame i]set bpos [lindex [ b get "x y z"] 0] b deleteset e2e [vecdist apos bpos]puts " i\t e2e"}close outfile18

Now try it yourself!1. Load hairpin inWater afterEq.psf2. Into this topology load hairpin inWater.dcd.3. Make sure you click the “load all at once”button!4. Click “load”19

Examine the trajectory Take a look at the trajectory. Notice that itcontains a peptide surrounded by a box ofwater The box has PBC, andbonds are extend pastthe boundary!20

Now try it yourself!1. Open the Tk console, and try executing thesample script. (slide 18)2. Look at the output. It should be in twocolumns. One is the frame number, and theother is the end to end distance, in Å.3. Try graphing the result.21

Some tips Tcl is awful for debugging – so put a lot of outputreferences in your script, ie:% puts “Now on line 12”% puts “the value of i is i” Make sure you use the proper brackets /parentheses There is probably more than one way to get theinfo you need, though one maybe much moreefficient.22

On your own! Some ideas:1. Use a tcl script to get information about theavailable trajectory (radius of gyration, sasa,certain bond or dihedral angles). Try tooutput all this data into one tabulated file.2. Count the number of waters in a hydrationlayer 5 A form the peptide surface3. See what residues are within 5 A of residue10 for the entire trajectory23

For advanced users Several scripts are available for download atthe tutorial’s ftp site:1. Self diff.tcl analyzes the self diffusion of thepeptide2. Volumes.tcl gives the volume of an annulusaround the peptide Dealing with probability binning, PBC bordersand other types of problems is simple withtcl. Take a look and try to modify for yourproblems!24

1. Self_diff.tcl analyzes the self diffusion of the peptide 2. Volumes.tcl gives the volume of an annulus around the peptide Dealing with probability binning, PBC borders and other types of problems is simple with tcl

Related Documents:

any Tcl built-in command. See Appendix A, “Basics of Tcl,” for information on Tcl syntax and on the extensions that have been added to the Tcl interpreter. Using Hierarchy Separators in Tcl Commands Many Tcl commands take an object name as an argument. The path

Tcl application. TclPro Wrapper makes it easy to distribute Tcl applications to your users and manage upgrades in Tcl versions. Tcl/Tk 8.2 The latest version of Tcl/Tk is pre-compiled and ready for use. Bundled extensions Several popular Tcl ext

The VMD User's Guide describes how to run and use the molecular visualization and analysis program VMD. This guide documents the user interfaces displaying and grapically manipulating molecules, and describes how to use the scripting interfaces for analysis and to customize the be-havior of VMD.

Cisco IOS Scripting with Tcl How to Configure Cisco IOS Scripting with Tcl 4 Cisco IOS Release 12.3(2)T, 12.3(7)T, 12.2(25)S SNMP MIB Object Access Designed to make access to Simple Network Manageme nt Protocol (SNMP) MIB objects easier, a set of UNIX-like SNMP commands has been created. The Tcl shell is enabled either manually or by using a

Tcl lists, which share the syntax rules of Tcl com-mands, are explained in Chapter 5. Control structure like loops and if statements are described in Chapter 6. Chapter 7 describes Tcl procedures, which are new commands that you write in Tcl. Chapter 8 discusses Tcl arrays. Arrays are the mo

Tcl interpreters from the C code and start feeding them Tcl commands to evaluate. It is also possible to de ne new Tcl commands that when evaluated by the Tcl interpreter call C functions de ned by the user. The tcltklibrary sets up the event loop and initializes a Tcl interpreter

The TCL series is used for service purposes and for different industrial and laboratory tasks. For example, thermometers, temperature switches/thermostats, resistance thermometers and thermo-elements can be directly connected and checked. Versions: The TCL series of calibr

Albert Woodfox is a former Black Panther who spent 45 years unjustly incarcerated in a Louisiana State Penitentiary. He was released in 2016, having served more than 43 years in VROLWDU\ FRQ¿QHPHQW WKH ORQJHVW SHULRG RI VROLWDU\ FRQ¿QHPHQW in American prison history. Kano is a British rapper, songwriter and actor. Kano is one of the pioneers of grime music and culture. In 2004, Kano released .