ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/utilities/dumpConverter
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/utilities/dumpConverter (file contents):
Revision 2965 by gezelter, Thu Jul 27 19:05:16 2006 UTC vs.
Revision 2966 by tim, Thu Jul 27 20:36:54 2006 UTC

# Line 19 | Line 19 | __version__ = "$Revision: 1.1 $"
19   """
20  
21   __author__ = "Dan Gezelter (gezelter@nd.edu)"
22 < __version__ = "$Revision: 1.1 $"
23 < __date__ = "$Date: 2006-07-27 19:05:16 $"
22 > __version__ = "$Revision: 1.2 $"
23 > __date__ = "$Date: 2006-07-27 20:36:54 $"
24   __copyright__ = "Copyright (c) 2006 by the University of Notre Dame"
25   __license__ = "OOPSE"
26  
# Line 45 | Line 45 | def convertFiles(mdFileName, configFileName, outputFil
45      
46      mdLines = mdFile.readlines()
47      for l in mdLines:
48 <        outputFile.write(l)
48 >        if (l.find('initialConfig') == -1):
49 >            outputFile.write(l)
50  
51      outputFile.write("  </MetaData>\n")
52      mdFile.close()
# Line 54 | Line 55 | def convertFiles(mdFileName, configFileName, outputFil
55      configFile = open(configFileName, 'r')
56      for line in configFile.readlines():
57          framePos = framePos + 1
57        print framePos
58          if (framePos == 1):
59              L = line.split()
60              nStuntDoubles = int(L[0])
# Line 62 | Line 62 | def convertFiles(mdFileName, configFileName, outputFil
62              outputFile.write("  <Snapshot>\n")
63              continue
64          elif (framePos == 2):
65 <            L = line.split()
66 <            time = float(L[0].split(';')[0])
65 >            L = line.replace(';',' ').split()
66 >            time = float(L[0])
67              outputFile.write("    <FrameData>\n");
68 <            outputFile.write("        Time: %g\n" % (time))
68 >            outputFile.write("        Time: %.10g\n" % (time))
69              Hxx = float(L[1])
70              Hxy = float(L[2])
71 <            Hxz = float(L[3].split(';')[0])
71 >            Hxz = float(L[3])
72              Hyx = float(L[4])
73              Hyy = float(L[5])
74 <            Hyz = float(L[6].split(';')[0])
74 >            Hyz = float(L[6])
75              Hzx = float(L[7])
76              Hzy = float(L[8])
77 <            Hzz = float(L[9].split(';')[0])
78 <            outputFile.write("        Hmat: {{ %g, %g, %g }, { %g, %g, %g }, { %g, %g, %g }}\n" % (Hxx, Hxy, Hxz, Hyx, Hyy, Hyz, Hzx, Hzy, Hzz))
79 <            chi = float(L[10])
80 <            if (L[11][-1] == ';'):
81 <                integChi = float(L[11].split(';')[0])
82 <            else:
77 >            Hzz = float(L[9])
78 >            outputFile.write("        Hmat: {{ %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }}\n" % (Hxx, Hxy, Hxz, Hyx, Hyy, Hyz, Hzx, Hzy, Hzz))
79 >            if (len(L) >= 12):
80 >                chi = float(L[10])
81                  integChi = float(L[11])
82 <            outputFile.write("  Thermostat: %g , %g\n" % (chi, integChi))
83 <            if (L[12][0] == ';'):
86 <                Nxx = float(L[12].split(';')[1])
87 <            else:
82 >                outputFile.write("  Thermostat: %.10g , %.10g\n" % (chi, integChi))
83 >            if (len(L) >= 21):
84                  Nxx = float(L[12])
85 <            Nxy = float(L[13])
86 <            Nxz = float(L[14].split(';')[0])
87 <            Nyx = float(L[15])
88 <            Nyy = float(L[16])
89 <            Nyz = float(L[17].split(';')[0])
90 <            Nzx = float(L[18])
91 <            Nzy = float(L[19])
92 <            Nzz = float(L[20].split(';')[0])
93 <            outputFile.write("    Barostat: {{ %g, %g, %g }, { %g, %g, %g }, { %g, %g, %g }}\n" % (Nxx, Nxy, Nxz, Nyx, Nyy, Nyz, Nzx, Nzy, Nzz))
85 >                Nxy = float(L[13])
86 >                Nxz = float(L[14])
87 >                Nyx = float(L[15])
88 >                Nyy = float(L[16])
89 >                Nyz = float(L[17])
90 >                Nzx = float(L[18])
91 >                Nzy = float(L[19])
92 >                Nzz = float(L[20])
93 >                outputFile.write("    Barostat: {{ %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }, { %.10g, %.10g, %.10g }}\n" % (Nxx, Nxy, Nxz, Nyx, Nyy, Nyz, Nzx, Nzy, Nzz))
94 >            
95              outputFile.write("    </FrameData>\n")
96              outputFile.write("    <StuntDoubles>\n")
97          else:
# Line 128 | Line 125 | def convertFiles(mdFileName, configFileName, outputFil
125                  tz = float(L[19])
126                  sdFormat = 'pvqjft'
127              if (sdFormat == 'pv'):
128 <                outputFile.write("%d\t%s\t%g\t%g\t%g\t%g\t%g\t%g\n" % (whichSD, sdFormat, x, y, z, vx, vy, vz))
128 >                outputFile.write("%d\t%s\t%18.10g\t%18.10g\t%18.10g\t%14.10g\t%14.10g\t%14.10g\n" % (whichSD-1, sdFormat, x, y, z, vx, vy, vz))
129              elif (sdFormat == 'pvqj'):
130 <                outputFile.write("%d\t%s\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\n" % (whichSD, sdFormat, x, y, z, vx, vy, vz, qw, qx, qy, qz, jx, jy, jz))
130 >                outputFile.write("%d\t%s\t%18.10g\t%18.10g\t%18.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\n" % (whichSD-1, sdFormat, x, y, z, vx, vy, vz, qw, qx, qy, qz, jx, jy, jz))
131              elif (sdFormat == 'pvqjft'):
132 <                outputFile.write("%d\t%s\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\n" % (whichSD, sdFormat, x, y, z, vx, vy, vz, qw, qx, qy, qz, jx, jy, jz, fx, fy, fz, tx, ty, tz))
132 >                outputFile.write("%d\t%s\t%18.10g\t%18.10g\t%18.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\t%14.10g\n" % (whichSD-1, sdFormat, x, y, z, vx, vy, vz, qw, qx, qy, qz, jx, jy, jz, fx, fy, fz, tx, ty, tz))
133          if (whichSD == nStuntDoubles):
134              outputFile.write("    </StuntDoubles>\n")
135              outputFile.write("  </Snapshot>\n")

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines