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.

version (2.2). Thus if you have Python libraries in /usr/local/lib/python2.2, adding the line setenv(PYTHONHOME) /usr/local to your startup script or .vmdrc file will do the trick.If you have additional modules that you want to use within <strong>VMD</strong>, use the PYTHONPATH environmentvariable to tell Python where to find them. See any Python book for more information.if the Tkinter module is found in the Python installation, <strong>VMD</strong> will load it at Python startupin order to make Tkinter windows work in harmony with windows created from within Tk. Inaddition, if you have Numeric Python installed in your system, a submodule called vmdnumpy willbecome available within the <strong>VMD</strong> module; see below for details.9.3 Atom selections in Python9.3.1 The built-in atomsel typeNEW IN <strong>VMD</strong> 1.8.6: The AtomSel class has been deprecated, in favor of a new built-in typecalled atomsel. The atomsel type functions much the same way as the old AtomSel class, but alsoprovides methods similar to the Tcl interface for returning RMS fit matrices and applying thosetransformations to coordinates.The new atomsel type is found in a new built-in module, also called atomsel. Usehelp(atomsel)to get the complete documentation.9.3.2 The AtomSel class (DEPRECATED)<strong>VMD</strong> provides an atom selection class for use in the Python interpreter. Instances of this classcorrespond to a set of atom indices in a particular molecule for a particular coordinate set. Oncean atom selection is made, you can query the properties of the selected atoms, such as their names,residue ids, or coordinates. In a similar fashion, you can set the values of these properties. Youcan also perform logical operations on atom selections, including finding the intersection or unionof two atom selections or finding the inverse of the set. Finally, you can perform tuple operationson the atom selection object to query the indices of the atoms in the selection.Atom selection macros can be defined using the macro method of the AtomSel module. The syntaxis just as in the corresponding atomselect macro and atomselect delmacro Tcl commands;see section 8.3.2 for details.Below we summarize the methods available from the AtomSel class.• AtomSel(selection = ’all’, molid = 0, frame = 0): Creates a new atom selectionobject.>>> sel = AtomSel(’name CA’, 1) # Selects the alpha carbons of molecule 1• select(selection): Change the selected atoms.>>> sel.select(’resid 5’)• list():Return a copy of the selected atom indices.• frame(value = -1): Set/get the coordinate frame for the selection. Nonpositive values willreturn the current value of the frame without changing it.>>> sel.frame(5)>>> sel.frame()5125

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

Saved successfully!

Ooh no, something went wrong!