Skip to content

Commit

Permalink
Add testing for TMM data
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Sep 27, 2024
1 parent bbe5357 commit c30e13f
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,97 @@ def test_single_point_La2CuO4(parser):
assert output.electronic_band_structures[0].value[123, 0].to(
'eV'
).magnitude == approx(12.870674)


def test_minimal_Pt_Vikrant(parser):
archive = EntryArchive()
parser.parse(
os.path.join('tests', 'data', 'minimal_Pt_Vikrant', 'wannier90.wout'),
archive,
logger,
)
simulation = archive.data

# Program
assert simulation.program.name == 'Wannier90'
assert simulation.program.version == '3.1.0'

# ModelSystem
assert len(simulation.model_system) == 1
model_system = simulation.model_system[0]
assert model_system.is_representative
# Cell
assert len(model_system.cell) == 1
atomic_cell = model_system.cell[0]
assert np.isclose(
atomic_cell.positions.to('angstrom').magnitude,
np.array(
[
[0.0, 0.0, 0.0],
[0.0, 1.972, 1.972],
[1.972, 0.0, 1.972],
[1.972, 1.972, 0.0],
]
),
).all()
assert np.isclose(
atomic_cell.lattice_vectors.to('angstrom').magnitude,
np.array([[3.944, 0.0, 0.0], [0.0, 3.944, 0.0], [0.0, 0.0, 3.944]]),
).all()
assert atomic_cell.periodic_boundary_conditions == [True, True, True]
# AtomsState
assert len(atomic_cell.atoms_state) == 4
for index, symbol in enumerate(['Pt', 'Pt', 'Pt', 'Pt']):
assert atomic_cell.atoms_state[index].chemical_symbol == symbol
# SubSystems
assert len(model_system.model_system) == 4
for i, subsystem in enumerate(model_system.model_system):
assert subsystem.type == 'active_atom'
assert subsystem.branch_label == 'Pt'
assert (subsystem.atom_indices == [i]).all()

# ModelMethod
assert len(simulation.model_method) == 1
assert simulation.model_method[0].m_def.name == 'Wannier'
wannier = simulation.model_method[0]
assert wannier.is_maximally_localized
assert wannier.n_orbitals == 36
assert wannier.n_bloch_bands == 240
assert np.isclose(wannier.energy_window_inner.magnitude, [8.80301, 11.80301]).all()
assert np.isclose(wannier.energy_window_outer.magnitude, [0.32315, 36.58885]).all()
# NumericalSettings
assert len(wannier.numerical_settings) == 1
assert wannier.numerical_settings[0].m_def.name == 'KSpace'
k_space = wannier.numerical_settings[0]
# KMesh
assert len(k_space.k_mesh) == 1
assert k_space.k_mesh[0].n_points == 512
assert np.isclose(k_space.k_mesh[0].grid, [8, 8, 8]).all()
# KLinePath
assert not k_space.m_xpath('k_line_path')

# Outputs
assert len(simulation.outputs) == 1
output = simulation.outputs[0]
assert output.model_system_ref == model_system
assert output.model_method_ref == wannier
# Properties
for property_name in ['crystal_field_splittings', 'hopping_matrices']:
assert output.m_xpath(property_name, dict=False) is not None
assert len(output.m_xpath(property_name, dict=False)) == 1
# CrystalFieldSplitting
assert output.crystal_field_splittings[0].value[0].to('eV').magnitude == approx(
11.966103
)
# HoppingMatrix
assert len(output.hopping_matrices[0].variables) == 1
assert output.hopping_matrices[0].variables[0].m_def.name == 'WignerSeitz'
assert output.hopping_matrices[0].variables[0].n_points == 729
assert output.hopping_matrices[0].value.shape == (729, 36, 36)
assert output.hopping_matrices[0].value[4, 0, 0].to('eV').magnitude == approx(
0.000224 + 0j
)
# ElectronicDOS
assert not output.m_xpath('electronic_dos')
# ElectronicBandStructure
assert not output.m_xpath('electronic_band_structures')

1 comment on commit c30e13f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_parser_wannier90
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_parser_wannier90/parsers
   __init__.py10280%24–26
   band_parser.py511571%4, 24, 50–51, 73–74, 77–78, 85–89, 98–99, 104–105
   dos_parser.py18194%13
   hr_parser.py48981%4, 28, 46–47, 59–60, 94–96
   parser.py2243883%8–9, 215, 269–270, 310, 367–368, 385, 402, 419, 475–478, 508, 539–587
   win_parser.py1212480%5, 35–36, 65, 145–147, 179, 186, 226, 231, 241–242, 252–253, 283–286, 293, 295–296, 300, 317–321
src/nomad_parser_wannier90/parsers/utils
   utils.py291355%4, 35–37, 56–71
src/nomad_parser_wannier90/schema_packages
   __init__.py8275%9–11
   package.py550%1–11
TOTAL53011379% 

Tests Skipped Failures Errors Time
2 0 💤 0 ❌ 0 🔥 15.723s ⏱️

Please sign in to comment.