Skip to content
Snippets Groups Projects
Commit 1925409d authored by Simoes Brambila, Danilo (brambila)'s avatar Simoes Brambila, Danilo (brambila)
Browse files

fixing conversion of ***float to NaN

parent f6f6463d
Branches
Tags
No related merge requests found
...@@ -216,12 +216,17 @@ class MyXMLParser(ET.XMLParser): ...@@ -216,12 +216,17 @@ class MyXMLParser(ET.XMLParser):
else: else:
mydata = data mydata = data
super(MyXMLParser,self).feed(mydata) super(MyXMLParser,self).feed(mydata)
def transform2(y):
if '**' in y: return float('nan')
else: return y
def getVector(el, transform = float, field = "v"): def getVector(el, transform = float, field = "v"):
""" returns the vasp style vector contained in the element el (using field v). """ returns the vasp style vector contained in the element el (using field v).
single elements are converted using the function convert""" single elements are converted using the function convert"""
return [[transform(y) for y in re.split(r"\s+", x.text.strip())] for x in el.findall(field)] #
# for x in el.findall(field):
# for y in re.split(r"\s+", x.text.strip()):
return [[transform(transform2(y)) for y in re.split(r"\s+", x.text.strip())] for x in el.findall(field)]
class VasprunContext(object): class VasprunContext(object):
def __init__(self): def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment