Skip to content

Commit

Permalink
- Introduce base structure, i.e. BasisSetContainer, BasisSet
Browse files Browse the repository at this point in the history
- Add `PlaneWaveBasisSet`
  • Loading branch information
ndaelman committed Jul 17, 2024
1 parent bd2f695 commit e389954
Showing 1 changed file with 59 additions and 4 deletions.
63 changes: 59 additions & 4 deletions src/nomad_simulations/schema_packages/numerical_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pint
from ase.dft.kpoints import get_monkhorst_pack_size_and_offset, monkhorst_pack
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.metainfo import JSON, MEnum, Quantity, SubSection
from nomad.units import ureg

Expand Down Expand Up @@ -890,15 +891,69 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)


class BasisSet(NumericalSettings):
""""""

# TODO work on this base section (@ndaelman-hu)
class BasisSet(ArchiveSection):
"""A type section denoting a basis set component of a simulation.
Should be used as a base section for more specialized sections."""

def __init__(self, m_def: 'Section' = None, m_context: 'Context' = None, **kwargs):
super().__init__(m_def, m_context, **kwargs)
# Set the name of the section
self.name = self.m_def.name


class PlaneWaveBasisSet(BasisSet, Mesh):
"""
Defines a plane-wave basis set over a singular mesh.
"""

cutoff_energy = Quantity(
type=np.float64,
unit='joule',
description="""
Cutoff energy for the plane-wave basis set. The simulation uses plane waves with energies below this cutoff.
""",
)

smearing_method = Quantity(
type=MEnum('Fermi-Dirac', 'Gaussian', 'Methfessel-Paxton'),
description="""
Method used to smear the occupation numbers in the plane-wave basis set.
""",
)

sampling_mesh = SubSection(sub_section=Mesh.m_def)
# mesh definitions that specify the sampling points in the reciprocal space

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)


class BasisSetContainer(NumericalSettings):
"""Section providing an overview of the full basis set.
The basis set may contain multiple basis sets specifications `BasisSet`,
each with their own parameters."""

native_tier = Quantity(
type=str,
shape=[],
description="""
Code-specific tag indicating the precision used
for the basis set and meshes of numerical routines.
""",
)

electronic_structure = Quantity(
type=str,
shape=[],
description="""
Electronic structure method used for the calculation.
""",
a_eln=ELNAnnotation(component='ReferenceEditQuantity'),
)

basis_sets = SubSection(sub_section=BasisSet.m_def, repeats=True)

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)
# self.name = self.m_def.name
# TODO: set name based on basis sets

1 comment on commit e389954

@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_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%31–33, 219–222, 246, 301–302, 370–371, 373, 555, 567–568, 629–633, 648–652, 659
   general.py75791%29–30, 98, 162, 272–273, 283
   model_method.py2657771%28–30, 189–192, 195–202, 294–295, 315, 336–355, 371–397, 400–417, 771, 782, 824–831, 869, 888, 968, 1025, 1100, 1214
   model_system.py2612292%43–45, 512–515, 562–569, 743–744, 965–969, 975–976, 984–985, 990, 1013
   numerical_settings.py2746676%31–33, 165, 235, 237–238, 241–244, 248–249, 256–259, 268–271, 275–278, 280–283, 288–291, 297–300, 471–498, 573, 608–611, 635, 638, 683, 685–688, 692, 696, 743, 747–768, 823–824, 891, 899–901, 928, 957
   outputs.py1151091%27–28, 247–250, 290–293, 318, 320, 357, 376
   physical_property.py102793%38–40, 220, 349–351
   variables.py651183%26–28, 116, 139, 159–160, 163, 185, 208, 228
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%26–28, 153–154
   band_structure.py1112280%27–29, 249–282, 295, 302, 338–339, 342
   energies.py36975%25–27, 54, 75, 100, 121, 131, 140
   fermi_surface.py17476%25–27, 58
   forces.py22673%26–28, 55, 75, 98
   hopping_matrix.py29583%25–27, 75, 110
   permittivity.py48883%25–27, 115–123
   spectral_profile.py25612452%27–29, 75–78, 113–116, 217–318, 374–386, 411–414, 434, 439–442, 484–520, 544, 591–594, 610–611, 616–622
   thermodynamics.py751876%25–27, 53, 74, 90, 99, 108, 119, 128, 155, 165, 175, 195, 211, 236, 252, 277
src/nomad_simulations/schema_packages/utils
   utils.py681479%26–29, 79–88, 97–98, 103, 106
TOTAL209944279% 

Tests Skipped Failures Errors Time
321 0 💤 28 ❌ 0 🔥 5.500s ⏱️

Please sign in to comment.