mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-09-01 05:09:58 +00:00
add new type to xvg converter
This commit is contained in:
@ -31,6 +31,8 @@ def defineType(file):
|
|||||||
type = "dist"
|
type = "dist"
|
||||||
elif (line.find("Angle") > -1):
|
elif (line.find("Angle") > -1):
|
||||||
type = "angl"
|
type = "angl"
|
||||||
|
elif (line.find("Number") > -1):
|
||||||
|
type = "num"
|
||||||
break
|
break
|
||||||
return type
|
return type
|
||||||
|
|
||||||
@ -67,6 +69,22 @@ def getDistanceOutput(file, first=True):
|
|||||||
return data
|
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):
|
def getRmsdOutput(file, first=True):
|
||||||
"""function to parse rmsd files"""
|
"""function to parse rmsd files"""
|
||||||
data = []
|
data = []
|
||||||
@ -149,6 +167,8 @@ def getData(fileList):
|
|||||||
rawData[system] = rawData[system] + getDistanceOutput(file, first)
|
rawData[system] = rawData[system] + getDistanceOutput(file, first)
|
||||||
elif (type == "angl"):
|
elif (type == "angl"):
|
||||||
rawData[system] = rawData[system] + getAngleOutput(file, first)
|
rawData[system] = rawData[system] + getAngleOutput(file, first)
|
||||||
|
elif (type == "num"):
|
||||||
|
rawData[system] = rawData[system] + getNumberOutput(file, first)
|
||||||
if (first):
|
if (first):
|
||||||
first = False
|
first = False
|
||||||
return rawData
|
return rawData
|
||||||
|
Reference in New Issue
Block a user