From 97f423474312476df1352273d590901d75e914c2 Mon Sep 17 00:00:00 2001 From: Francois Gygi Date: Thu, 5 Dec 2013 20:35:27 +0000 Subject: [PATCH] updated for multiple input files git-svn-id: http://qboxcode.org/svn/qb/trunk@1417 cba15fb0-1239-40c8-b417-11db7ca47a34 --- util/qbox_msd.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/util/qbox_msd.py b/util/qbox_msd.py index 3f7f685..22d3501 100755 --- a/util/qbox_msd.py +++ b/util/qbox_msd.py @@ -1,17 +1,18 @@ #!/usr/bin/python -# qbox_msd.py: compute mean-square displacement in an MD simulation -# generate plot of (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 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 -- libgit2 0.26.0