Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Added tests from old parser
Browse files Browse the repository at this point in the history
Fix pipeline
  • Loading branch information
JosePizarro3 committed Apr 29, 2024
1 parent 1e5b6b8 commit 57d1e72
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
]
dependencies = [
"nomad-lab>=1.2.2dev578",
"nomad-lab@git+https://github.com/nomad-coe/nomad.git@develop",
"nomad-schema-plugin-simulation-workflow@git+https://github.com/nomad-coe/nomad-schema-plugin-simulation-workflow.git@develop",
"nomad-schema-plugin-run@git+https://github.com/nomad-coe/nomad-schema-plugin-run.git@develop",
"nomad-schema-plugin-simulation-data@git+https://github.com/nomad-coe/nomad-schema-plugin-simulation-data.git@develop",
Expand Down
59 changes: 58 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,61 @@ def test_single_point_La2CuO4(parser):
archive,
None,
)
sec_run = archive.run[-1]
sec_run = archive.run[-1]
sec_program = sec_run.program
assert sec_program.name == 'Wannier90'
assert sec_program.version == '3.1.0'

assert len(sec_run.system) == 1
sec_system = sec_run.system[-1]
assert sec_system.atoms.labels[-1] == 'O'
assert (sec_system.atoms.positions[2].magnitude == np.array([0.0, 0.0, 0.0])).all()
assert sec_system.atoms.lattice_vectors[0][0].magnitude == approx(-1.909145e-10)
assert sec_system.atoms.periodic == [True, True, True]
assert sec_system.m_xpath('atoms_group')
assert len(sec_system.atoms_group) == 1
assert sec_system.atoms_group[-1].label == 'projection'
assert sec_system.atoms_group[-1].type == 'active_orbitals'
assert sec_system.atoms_group[-1].index == 0
assert sec_system.atoms_group[-1].atom_indices[0] == 2

assert len(sec_run.method) == 1
sec_method = sec_run.method[-1]
assert sec_method.k_mesh.n_points == 343
assert (
sec_method.k_mesh.points[303] == np.array([0.85714, 0.14286, 0.28571])
).all()
assert (sec_method.k_mesh.grid == np.array([7, 7, 7])).all()
sec_wannier = sec_method.tb.wannier
assert sec_wannier.n_projected_orbitals == 1
assert sec_wannier.n_bands == 5
assert sec_wannier.is_maximally_localized is True
assert sec_method.atom_parameters[-1].n_orbitals == 1
assert sec_method.atom_parameters[-1].orbitals[0] == 'dx2-y2'

# Band tests
assert len(sec_run.calculation) == 1
sec_scc = sec_run.calculation[-1]
assert len(sec_scc.band_structure_electronic[0].segment) == 4
assert sec_scc.band_structure_electronic[0].segment[0].n_kpoints == 100
assert sec_scc.band_structure_electronic[0].segment[0].n_kpoints == len(
sec_scc.band_structure_electronic[0].segment[0].energies[0]
)
assert sec_scc.energy.fermi == sec_scc.band_structure_electronic[0].energy_fermi
assert sec_scc.band_structure_electronic[0].energy_fermi.to(
'eV'
).magnitude == approx(12.895622)
# DOS tests
sec_dos = sec_scc.dos_electronic
assert len(sec_dos) == 1
assert sec_dos[0].n_energies == 692
assert sec_dos[0].n_energies == len(sec_dos[0].energies)
assert len(sec_dos[0].total[0].value) == sec_dos[0].n_energies
# x_wannier90 tests
sec_hoppings = sec_scc.hopping_matrix[0]
assert sec_hoppings.n_wigner_seitz_points == 397
assert sec_hoppings.n_wigner_seitz_points == len(sec_hoppings.degeneracy_factors)
assert sec_hoppings.n_orbitals == sec_wannier.n_projected_orbitals
assert sec_hoppings.value.shape[0] == sec_hoppings.n_wigner_seitz_points
assert sec_hoppings.value.shape[1] == sec_hoppings.n_orbitals
assert sec_hoppings.value.shape[2] == 7

0 comments on commit 57d1e72

Please sign in to comment.