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.
<strong>Desmond</strong> <strong>Tutorial</strong><br />
Analyzing Trajectories Using VMD<br />
# Scale the average<br />
avg /= n<br />
Big trajectories<br />
It is often the case that not all frames of a trajectory can fit into memory at once. The<br />
BigTrajectory framework provided by the <strong>Desmond</strong> distribution makes it simple to<br />
circumvent this limitation for analysis scripts that need to process just one frame at a<br />
time.<br />
In order to use BigTrajectory, the user writes one or more analysis tasks that implement<br />
a processFrame() method like the one described in the previous section. BigTrajectory<br />
then takes care of looping through snapshots one at time and calling each<br />
task in turn to process the data.<br />
Any number of reference frames can be kept in memory while the trajectory frames are<br />
processed, so that tasks like RMSD alignment can be implemented. Organizing your<br />
analysis code into tasks encourages module code development and reuse. Figure 9.5<br />
shows how, with only trivial changes, the script in Figure 9.4 on page 93 can be adapted<br />
to be used in BigTrajectory.<br />
Figure 9.5 Analysis task using BigTrajectory<br />
##<br />
## file: Analysis.py<br />
##<br />
from atomsel import atomsel<br />
import molecule, vmdnumpy<br />
import numpy<br />
import BigTrajectory<br />
class AnalysisTask:<br />
def __init__(self, rmsfile):<br />
self.avg = None<br />
# will hold averaged coordinates<br />
self.count = 0<br />
# number of processed frames<br />
self.all = atomsel() # all atoms in current frame<br />
self.ref = atomsel('name CA', frame=0) # reference frame is<br />
frame 0<br />
self.sel = atomsel('name CA') # alpha carbons in current frame<br />
self.inds = sel.get('index')<br />
self.mass = sel.get('mass')<br />
# write initial 0 to rmsfile output<br />
self.rmsfile.write("%f\n" % 0)<br />
def processFrame(self):<br />
# Align current frame with reference frame<br />
self.all.move( self.sel.fit(self.ref, self.mass) )<br />
# Write out next value of RMSD<br />
self.rmsfile.write( "%f\n" % self.sel.rmsd(self.ref, self.mass) )<br />
94 D. E. Shaw Research September 2008