Open alonkukl opened 9 years ago
Or even try and use this code:
if "MACROSCOPIC STATIC DIELECTRIC TENSOR" in line:
outcar_fh.readline()
try:
epsilon.append([float(x) for x in outcar_fh.readline().split()])
epsilon.append([float(x) for x in outcar_fh.readline().split()])
epsilon.append([float(x) for x in outcar_fh.readline().split()])
except:
doc = etree.parse('vasprun.xml')
epsilon = [[float(x) for x in c.text.split()] for c in doc.xpath("/modeling/calculation/varray")[3].getchildren()]
return epsilon
Hi , Using this code I had some problem and I modified it in the following way:
if "MACROSCOPIC STATIC DIELECTRIC TENSOR" in line:
outcar_fh.readline()
try:
epsilon.append([float(x) for x in outcar_fh.readline().split()])
epsilon.append([float(x) for x in outcar_fh.readline().split()])
epsilon.append([float(x) for x in outcar_fh.readline().split()])
except:
import xml.etree.ElementTree as ET
doc = ET.parse('vasprun.xml')
epsilon = [[float(x) for x in c.text.split()] for c in doc.xpath("/modeling/calculation/varray")[3].getchildren()]
return epsilon
I got a error message: ElementTree instance has no attribute 'xpath' How to get rid of this problem?
Hi
I came a cross a problem with vasp and the dielectric tensor, sometimes when the valuesof the tensor are very big the numbers in the OUTCAR are mixedup and so the python script doesn't read them correctly. For example see the following sinnpet
In vasprun.xml the data is printed correctly, so I suggest to try and read the OUTCAR, and if it doesn't succeed then read the data from the xml with the following commands: