Skip to content

Commit

Permalink
fix: qe/pw/scf unit conversion is now consistent with qe/cp/traj
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Sep 19, 2024
1 parent efebdd7 commit 8028a06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions dpdata/qe/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@

from dpdata.utils import open_file

ry2ev = 13.605693009
bohr2ang = 0.52917721067
kbar2evperang3 = 1e3 / 1.602176621e6
from .traj import (
kbar2evperang3,
ry2ev,
)
from .traj import (
length_convert as bohr2ang,
)

_QE_BLOCK_KEYWORDS = [
"ATOMIC_SPECIES",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_qe_pw_scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def test_virial(self):

def test_energy(self):
ref_energy = -219.74425946528794
self.assertAlmostEqual(self.system_ch4.data["energies"][0], ref_energy)
self.assertAlmostEqual(self.system_ch4.data["energies"][0] / ref_energy, 1.0)
ref_energy = -30007.651851226798
self.assertAlmostEqual(self.system_h2o.data["energies"][0], ref_energy)
self.assertAlmostEqual(self.system_h2o.data["energies"][0] / ref_energy, 1.0)
ref_energy = -219.7153691367526562
self.assertAlmostEqual(self.system_ch4_2.data["energies"][0], ref_energy)
self.assertAlmostEqual(self.system_ch4_2.data["energies"][0] / ref_energy, 1.0)


class TestPWSCFLabeledOutput(unittest.TestCase, TestPWSCFSinglePointEnergy):
Expand Down

0 comments on commit 8028a06

Please sign in to comment.