Skip to content

Commit

Permalink
Fix issue when squashing and deleting generate_electronic_eigenvalues…
Browse files Browse the repository at this point in the history
… from conftest

Fix bulk type in resolve_reciprocal_lattice_vectors
  • Loading branch information
JosePizarro3 committed May 28, 2024
1 parent 71c5eb2 commit eaac9db
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nomad_simulations/numerical_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pint
from itertools import accumulate, tee, chain
from structlog.stdlib import BoundLogger
from typing import Optional, List, Tuple, Union, Dict
from typing import Optional, List, Tuple, Union
from ase.dft.kpoints import monkhorst_pack, get_monkhorst_pack_size_and_offset

from nomad.units import ureg
Expand Down Expand Up @@ -804,6 +804,10 @@ def resolve_reciprocal_lattice_vectors(
if is_not_representative(model_system, logger):
continue

if model_system.type is not None and model_system.type != 'bulk':
logger.warning('`ModelSystem.type` is not describing a bulk system.')
continue

atomic_cell = model_system.cell
if atomic_cell is None:
logger.warning('`ModelSystem.cell` was not found.')
Expand Down
39 changes: 39 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,45 @@ def generate_k_space_simulation(
return generate_simulation(model_method=model_method, model_system=model_system)


def generate_electronic_eigenvalues(
value: Optional[list] = [
[3, -2],
[3, 1],
[4, -2],
[5, -1],
[4, 0],
[2, 0],
[2, 1],
[4, -3],
],
occupation: Optional[list] = [
[0, 2],
[0, 1],
[0, 2],
[0, 2],
[0, 1.5],
[0, 1.5],
[0, 1],
[0, 2],
],
highest_occupied: Optional[float] = None,
lowest_unoccupied: Optional[float] = None,
) -> ElectronicEigenvalues:
"""
Generate an `ElectronicEigenvalues` section with the given parameters.
"""
n_bands = 2
electronic_eigenvalues = ElectronicEigenvalues(n_bands=n_bands)
electronic_eigenvalues.variables = [Energy(points=[-3, -2, -1, 0, 1, 2, 3, 4])]
if value is not None:
electronic_eigenvalues.value = value
if occupation is not None:
electronic_eigenvalues.occupation = occupation
electronic_eigenvalues.highest_occupied = highest_occupied
electronic_eigenvalues.lowest_unoccupied = lowest_unoccupied
return electronic_eigenvalues


@pytest.fixture(scope='session')
def model_system() -> ModelSystem:
return generate_model_system()
Expand Down

0 comments on commit eaac9db

Please sign in to comment.