mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-06-28 06:41:42 +00:00
add new type to xvg converter
This commit is contained in:
@ -31,6 +31,8 @@ def defineType(file):
|
||||
type = "dist"
|
||||
elif (line.find("Angle") > -1):
|
||||
type = "angl"
|
||||
elif (line.find("Number") > -1):
|
||||
type = "num"
|
||||
break
|
||||
return type
|
||||
|
||||
@ -67,6 +69,22 @@ def getDistanceOutput(file, first=True):
|
||||
return data
|
||||
|
||||
|
||||
def getNumberOutput(file, first=True):
|
||||
"""function to parse distance file"""
|
||||
data = []
|
||||
with open(file, 'r') as input:
|
||||
for line in input:
|
||||
if ((line[0] == '@') or (line[0] == '#')):
|
||||
continue
|
||||
try:
|
||||
if ((not first) and (float(line.split()[0]) == 0.0)):
|
||||
continue
|
||||
data.append(float(line.split()[1]))
|
||||
except:
|
||||
pass
|
||||
return data
|
||||
|
||||
|
||||
def getRmsdOutput(file, first=True):
|
||||
"""function to parse rmsd files"""
|
||||
data = []
|
||||
@ -149,6 +167,8 @@ def getData(fileList):
|
||||
rawData[system] = rawData[system] + getDistanceOutput(file, first)
|
||||
elif (type == "angl"):
|
||||
rawData[system] = rawData[system] + getAngleOutput(file, first)
|
||||
elif (type == "num"):
|
||||
rawData[system] = rawData[system] + getNumberOutput(file, first)
|
||||
if (first):
|
||||
first = False
|
||||
return rawData
|
||||
|
Reference in New Issue
Block a user