Commit 97f42347 by Francois Gygi

updated for multiple input files


git-svn-id: http://qboxcode.org/svn/qb/trunk@1417 cba15fb0-1239-40c8-b417-11db7ca47a34
parent cb6d8a38
#!/usr/bin/python
# qbox_msd.py: compute mean-square displacement in an MD simulation
# generate plot of <r^2>(t) in gnuplot format
# use: qbox_msd.py species file.r [file.r ...]
# qbox_msd.py: compute the mean-square displacement of atoms of a given species
# generate plot of <r^2(t)> in gnuplot format
# use: qbox_msd.py species file.r
import xml.sax
import sys
import math
if len(sys.argv) < 3:
print "use: ",sys.argv[0]," species file [file ...]"
if len(sys.argv) != 3:
print "use: ",sys.argv[0]," species file.r"
sys.exit()
species = sys.argv[1]
infile = sys.argv[2]
# Qbox output handler to extract and process data
class QboxOutputHandler(xml.sax.handler.ContentHandler):
......@@ -56,13 +57,10 @@ class QboxOutputHandler(xml.sax.handler.ContentHandler):
print self.step,'%12.6f'%(disp2sum/len(self.tau))
self.step += 1
print "# ",species
print "# ",species,infile
parser = xml.sax.make_parser()
handler = QboxOutputHandler()
parser.setContentHandler(handler)
for i in range(len(sys.argv)-2):
infile = sys.argv[i+2]
parser.parse(infile)
parser.parse(infile)
print
print
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment