Skip to content

Commit

Permalink
Made sure QE output results in angtrom to be consistent with VASP
Browse files Browse the repository at this point in the history
  • Loading branch information
lllangWV committed Aug 28, 2024
1 parent 8140afa commit 339d321
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyprocar/io/qe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
import numpy as np

from pyprocar.core import DensityOfStates, Structure, ElectronicBandStructure, KPath
from pyprocar.utils.units import HARTREE_TO_EV, AU_TO_ANG


HARTREE_TO_EV = 27.211386245988 #eV/Hartree
class QEParser():
"""The class is used to parse Quantum Expresso files.
The most important objects that comes from this parser are the .ebs and .dos
Expand Down Expand Up @@ -806,6 +805,7 @@ def _parse_structure(self,main_xml_root):
self.species_list = list(self.composition.keys())
self.ionsCount = int(main_xml_root.findall(".//output/atomic_structure")[0].attrib['nat'])
self.alat = float(main_xml_root.findall(".//output/atomic_structure")[0].attrib['alat'])
self.alat = self.alat * AU_TO_ANG

self.ions = []
for ion in main_xml_root.findall(".//output/atomic_structure/atomic_positions")[0]:
Expand All @@ -818,8 +818,12 @@ def _parse_structure(self,main_xml_root):
# in a.u
self.direct_lattice = np.array([ acell.text.split() for acell in main_xml_root.findall(".//output/atomic_structure/cell")[0] ],dtype = float)


# in a.u
self.reciprocal_lattice = (2 * np.pi /self.alat) * np.array([ acell.text.split() for acell in main_xml_root.findall(".//output/basis_set/reciprocal_lattice")[0] ],dtype = float)

# Convert to angstrom
self.direct_lattice = self.direct_lattice * AU_TO_ANG

return None

def _parse_symmetries(self,main_xml_root):
Expand Down
8 changes: 8 additions & 0 deletions pyprocar/utils/units.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


AU_TO_ANG = 0.52917721067121 # bohr/ang
ANG_TO_AU = 1.0 / AU_TO_ANG # ang/bohr


HARTREE_TO_EV = 27.211386245988 #eV/Hartree
EV_TO_HARTREE = 1.0 / HARTREE_TO_EV #Hartree/eV

0 comments on commit 339d321

Please sign in to comment.