Skip to content

Commit

Permalink
Generate foundational base section, i.e. ModelBaseSection
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Jan 24, 2025
1 parent ea40f74 commit f62eb98
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/nomad_simulations/schema_packages/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np
from nomad.config import config
from nomad.datamodel.data import Schema
from nomad.datamodel.data import Schema, ArchiveSection
from nomad.datamodel.metainfo.basesections import Activity, Entity
from nomad.metainfo import Datetime, Quantity, SchemaPackage, Section, SubSection

Expand Down Expand Up @@ -55,6 +55,41 @@ def wrapper(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
return wrapper


class ModelBaseSection(ArchiveSection):
"""
Base class for the model sections.
Toggles the display name, as well as adds definition status.
"""

name = Quantity(
type=str,
description="""
Display name of the model within the archive.
""",
)

iri = Quantity(
type=str,
shape=['*'],
description="""
The International Resource Identifier (IRI) of the model.
Can be used to link definitions from curated vocabularies or ontologies.
Use `http` or `https` specifier for active hyperlinks.
""", # ? TODO: impose the format of the IRI
)

def name_from_section(self) -> str:
"""Return the name of the section based on the class name."""
return ''.join(['_' + c.lower() if c.isupper() else c for c in self.__class__.__name__]).lstrip('_')


def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)
if not self.name:
self.name = self.name_from_section()



class Program(Entity):
"""
A base section used to specify a well-defined program used for computation.
Expand Down

1 comment on commit f62eb98

@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__.py15287%39–41
   atoms_state.py1892189%12–14, 200–203, 227, 282–283, 350–351, 353, 530, 542–543, 603–607, 622–626, 633
   basis_set.py2372789%8–9, 119–130, 169–182, 382–386, 408–409, 453–456, 575, 606, 608
   general.py931089%4–7, 83, 87–89, 312–313, 323
   model_method.py2507271%9–11, 155–158, 161–168, 257–258, 278, 299–320, 336–362, 365–382, 567, 760, 771, 813–820
   model_system.py3453789%44–50, 224, 243, 247, 250, 253, 279, 365–366, 440–441, 458–459, 671–674, 721–728, 902–903, 1122–1126, 1132–1133, 1141–1142, 1147, 1170
   numerical_settings.py2556076%12–14, 214, 216–217, 220–223, 227–228, 235–238, 247–250, 254–257, 259–262, 267–270, 276–279, 466–493, 568, 603–606, 630, 633, 678, 680–683, 687, 691, 738, 742–763, 818–819
   outputs.py117992%8–9, 249–252, 292–295, 320, 322, 375
   physical_property.py101793%19–21, 201, 329–331
   variables.py861286%8–10, 98, 121, 145, 167, 189, 211, 233, 256, 276
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%8–10, 135–136
   band_structure.py1172380%9–11, 229–262, 275, 282, 318–319, 366–367
   energies.py30390%7–9
   fermi_surface.py17476%7–9, 40
   forces.py16381%7–9
   greens_function.py931089%7–9, 210–211, 232–233, 254–255, 391
   hopping_matrix.py25388%7–9
   permittivity.py48883%7–9, 97–105
   spectral_profile.py25812751%9–11, 57–60, 95–98, 199–300, 356–368, 393–396, 416, 421–424, 466–502, 570–573, 589–590, 595–601
   thermodynamics.py451273%7–9, 142–144, 177–179, 212–214
src/nomad_simulations/schema_packages/utils
   utils.py791680%8–11, 65–74, 83–84, 89, 92, 169–170
TOTAL249347581% 

Tests Skipped Failures Errors Time
402 0 💤 0 ❌ 0 🔥 6.605s ⏱️

Please sign in to comment.