11.07.2015 Views

VMD User's Guide

VMD User's Guide

VMD User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• align(ref=None, move=None, frame=None, weight=None): Finds the transformationthat aligns the atoms in the selection with the atoms in ref, with optional weights weight,and applies this transformation to the atoms in move. The following default values for allarguments are provided:– ref: Same molecule and atoms as selection, but always using the– align(ref=None, move=None, frame=None, weight=None):Finds the transformation that aligns the atoms in the selection with the atoms in ref,with optional weights weight, and applies this transformation to the atoms in move.The following default values for all arguments are provided:∗ ref: Same molecule and atoms as selection, but always using the first timestep inthe molecule.∗ move: All atoms in the selection molecule.∗ frame: overrides both the selection’s frame and the move frame, but does not affectthe ref frame.∗ weight: Defaults to uniform weights on all atoms in selection.first timestep in the molecule.– move: All atoms in the selection molecule.– frame: overrides both the selection’s frame and the move frame, but does not affect theref frame.– weight: Defaults to uniform weights on all atoms in selection.• contacts(cutoff, sel=None): Returns pairs of of atoms within cutoff of each other.If sel is None, atoms in the pairs must be in the selection; otherwise, the first atom in eachpair will be from the selection, and the second will be from sel.9.3.3 An atom selection exampleIn the first example, we load the molecule alanin.pdb, and create an atom selection consistingof the alpha carbons. Note that AtomSel is the name of the class which generates atom selectioninstances. We show the string representation of the object by entering its name and pressing return;this shows the text used in the selection.Next we demenstrate how atom selections act like tuples: we can get their length using the builtinlen() command,and return a copy of the selected atoms in a tuple by using the slice operator[:].Finally, we demonstrate the get and set operations. The get() operation takes any number ofstring arguments; for each argument, it returns a Python list of values corresponding to that string.The set() operation allows only one property to be changed at a time. However, you can pass ineither a single value, which will be applied to all atoms in the selection, or a tuple or list of the samesize as the atom selection, in which case values in the list will be assigned to the correspondingatom in the selection. We take advantage of this behavior in the following example by first savingthe current value of beta for the selection, then setting the value of beta to 5 for all selected atoms,and finally resetting the original values using the results of the get().>>> from molecule import *>>> from AtomSel import AtomSel127

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

Saved successfully!

Ooh no, something went wrong!