Skip to content

Commit

Permalink
improved descriptions, addressed most other review items
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Jul 3, 2024
1 parent 754051e commit 628efaf
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 244 deletions.
11 changes: 7 additions & 4 deletions src/nomad_simulations/schema_packages/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class Outputs(ArchiveSection):
model_method_ref = Quantity(
type=ModelMethod,
description="""
Reference to the `ModelMethod` section containing the details with which the
output physical properties were calculated.
Reference to the `ModelMethod` section containing the details of the mathematical
model with which the output physical properties were calculated.
""",
a_eln=ELNAnnotation(component='ReferenceEditQuantity'),
)
Expand Down Expand Up @@ -332,7 +332,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
class WorkflowOutputs(Outputs):
"""
This section contains output properties that depend on a single system, but were
calculated as part of a workflow. Examples include geometry optimization and molecular dynamics.
calculated as part of a workflow (e.g., the energies from a geometry optimization),
and thus may include step information.
"""

step = Quantity(
Expand All @@ -343,6 +344,7 @@ class WorkflowOutputs(Outputs):
)

# TODO add this in when we link to nomad-simulations-workflow schema
# ? check potential circular imports problems when the nomad-simulations-workflow schema is transferred here
# workflow_ref = Quantity(
# type=SimulationWorkflow,
# description="""
Expand All @@ -358,7 +360,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
class TrajectoryOutputs(WorkflowOutputs):
"""
This section contains output properties that depend on a single system, but were
calculated as part of a workflow. Examples include geometry optimization and molecular dynamics.
calculated as part of a trajectory (e.g., temperatures from a molecular dynamics
simulation), and thus may include time information.
"""

time = Quantity(
Expand Down
12 changes: 5 additions & 7 deletions src/nomad_simulations/schema_packages/properties/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .band_structure import ElectronicBandStructure, ElectronicEigenvalues
from .energies import (
FermiLevel,
BaseEnergy,
EnergyContribution,
TotalEnergy,
KineticEnergy,
Expand All @@ -31,18 +30,17 @@
Pressure,
Volume,
Temperature,
HeatAdded,
WorkDone,
Heat,
Work,
InternalEnergy,
Enthalpy,
Entropy,
GibbsFreeEnergy,
HelmholtzFreeEnergy,
ChemicalPotential,
HeatCapacityCV,
HeatCapacityCP,
Virial,
Density,
HeatCapacity,
VirialTensor,
MassDensity,
Hessian,
)
from .fermi_surface import FermiSurface
Expand Down
76 changes: 21 additions & 55 deletions src/nomad_simulations/schema_packages/properties/energies.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@

class BaseEnergy(PhysicalProperty):
"""
Abstract physical property section describing some energy of a (sub)system.
Abstract class used to define a common `value` quantity with the appropriate units
for different types of energies, which avoids repeating the definitions for each
energy class.
"""

value = Quantity(
type=np.float64,
unit='joule',
description="""
The value of the energy.
The amount of the energy.
""",
)

Expand All @@ -56,10 +58,21 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:

class EnergyContribution(BaseEnergy, PropertyContribution):
"""
Abstract physical property section linking a property contribution to a contribution
from some method.
Abstract class for incorporating specific energy contributions to the `TotalEnergy`.
The inheritance from `PropertyContribution` allows to link this contribution to a
specific component (of class `BaseModelMethod`) of the over `ModelMethod` using the
`model_method_ref` quantity.
For example, for a force field calculation, the `model_method_ref` may point to a
particular potential type (e.g., a Lennard-Jones potential between atom types X and Y),
while for a DFT calculation, it may point to a particular electronic interaction term
(e.g., 'XC' for the exchange-correlation term, or 'Hartree' for the Hartree term).
Then, the contribution will be named according to this model component and the `value`
quantity will contain the energy contribution from this component evaluated over all
relevant atoms or electrons or as a function of them.
"""

# TODO address the dual parent normalization explicity
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)

Expand All @@ -71,8 +84,7 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:

class FermiLevel(BaseEnergy):
"""
Physical property section describing the Fermi level, i.e., the energy required to add or extract a charge from a material at zero temperature.
It can be also defined as the chemical potential at zero temperature.
Energy required to add or extract a charge from a material at zero temperature. It can be also defined as the chemical potential at zero temperature.
"""

# ! implement `iri` and `rank` as part of `m_def = Section()`
Expand All @@ -94,9 +106,11 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
#! since kinetic energy lives separately, but I think maybe this is ok?
class TotalEnergy(BaseEnergy):
"""
Physical property section describing the total energy of a (sub)system.
The total energy of a system. `contributions` specify individual energetic
contributions to the `TotalEnergy`.
"""

# ? add a generic contributions quantity to PhysicalProperty
contributions = SubSection(sub_section=EnergyContribution.m_def, repeats=True)

def __init__(
Expand Down Expand Up @@ -126,51 +140,3 @@ class PotentialEnergy(BaseEnergy):

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


#! I removed all previous contributions associated in some way with terms in the Hamiltonian.
# ? Should the remaining contributions below be incorporated into some sort of workflow results if still relevant?


# class ZeroTemperatureEnergy(QuantumEnergy):
# """
# Physical property section describing the total energy of a (sub)system extrapolated to $T=0$, based on a free-electron gas argument.
# """

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


# class ZeroPointEnergy(QuantumEnergy):
# """
# Physical property section describing the zero-point vibrational energy of a (sub)system,
# calculated using the method described in zero_point_method.
# """

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


# madelung = SubSection(
# sub_section=EnergyEntry.m_def,
# description="""
# Contains the value and information regarding the Madelung energy.
# """,
# )

# free = SubSection(
# sub_section=EnergyEntry.m_def,
# description="""
# Contains the value and information regarding the free energy (nuclei + electrons)
# (whose minimum gives the smeared occupation density calculated with
# smearing_kind).
# """,
# )

# sum_eigenvalues = SubSection(
# sub_section=EnergyEntry.m_def,
# description="""
# Contains the value and information regarding the sum of the eigenvalues of the
# Hamiltonian matrix.
# """,
# )
72 changes: 18 additions & 54 deletions src/nomad_simulations/schema_packages/properties/forces.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
Expand Down Expand Up @@ -50,25 +33,22 @@
PropertyContribution,
)

####################################################
# Abstract force classes
####################################################

##################
# Abstract classes
##################


class BaseForce(PhysicalProperty):
"""
Abstract physical property section describing some force of a (sub)system.
Abstract class used to define a common `value` quantity with the appropriate units
for different types of forces, which avoids repeating the definitions for each
force class.
"""

value = Quantity(
type=np.dtype(np.float64),
unit='newton',
description="""
The value of the force.
The amount of force.
""",
)

Expand All @@ -78,8 +58,18 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:

class ForceContribution(BaseForce, PropertyContribution):
"""
Abstract physical property section linking a property contribution to a contribution
from some method.
Abstract class for incorporating specific force contributions to the `TotalForce`.
The inheritance from `PropertyContribution` allows to link this contribution to a
specific component (of class `BaseModelMethod`) of the over `ModelMethod` using the
`model_method_ref` quantity.
For example, for a force field calculation, the `model_method_ref` may point to a
particular potential type (e.g., a Lennard-Jones potential between atom types X and Y),
while for a DFT calculation, it may point to a particular electronic interaction term
(e.g., 'XC' for the exchange-correlation term, or 'Hartree' for the Hartree term).
Then, the contribution will be named according to this model component and the `value`
quantity will contain the force contribution from this component evaluated over all
relevant atoms or electrons or as a function of them.
"""

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
Expand All @@ -93,7 +83,8 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:

class TotalForce(BaseForce):
"""
Physical property section describing the total force of a (sub)system.
The total force on a system. `contributions` specify individual force
contributions to the `TotalForce`.
"""

contributions = SubSection(sub_section=ForceContribution.m_def, repeats=True)
Expand All @@ -107,30 +98,3 @@ def __init__(
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)


# ? See questions about corresponding energies
# class FreeForce(Force):
# """
# Physical property section describing...

# Contains the value and information regarding the forces on the atoms
# corresponding to the minus gradient of energy_free. The (electronic) energy_free
# contains the information on the change in (fractional) occupation of the
# electronic eigenstates, which are accounted for in the derivatives, yielding a
# truly energy-conserved quantity.
# """

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


# class ZeroTemperatureForce(Force):
# """
# Physical property section describing...

# Contains the value and information regarding the forces on the atoms
# corresponding to the minus gradient of energy_T0.
# """

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

0 comments on commit 628efaf

Please sign in to comment.