Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Feb 22, 2024
1 parent ad50577 commit 5b64d19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_charge_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from pymatgen.io.vasp import Chgcar

from pyrho.charge_density import ChargeDensity
from pyrho.charge_density import ChargeDensity, get_volumetric_like_sc


def test_charge_density(test_dir):
Expand Down Expand Up @@ -33,3 +33,10 @@ def test_charge_density(test_dir):
np.testing.assert_allclose(
chgcar_sc.data["total"], chgcar_transformed.data["total"], atol=0.1, rtol=0.01
) # since the chgcar is scaled, the absolute tolerance is 0.1

def test_mapping(test_dir):
chgcar_uc = Chgcar.from_file(test_dir / "CHGCAR.uc.vasp")
chgcar_sc = Chgcar.from_file(test_dir / "CHGCAR.sc1.vasp")
grid_out = chgcar_sc.dim
chgcar_out = get_volumetric_like_sc(chgcar_uc, chgcar_sc.structure, grid_out=grid_out, up_sample=2)
np.testing.assert_allclose(chgcar_out.data["total"], chgcar_sc.data["total"], atol=0.1, rtol=0.01)

0 comments on commit 5b64d19

Please sign in to comment.