Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewcarbone committed Aug 9, 2023
1 parent a8e14cc commit 6cb919f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lightshow/_tests/helpers/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
from pymatgen.core.structure import IStructure
from pymatgen.io.exciting import ExcitingInput
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer


ATOMIC_NUMBERS = {
Expand Down Expand Up @@ -338,6 +339,22 @@ def consistency_check(
atom_dirs_VASP = sorted(list((Path(path) / "VASP").iterdir()))
atom_dirs_XSpectra = sorted(list((Path(path) / "XSpectra").iterdir()))
atom_dirs_EXCITING = sorted(list((Path(path) / "EXCITING").iterdir()))
unit_cell_path = Path(path) / "POSCAR"

# Check that the unit cell corresponds with the site indexes in the
# VASP directory
_sites = sorted([int(str(dd.name).split("_")[0]) for dd in atom_dirs_VASP])
_structure = IStructure.from_file(unit_cell_path)
inequivalent_sites = (
SpacegroupAnalyzer(_structure)
.get_symmetrized_structure()
.equivalent_indices
)
for ineq in inequivalent_sites:
L = len(ineq)
L2 = len(list(set(ineq) - set(_sites)))
assert L - L2 == 1
# Done!

l1 = [xx.name for xx in atom_dirs_FEFF]
l2 = [xx.name for xx in atom_dirs_VASP]
Expand Down
1 change: 1 addition & 0 deletions lightshow/_tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_write(
xspectra_params,
],
)
dat.write_unit_cells(target)

# Assert geometires
consistency_check(target / Path(mpid), rounding=3)

0 comments on commit 6cb919f

Please sign in to comment.