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 />
Big trajectories<br />
# Get positions of CA atoms<br />
pos = vmdnumpy.positions()<br />
ca_pos = pos[self.inds]<br />
# Accumulate positions into average and increment count<br />
if self.avg is None: self.avg = ca_pos[:]<br />
else: self.avg += ca_pos<br />
self.count += 1<br />
def finish(self):<br />
self.avg /= self.count<br />
self.rmsfile.flush()<br />
The most obvious difference between the BigTrajectory version of the script and the<br />
original version is that weʹve packaged the data for the task into a Python class. This<br />
means we have to access our data structures through the self reference, rather than as<br />
global variables. Another difference is that, rather than simply appending the RMSD values<br />
to a list, we write them to a file; this keeps us from running ourselves out of memory if<br />
we end up processing a huge number of frames.<br />
To use this task in our own analysis script, letʹs assume that the contents of Figure 9.5 are<br />
stored in a Python module called Analysis. Rather than copying and pasting the task<br />
into our script, we import the definition of the task into our workspace, then call BigTrajectory.analyze<br />
to apply the task to our own files. Figure 9.6 illustrates how this<br />
might look.<br />
Figure 9.6 Analysis script using Figure 9.5 and BigTrajectory<br />
import Analysis<br />
import BigTrajectory<br />
import sys<br />
inputfiles = sys.argv[1:]<br />
rmsfile = open('rms.dat', 'w')<br />
task = Analysis.AnalysisTask(rmsfile)<br />
BigTrajectory.analyze( inputfiles, task )<br />
exit()<br />
September 2008 D. E. Shaw Research 95