27.08.2015 Views

Desmond Tutorial

Desmond Tutorial - DE Shaw Research

Desmond Tutorial - DE Shaw Research

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

Analyzing Trajectories Using VMD<br />

Getting information about snapshots<br />

• frame; default -1. The frame is the index of the snapshot referenced by the selection.<br />

The default value of -1 means that the selection should reference whatever the current<br />

frame happens to be. A frame value of 0 or higher means the selection always<br />

refers to the same frame, even if the current frame changes. If the frame referenced by<br />

selection does not exist, then the last frame in the molecule is used.<br />

You can get and set the frame attribute in the usual Python way:<br />

n1 = len(wat0) # number of atoms in the selection<br />

f = wat0.frame # returns -1<br />

wat0.frame = 20 # makes wat0 reference frame 20<br />

n2 = len(wat0) # will be equal to n1!<br />

wat0.update() # recompute the selection based on frame 20<br />

n3 = len(wat0) # might be different from n1<br />

Note, however, that changing the frame does not cause the selection to be recomputed.<br />

Only the update() method changes the set of atoms referenced by an existing selection.<br />

However, changing the frame does change the result of calculations that depend on the<br />

coordinates, such as center() and rmsd(). The reason things are done this way is<br />

because one might want to select a set of atoms based on a distance criterion, such as the<br />

wat0 selection in the example above, and then see howthe positions of those atoms<br />

change over time. There would be no way to do this if changing the frame automatically<br />

updated the selection.<br />

With an atom selection object in hand, you can extract data about a molecule for the atoms<br />

in the selection. Continuing from the first example:<br />

# Get the number of alpha carbons<br />

num_ca = len(ca)<br />

# get the residue name of each alpha carbon<br />

resnames = ca.get('resname')<br />

# Set the 'type' attribute of all atoms to 'X'<br />

all.set('type', 'X')<br />

# Compute the center of mass the protein atoms in frame 10<br />

mass = pro10.get('mass')<br />

com = pro10.center(mass)<br />

# Align pro10 to the corresponding atoms in frame 0, and compute<br />

# the RMSD relative to frame 0.<br />

pro0 = atomsel('protein', frame=0)<br />

m = pro10.fit(pro0, weight=mass)<br />

pro10.move(m)<br />

rms = pro10.fit(pro0)<br />

Snapshots<br />

Time‐varying data in VMD includes positions, velocities, and periodic cell parameters.<br />

The atom selection interface can be used to extract positions and velocities from a given<br />

frame in the same way as other attributes:<br />

# get the x, y, and z coordinates for the atoms in wat1 as Python lists<br />

x = wat1.get('x')<br />

y = wat1.get('y')<br />

September 2008 D. E. Shaw Research 91

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

Saved successfully!

Ooh no, something went wrong!