Skip to content

Commit

Permalink
initial thoughts
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Apr 9, 2024
1 parent 8ed9b21 commit 086d78e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
47 changes: 31 additions & 16 deletions src/nomad_simulations/outputs_JFR_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@

from .model_system import ModelSystem

class ScalarProperty(BaseProperty):
"""
Generic section containing the values and information for any scalar property.
"""

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

# TODO check that all variable and bin quantities are None

class AtomicProperty(BaseProperty):
"""
Expand Down Expand Up @@ -172,8 +181,6 @@ class EnergyEntry(Atomic):
Section describing a type of energy or a contribution to the total energy.
"""

m_def = Section(validate=False)

reference = Quantity(
type=np.dtype(np.float64),
shape=[],
Expand Down Expand Up @@ -260,13 +267,11 @@ class EnergyEntry(Atomic):
)


class Energy(MSection):
class Energy(ArchiveSection):
"""
Section containing all energy types and contributions.
"""

m_def = Section(validate=False)

total = SubSection(
sub_section=EnergyEntry.m_def,
categories=[FastAccess],
Expand Down Expand Up @@ -580,7 +585,6 @@ class Energy(MSection):
""",
)


class ForcesEntry(Atomic):
"""
Section describing a contribution to or type of atomic forces.
Expand Down Expand Up @@ -996,23 +1000,34 @@ class MultipolesEntry(Atomic):
orbital_projected = SubSection(sub_section=MultipolesValues.m_def, repeats=True)


# TODO remove this section
class Thermodynamics(MSection):
class Enthalpy(ScalarProperty):
"""
Section containing results related to a thermodynamics calculation.
Section containing the enthalpy (i.e. energy_total + pressure * volume.) of a (sub)system.
"""

m_def = Section(validate=False)
value = Quantity(
type=np.float64,
unit='joule',
)

enthalpy = Quantity(
type=np.dtype(np.float64),
shape=[],
def normalize(self, archive, logger) -> None:
super().normalize(archive, logger)
self.value_unit = 'joule'

class Entropy(ScalarProperty):
"""
Section containing the entropy of a (sub)system.
"""

value = Quantity(
type=np.float64,
unit='joule',
description="""
Value of the calculated enthalpy per cell i.e. energy_total + pressure * volume.
""",
)

def normalize(self, archive, logger) -> None:
super().normalize(archive, logger)
self.value_unit = 'joule'

entropy = Quantity(
type=np.dtype(np.float64),
shape=[],
Expand Down
2 changes: 2 additions & 0 deletions src/nomad_simulations/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def __init__(self, *args, **kwargs):
""",
)

# TODO Add value_per_particle?

system_ref = Quantity(
type=Reference(ModelSystem.m_def),
shape=[1],
Expand Down

0 comments on commit 086d78e

Please sign in to comment.