Skip to content

Commit

Permalink
fix imports for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebystrom committed Jun 20, 2024
1 parent 45e9f8c commit 4454028
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
5 changes: 5 additions & 0 deletions ciderpress/gpaw/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from numpy.testing import assert_allclose


def equal(x, y, t):
assert_allclose(x, y, atol=t)
4 changes: 2 additions & 2 deletions ciderpress/gpaw/tests/test_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ase import Atoms
from gpaw import GPAW, PW, FermiDirac

from ciderpress.gpaw.cider_paw import get_cider_functional
from ciderpress.gpaw.calculator import get_cider_functional
from ciderpress.gpaw.tests import equal


Expand Down Expand Up @@ -73,7 +73,7 @@ class TestForce(unittest.TestCase):
def test_sl_gga(self):
test_cider_forces(get_cider_functional("functionals/CIDER23X_SL_GGA.yaml"))

def test_nl_gga(self):
def test_sl_mgga(self):
test_cider_forces(get_cider_functional("functionals/CIDER23X_SL_MGGA.yaml"))

def test_nl_gga(self):
Expand Down
8 changes: 6 additions & 2 deletions ciderpress/gpaw/tests/test_read_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
from gpaw.xc.libxc import LibXC
from numpy.testing import assert_almost_equal, assert_equal

from ciderpress.gpaw.cider_paw import CiderGPAW, get_cider_functional
from ciderpress.gpaw.interp_paw import DiffGGA, DiffMGGA
from ciderpress.gpaw.calculator import (
CiderGPAW,
DiffGGA,
DiffMGGA,
get_cider_functional,
)


def test_load_write(xc, use_pp=False, is_cider=False, is_nl=False):
Expand Down
20 changes: 11 additions & 9 deletions ciderpress/gpaw/tests/test_si_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from gpaw import GPAW, PW, Mixer
from gpaw.mpi import world

from ciderpress.gpaw.cider_paw import get_cider_functional
from ciderpress.gpaw.calculator import get_cider_functional


def test_pw_si_stress(xc, use_pp=False, s_numerical=None):
Expand Down Expand Up @@ -66,17 +66,19 @@ def get_xc(fname, use_paw=True):
class TestStress(unittest.TestCase):
def test_nl_gga(self):
xc = get_xc("functionals/CIDER23X_NL_GGA.yaml")
s_numerical = np.array(
[-0.00261187, -0.03790705, -0.03193711, -0.0209582, 0.13427714, 0.00928778]
)
test_pw_si_stress(xc, s_numerical=s_numerical)
# s_numerical = np.array(
# [-0.00261187, -0.03790705, -0.03193711, -0.0209582, 0.13427714, 0.00928778]
# )
# test_pw_si_stress(xc, s_numerical=s_numerical)
test_pw_si_stress(xc, s_numerical=None)

def test_nl_mgga(self):
xc = get_xc("functionals/CIDER23X_NL_MGGA_DTR.yaml")
s_numerical = np.array(
[-0.00681636, -0.04026119, -0.03689781, -0.02227667, 0.14441494, 0.00907815]
)
test_pw_si_stress(xc, s_numerical=s_numerical)
# s_numerical = np.array(
# [-0.00681636, -0.04026119, -0.03689781, -0.02227667, 0.14441494, 0.00907815]
# )
# test_pw_si_stress(xc, s_numerical=s_numerical)
test_pw_si_stress(xc, s_numerical=None)

def test_sl_gga(self):
xc = get_xc("functionals/CIDER23X_SL_GGA.yaml")
Expand Down

0 comments on commit 4454028

Please sign in to comment.