Desmond Tutorial
Desmond Tutorial - DE Shaw Research
Desmond Tutorial - DE Shaw Research
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Analyzing Trajectories Using VMD<br />
Analyzing whole trajectories<br />
This command would write every 10th frame starting from frame 100. Coordinates can<br />
also be written using an atom selection:<br />
sel = atomsel('name CA')<br />
sel.frame = 45<br />
sel.write('mae', 'ca45.mae')<br />
This command would create write a Maestro file containing just the CA atoms whose<br />
coordinates were taken from frame 45.<br />
Analyzing whole trajectories<br />
We can now give a nontrivial trajectory analysis example that illustrates the use of atomsel,<br />
vmdnumpy, and molecule. The script shown in Figure 9.4 runs through all the<br />
frames in a molecule, aligns each frame to the first frame, and computes the aligned<br />
RMSD for each frame and the averaged position of the alpha carbons. To use this script,<br />
itʹs necessary to load the reference structure and any trajectories to be processed into<br />
VMD, using any of the methods outlined in “Loading and Viewing Trajectories” on<br />
page 86.<br />
Once thatʹs done, you can launch the script as described in “The VMD Python Interface”<br />
on page 85.<br />
Figure 9.4 Analysis script example<br />
from atomsel import atomsel<br />
import molecule, vmdnumpy<br />
import numpy<br />
avg = None<br />
# will hold averaged coordinates<br />
all = atomsel()<br />
# all atoms in current frame<br />
ref = atomsel('name CA', frame=0) # reference frame is frame 0<br />
sel = atomsel('name CA') # alpha carbons in current frame<br />
inds = sel.get('index') # indexes of alpha carbons don't change<br />
mass = sel.get('mass') # masses don't change, either<br />
rms = [0.]<br />
# will hold RMSD to reference frame<br />
def processFrame():<br />
global avg<br />
all.move( sel.fit(ref, mass) ) # Align current frame w/ref frame<br />
rms.append( sel.rmsd(ref, mass) ) # Append new RMSD value<br />
# Get positions of CA atoms<br />
pos = vmdnumpy.positions()<br />
ca_pos = pos[inds]<br />
# Accumulate positions into average<br />
if avg is None: avg = ca_pos[:] # make a copy of ca_pos<br />
else: avg += ca_pos # add this frame's contribution<br />
# Loop over frames<br />
n = molecule.numframes(molecule.get_top()<br />
for i in range(1,n ):<br />
molecule.set_frame(molecule.get_top(), i)<br />
processFrame()<br />
September 2008 D. E. Shaw Research 93