Skip to content

Commit

Permalink
Remove editable annotations (#162)
Browse files Browse the repository at this point in the history
* Fix typo

* Remove spurious normalization

* - Deactivate `EditQuantity` annotations
- Remove more spurious normalizers

* Apply ruff

* Remove annotations

* - Remove `ELNAnnotation` imports
- Remove 2 extra editable annotations

---------

Co-authored-by: ndaelman <[email protected]>
  • Loading branch information
ndaelman-hu and ndaelman authored Jan 28, 2025
1 parent 0c0caad commit fe81d97
Show file tree
Hide file tree
Showing 16 changed files with 2 additions and 221 deletions.
4 changes: 2 additions & 2 deletions docs/normalize.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Section1(ArchiveSection):
class Section2(ArchiveSection):
normalizer_level = 0

def normalize(self, achive, logger):
def normalize(self, archive, logger):
super().normalize(archive, logger)
# Some operations here or before `super().normalize(archive, logger)`

Expand All @@ -36,7 +36,7 @@ class ParentSection(ArchiveSection):

sub_section_2 = SubSection(Section2.m_def, repeats=True)

def normalize(self, achive, logger):
def normalize(self, archive, logger):
super().normalize(archive, logger)
# Some operations here or before `super().normalize(archive, logger)`
```
Expand Down
8 changes: 0 additions & 8 deletions src/nomad_simulations/schema_packages/atoms_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import numpy as np
import pint
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.datamodel.metainfo.basesections import Entity
from nomad.metainfo import MEnum, Quantity, SubSection
from nomad.units import ureg
Expand Down Expand Up @@ -308,7 +307,6 @@ class CoreHole(ArchiveSection):
description="""
Reference to the OrbitalsState section that is used as a basis to obtain the `CoreHole` section.
""",
a_eln=ELNAnnotation(component='ReferenceEditQuantity'),
)

n_excited_electrons = Quantity(
Expand Down Expand Up @@ -411,7 +409,6 @@ class HubbardInteractions(ArchiveSection):
description="""
Value of the (intraorbital) Hubbard interaction
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

j_hunds_coupling = Quantity(
Expand All @@ -420,7 +417,6 @@ class HubbardInteractions(ArchiveSection):
description="""
Value of the (interorbital) Hund's coupling.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

u_interorbital_interaction = Quantity(
Expand All @@ -430,7 +426,6 @@ class HubbardInteractions(ArchiveSection):
Value of the (interorbital) Coulomb interaction. In rotational invariant systems,
u_interorbital_interaction = u_interaction - 2 * j_hunds_coupling.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

j_local_exchange_interaction = Quantity(
Expand All @@ -439,7 +434,6 @@ class HubbardInteractions(ArchiveSection):
description="""
Value of the exchange interaction. In rotational invariant systems, j_local_exchange_interaction = j_hunds_coupling.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

u_effective = Quantity(
Expand Down Expand Up @@ -474,7 +468,6 @@ class HubbardInteractions(ArchiveSection):
description="""
Name of the double counting correction algorithm applied.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

def resolve_u_interactions(self, logger: 'BoundLogger') -> Optional[tuple]:
Expand Down Expand Up @@ -586,7 +579,6 @@ class AtomsState(Entity):
Note: for `CoreHole` systems we do not consider the charge of the atom even if
we do not store the final `OrbitalsState` where the electron was excited to.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

core_hole = SubSection(sub_section=CoreHole.m_def, repeats=False)
Expand Down
9 changes: 0 additions & 9 deletions src/nomad_simulations/schema_packages/basis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import pint
from nomad import utils
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.metainfo import MEnum, Quantity, SubSection
from nomad.units import ureg

Expand Down Expand Up @@ -57,7 +56,6 @@ class BasisSetComponent(ArchiveSection):
description="""
Reference to the section `AtomsState` specifying the localization of the basis set.
""",
a_eln=ELNAnnotation(components='ReferenceEditQuantity'),
)

# TODO: add atom index-based instantiator for species if not present
Expand All @@ -69,7 +67,6 @@ class BasisSetComponent(ArchiveSection):
Reference to the section `BaseModelMethod` containing the information
of the Hamiltonian term to which the basis set applies.
""",
a_eln=ELNAnnotation(components='ReferenceEditQuantity'),
)

# ? band_scope or orbital_scope: valence vs core
Expand Down Expand Up @@ -204,12 +201,6 @@ class AtomCenteredBasisSet(BasisSetComponent):
sub_section=AtomCenteredFunction.m_def, repeats=True
) # TODO change name

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)
# self.name = self.m_def.name
# TODO: set name based on basis functions
# ? use basis set names from Basis Set Exchange


class APWBaseOrbital(ArchiveSection):
"""
Expand Down
18 changes: 0 additions & 18 deletions src/nomad_simulations/schema_packages/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import numpy as np
from nomad.config import config
from nomad.datamodel.data import Schema
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.datamodel.metainfo.basesections import Activity, Entity
from nomad.metainfo import Datetime, Quantity, SchemaPackage, Section, SubSection

Expand Down Expand Up @@ -70,23 +69,20 @@ class Program(Entity):
description="""
The name of the program.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

version = Quantity(
type=str,
description="""
The version label of the program.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

link = Quantity(
type=str,
description="""
Website link to the program in published information.
""",
a_eln=ELNAnnotation(component='URLEditQuantity'),
)

version_internal = Quantity(
Expand All @@ -95,7 +91,6 @@ class Program(Entity):
Specifies a program version tag used internally for development purposes.
Any kind of tagging system is supported, including git commit hashes.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

subroutine_name_internal = Quantity(
Expand All @@ -106,20 +101,15 @@ class Program(Entity):
so the naming is representative. This naming is mostly meant for users
who are familiar with the program's structure.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

compilation_host = Quantity(
type=str,
description="""
Specifies the host on which the program was compiled.
""",
a_eln=ELNAnnotation(component='StringEditQuantity'),
)

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


class BaseSimulation(Activity):
"""
Expand All @@ -140,7 +130,6 @@ class BaseSimulation(Activity):
description="""
The date and time when this computation ended.
""",
a_eln=ELNAnnotation(component='DateTimeEditQuantity'),
)

cpu1_start = Quantity(
Expand All @@ -149,7 +138,6 @@ class BaseSimulation(Activity):
description="""
The starting time of the computation on the (first) CPU 1.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

cpu1_end = Quantity(
Expand All @@ -158,7 +146,6 @@ class BaseSimulation(Activity):
description="""
The end time of the computation on the (first) CPU 1.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

wall_start = Quantity(
Expand All @@ -167,7 +154,6 @@ class BaseSimulation(Activity):
description="""
The internal wall-clock time from the starting of the computation.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

wall_end = Quantity(
Expand All @@ -176,14 +162,10 @@ class BaseSimulation(Activity):
description="""
The internal wall-clock time from the end of the computation.
""",
a_eln=ELNAnnotation(component='NumberEditQuantity'),
)

program = SubSection(sub_section=Program.m_def, repeats=False)

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


class Simulation(BaseSimulation, Schema):
"""
Expand Down
Loading

1 comment on commit fe81d97

@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.py84693%4–7, 277–278, 288
   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
TOTAL248447181% 

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

Please sign in to comment.