11.07.2015 Views

VMD User's Guide

VMD User's Guide

VMD User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

vmd> set sel [atomselect top "water"]atomselect3vmd> $sel textwaterThis is equivalent to sayingvmd> atomselect3 textThe easiest way of thinking about this is that the atomselect command creates an object.To get information from the object you have to send it a command. Thus, in the example above(atomselect1 num) the object ”atomselect1” was sent the command ”num”, which asks the objectto return the number of atoms in the selection. These derived object functions (the ones withnames like atomselect3) take many options, as described in section 8.3.2,For instance, given the selectionvmd> set sel [atomselect top "resid 4"]atomselect4you can get the atom names for each of the atoms in the selection withvmd> $sel get nameN H CA CB C O(which, remember, is the same asvmd> atomselect4 get name)Multiple attributes can be requested by submitting a list, so if you want to see which atoms areon the backbone,vmd> $sel get {name backbone}{N 1} {H 0} {CA 1} {CB 0} {C 1} {O 1}and the atom coordinates withvmd> $sel get {x y z}{0.710000 4.211000 1.093000} {-0.026000 3.700000 0.697000} {0.5410004.841000 2.388000} {-0.809000 4.462000 2.976000} {1.591000 4.3710003.381000} {2.212000 5.167000 4.085000}Note that the format of the data you get back from the get command depends on how manyattributes you requested. If you request only one attribute, as in the get name example above, youwill get back a simple list of elements. On the other hand, if you request two or more attributes,you will get back a list of sublists. Specifically, it is a list of size n where each element is itselfa list of size i, wheren is the number of atoms in the selection and i is the number of attributesrequested.Your scripts will run faster if you retrieve only one attribute at a time, because then <strong>VMD</strong>does not have to construct the sublists for each attribute. Remember that in Tcl you can loop overseveral lists at once using the foreach command:157

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!