Skip to content

Commit

Permalink
Fix ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Aug 21, 2024
1 parent 7b298a2 commit 128ad49
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 26 deletions.
27 changes: 12 additions & 15 deletions src/nomad_simulations/schema_packages/basis_set.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import itertools
from collections.abc import Iterable
from typing import Any, Callable, Optional

import numpy as np
import pint
from scipy import constants as const
from structlog.stdlib import BoundLogger
from typing import Iterable, Optional, Any, Callable

from nomad import utils
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.datamodel import EntryArchive
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.metainfo import MEnum, Quantity, SubSection
from nomad.units import ureg
from scipy import constants as const
from structlog.stdlib import BoundLogger

from nomad_simulations.schema_packages.atoms_state import AtomsState
from nomad_simulations.schema_packages.numerical_settings import (
Expand Down Expand Up @@ -84,7 +85,7 @@ def normalize(self, archive, logger):

class PlaneWaveBasisSet(BasisSet, Mesh):
"""
Basis set over a reciprocal mesh, where each point $k_n$ represents a planar-wave basis function $\frac{1}{\sqrt{\omega}} e^{i k_n r}$.
Basis set over a reciprocal mesh, where each point $k_n$ represents a planar-wave basis function $\frac{1}{\\sqrt{\\omega}} e^{i k_n r}$.
Typically the grid itself is cartesian with only points within a designated sphere considered.
The cutoff radius may be defined by a reciprocal length, or more commonly, the equivalent kinetic energy for a free particle.
Expand Down Expand Up @@ -303,16 +304,16 @@ def __init__(self, *args, **kwargs):

class APWOrbital(APWBaseOrbital):
"""
Implementation of `APWWavefunction` capturing the foundational (S)(L)APW basis sets, all of the form $\sum_{lm} \left[ \sum_o c_{lmo} \frac{\partial}{\partial r}u_l(r, \epsilon_l) \right] Y_lm$.
The energy parameter $\epsilon_l$ is always considered fixed during diagonalization, opposed to the original APW formulation.
Implementation of `APWWavefunction` capturing the foundational (S)(L)APW basis sets, all of the form $\\sum_{lm} \\left[ \\sum_o c_{lmo} \frac{\\partial}{\\partial r}u_l(r, \\epsilon_l) \right] Y_lm$.
The energy parameter $\\epsilon_l$ is always considered fixed during diagonalization, opposed to the original APW formulation.
This representation then has to match the plane-wave $k_n$ points within the muffin-tin sphere.
* D. J. Singh and L. Nordström, \"INTRODUCTION TO THE LAPW METHOD,\" in Planewaves, pseudopotentials, and the LAPW method, 2nd ed. New York, NY: Springer, 2006, pp. 43-52.
"""

type = Quantity(
type=MEnum('apw', 'lapw', 'slapw'), # ? where to put 'spherical_dirac'
description="""
description=r"""
Type of augmentation contribution. Abbreviations stand for:
| name | description | radial product |
|------|-------------|----------------|
Expand Down Expand Up @@ -364,7 +365,7 @@ class APWLocalOrbital(APWBaseOrbital):

type = Quantity(
type=MEnum('lo', 'LO', 'custom'),
description="""
description=r"""
Type of augmentation contribution. Abbreviations stand for:
| name | description | radial product |
|------|-------------|----------------|
Expand Down Expand Up @@ -471,10 +472,6 @@ def normalize(self, archive: EntryArchive, logger: BoundLogger) -> None:
super(BasisSet).normalize(archive, logger)
self.n_orbitals = len(self.orbitals)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._is_normalized = False


class MuffinTinRegion(BasisSet, Mesh):
"""
Expand Down Expand Up @@ -643,15 +640,15 @@ def generate_apw(
l_max=sp['l_max'],
l_channels=[
APWLChannel(
name=l,
name=l_channel,
orbitals=list(
itertools.chain(
(APWOrbital(type=orb) for orb in sp['orb_type']),
(APWLocalOrbital(type=lo) for lo in sp['lo_type']),
)
),
)
for l in range(sp['l_max'] + 1)
for l_channel in range(sp['l_max'] + 1)
],
)
]
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pytest
from nomad.datamodel import EntryArchive
from nomad.units import ureg

from nomad_simulations.schema_packages.atoms_state import AtomsState, OrbitalsState
from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_method import ModelMethod
Expand Down
1 change: 1 addition & 0 deletions tests/test_atoms_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pytest
from nomad.datamodel import EntryArchive
from nomad.units import ureg

from nomad_simulations.schema_packages.atoms_state import (
AtomsState,
CoreHole,
Expand Down
1 change: 1 addition & 0 deletions tests/test_band_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pytest
from nomad.datamodel import EntryArchive
from nomad.units import ureg

from nomad_simulations.schema_packages.properties import ElectronicBandGap
from nomad_simulations.schema_packages.variables import Temperature

Expand Down
1 change: 1 addition & 0 deletions tests/test_band_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import numpy as np
import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.properties import ElectronicEigenvalues

from . import logger
Expand Down
21 changes: 10 additions & 11 deletions tests/test_basis_set.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
from itertools import chain
from typing import Any, Optional

from nomad_simulations.schema_packages.atoms_state import AtomsState
from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_method import ModelMethod
from nomad_simulations.schema_packages.model_system import AtomicCell, ModelSystem
import numpy as np
import pytest

from nomad.datamodel.datamodel import EntryArchive
from . import logger
from nomad.units import ureg
import numpy as np

from tests.conftest import refs_apw

from nomad_simulations.schema_packages.atoms_state import AtomsState
from nomad_simulations.schema_packages.basis_set import (
APWBaseOrbital,
APWOrbital,
APWLocalOrbital,
APWLChannel,
APWLocalOrbital,
APWOrbital,
APWPlaneWaveBasisSet,
BasisSet,
BasisSetContainer,
MuffinTinRegion,
generate_apw,
)
from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_method import ModelMethod
from nomad_simulations.schema_packages.model_system import AtomicCell, ModelSystem
from tests.conftest import refs_apw

from . import logger


def test_cutoff():
Expand Down
1 change: 1 addition & 0 deletions tests/test_fermi_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from typing import Optional

import pytest

from nomad_simulations.schema_packages.properties import FermiSurface


Expand Down
1 change: 1 addition & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import numpy as np
import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_system import (
AtomicCell,
Expand Down
1 change: 1 addition & 0 deletions tests/test_hopping_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from typing import Optional

import pytest

from nomad_simulations.schema_packages.properties import (
CrystalFieldSplitting,
HoppingMatrix,
Expand Down
1 change: 1 addition & 0 deletions tests/test_model_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.atoms_state import AtomsState, OrbitalsState
from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_method import (
Expand Down
1 change: 1 addition & 0 deletions tests/test_model_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import numpy as np
import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.model_system import (
ChemicalFormula,
ModelSystem,
Expand Down
1 change: 1 addition & 0 deletions tests/test_numerical_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pytest
from nomad.datamodel import EntryArchive
from nomad.units import ureg

from nomad_simulations.schema_packages.numerical_settings import (
KLinePath,
KMesh,
Expand Down
1 change: 1 addition & 0 deletions tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.model_method import ModelMethod
from nomad_simulations.schema_packages.model_system import ModelSystem
from nomad_simulations.schema_packages.numerical_settings import SelfConsistency
Expand Down
1 change: 1 addition & 0 deletions tests/test_permittivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import numpy as np
import pytest

from nomad_simulations.schema_packages.properties import Permittivity
from nomad_simulations.schema_packages.variables import Frequency, KMesh, Variables

Expand Down
1 change: 1 addition & 0 deletions tests/test_physical_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from nomad.datamodel import EntryArchive
from nomad.metainfo import Quantity
from nomad.units import ureg

from nomad_simulations.schema_packages.physical_property import (
PhysicalProperty,
validate_quantity_wrt_value,
Expand Down
1 change: 1 addition & 0 deletions tests/test_spectral_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pytest
from nomad.datamodel import EntryArchive
from nomad.units import ureg

from nomad_simulations.schema_packages.atoms_state import AtomsState
from nomad_simulations.schema_packages.general import Simulation
from nomad_simulations.schema_packages.model_system import AtomicCell, ModelSystem
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#

import pytest

from nomad_simulations.schema_packages.model_system import (
AtomicCell,
ModelSystem,
Expand Down
1 change: 1 addition & 0 deletions tests/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import pytest
from nomad.datamodel import EntryArchive

from nomad_simulations.schema_packages.variables import Variables

from . import logger
Expand Down

0 comments on commit 128ad49

Please sign in to comment.