Skip to content

Commit 353ca15

Browse files
author
jrudz
committed
updated force to new structure
1 parent 1a0fc7b commit 353ca15

File tree

3 files changed

+88
-100
lines changed

3 files changed

+88
-100
lines changed

src/nomad_simulations/properties/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
FermiLevel,
2121
ChemicalPotential,
2222
TotalEnergy,
23-
ClassicalEnergyContributions,
24-
QuantumEnergyContributions,
23+
Energy,
24+
ClassicalEnergy,
25+
QuantumEnergy,
2526
)
26-
from .forces import TotalForce, ForceContributions
27+
from .forces import TotalForce, Force
2728
from .band_gap import ElectronicBandGap
2829
from .spectral_profile import (
2930
SpectralProfile,

src/nomad_simulations/properties/energies.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def normalize(self, archive, logger) -> None:
131131
f"Misidentified type for classical energy."
132132
)
133133

134-
class QuamtumEnergy(Energy):
134+
class QuantumEnergy(Energy):
135135
"""
136136
Abstract physical property section describing some quantum energy of a (sub)system.
137137
"""
@@ -300,7 +300,7 @@ def normalize(self, archive, logger) -> None:
300300
# List of quantum energy contributions
301301
######################################
302302

303-
class ElectronicEnergy(QuamtumEnergy):
303+
class ElectronicEnergy(QuantumEnergy):
304304
"""
305305
Physical property section describing the electronic energy of a (sub)system.
306306
"""
@@ -310,7 +310,7 @@ def normalize(self, archive, logger) -> None:
310310
#! allowed_contributions = ['PotKin'] Not sure how to deal with sub-contributions... - I lean towards keeping a flat list but I am not sure of all the usages
311311

312312

313-
class ElectronicKineticEnergy(QuamtumEnergy):
313+
class ElectronicKineticEnergy(QuantumEnergy):
314314
"""
315315
Physical property section describing the electronic kinetic energy of a (sub)system.
316316
"""
@@ -319,7 +319,7 @@ def normalize(self, archive, logger) -> None:
319319
super().normalize(archive, logger)
320320

321321

322-
class XCEnergy(QuamtumEnergy):
322+
class XCEnergy(QuantumEnergy):
323323
"""
324324
Physical property section describing the exchange-correlation (XC) energy of a (sub)system,
325325
calculated using the functional stored in XC_functional.
@@ -331,7 +331,7 @@ def normalize(self, archive, logger) -> None:
331331
super().normalize(archive, logger)
332332

333333

334-
class XCPotentialEnergy(QuamtumEnergy):
334+
class XCPotentialEnergy(QuantumEnergy):
335335
"""
336336
Physical property section describing the potential energy contribution to the exchange-correlation (XC) energy,
337337
i.e., the integral of the first order derivative of the functional
@@ -347,7 +347,7 @@ def normalize(self, archive, logger) -> None:
347347

348348

349349
# ? XCCorrelationEnergy?
350-
class CorrelationEnergy(QuamtumEnergy):
350+
class CorrelationEnergy(QuantumEnergy):
351351
"""
352352
Physical property section describing the correlation energy of a (sub)system,
353353
calculated using the method described in XC_functional.
@@ -369,7 +369,7 @@ def normalize(self, archive, logger) -> None:
369369

370370

371371
# ? XCExchangeEnergy?
372-
class ExchangeEnergy(QuamtumEnergy):
372+
class ExchangeEnergy(QuantumEnergy):
373373
"""
374374
Physical property section describing the exchange energy of a (sub)system,
375375
calculated using the method described in XC_functional.
@@ -381,7 +381,7 @@ def normalize(self, archive, logger) -> None:
381381
super().normalize(archive, logger)
382382

383383

384-
class ZeroTemperatureEnergy(QuamtumEnergy):
384+
class ZeroTemperatureEnergy(QuantumEnergy):
385385
"""
386386
Physical property section describing the total energy of a (sub)system extrapolated to $T=0$, based on a free-electron gas argument.
387387
"""
@@ -392,7 +392,7 @@ def normalize(self, archive, logger) -> None:
392392
super().normalize(archive, logger)
393393

394394

395-
class ZeroPointEnergy(QuamtumEnergy):
395+
class ZeroPointEnergy(QuantumEnergy):
396396
"""
397397
Physical property section describing the zero-point vibrational energy of a (sub)system,
398398
calculated using the method described in zero_point_method.
@@ -404,7 +404,7 @@ def normalize(self, archive, logger) -> None:
404404
super().normalize(archive, logger)
405405

406406

407-
class ElectrostaticEnergy(QuamtumEnergy):
407+
class ElectrostaticEnergy(QuantumEnergy):
408408
"""
409409
Physical property section describing the electrostatic energy (nuclei + electrons) of a (sub)system.
410410
"""
@@ -413,7 +413,7 @@ def normalize(self, archive, logger) -> None:
413413
super().normalize(archive, logger)
414414

415415

416-
class NuclearRepulsionEnergy(QuamtumEnergy):
416+
class NuclearRepulsionEnergy(QuantumEnergy):
417417
"""
418418
Physical property section describing the nuclear-nuclear repulsion energy of a (sub)system.
419419
"""

src/nomad_simulations/properties/forces.py

Lines changed: 73 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -41,105 +41,116 @@
4141

4242
from nomad_simulations.physical_property import PhysicalProperty
4343

44+
####################################################
45+
# Abstract force classes
46+
####################################################
4447

45-
################################
46-
# List of Forces Contributions #
47-
################################
48-
49-
50-
class FreeForce(PhysicalProperty):
48+
class Force(PhysicalProperty):
5149
"""
52-
Contains the value and information regarding the forces on the atoms
53-
corresponding to the minus gradient of energy_free. The (electronic) energy_free
54-
contains the information on the change in (fractional) occupation of the
55-
electronic eigenstates, which are accounted for in the derivatives, yielding a
56-
truly energy-conserved quantity.
50+
Abstract physical property section describing some energy of a (sub)system.
5751
"""
5852

53+
type = Quantity(
54+
type=MEnum('classical', 'quantum'),
55+
description="""
56+
""",
57+
)
58+
5959
value = Quantity(
6060
type=np.dtype(np.float64),
61-
shape=['n_atoms', 3],
6261
unit='newton',
6362
description="""
64-
The value of the free force.
63+
The value of the force.
6564
""",
6665
)
6766

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

70+
######################################################
71+
# List of general force properties/contributions that
72+
# can have both classical and quantum interpretations
73+
######################################################
7174

72-
class ZeroTemperatureForce(PhysicalProperty):
75+
class TotalForce(Force):
7376
"""
74-
Contains the value and information regarding the forces on the atoms
75-
corresponding to the minus gradient of energy_T0.
77+
Section containing the total force of a (sub)system.
78+
79+
Contains the value and information regarding the total forces on the atoms
80+
calculated as minus gradient of energy_total.
7681
"""
82+
# ! We need to avoid giving the precise method of calculation without also providing context, this is not necessarily true in general!
7783

78-
value = Quantity(
79-
type=np.dtype(np.float64),
80-
shape=['n_atoms', 3],
81-
unit='newton',
82-
description="""
83-
The value of the free force.
84-
""",
84+
contributions = SubSection(
85+
sub_section=Force.m_def, repeats=True
8586
)
8687

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

9091

91-
class RawForce(PhysicalProperty):
92-
""" """
92+
################################
93+
# List of Forces Contributions #
94+
################################
9395

94-
value = Quantity(
95-
type=np.dtype(np.float64),
96-
shape=['n_atoms', 3],
97-
unit='newton',
98-
description="""
99-
Value of the forces acting on the atoms **not including** such as fixed atoms,
100-
distances, angles, dihedrals, etc.
101-
""",
102-
# ? This is VERY imprecise, is this used regularly?
103-
)
96+
97+
class FreeForce(Force):
98+
"""
99+
Physical property section describing...
100+
101+
Contains the value and information regarding the forces on the atoms
102+
corresponding to the minus gradient of energy_free. The (electronic) energy_free
103+
contains the information on the change in (fractional) occupation of the
104+
electronic eigenstates, which are accounted for in the derivatives, yielding a
105+
truly energy-conserved quantity.
106+
"""
104107

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

108-
# ? Do we want to support custom contributions?
109-
# contributions = SubSection(
110-
# sub_section=ForcesEntry.m_def,
111-
# description="""
112-
# Contains other forces contributions to the total atomic forces not already
113-
# defined.
114-
# """,
115-
# repeats=True,
116-
# )
117-
118-
# types = SubSection(
119-
# sub_section=ForcesEntry.m_def,
120-
# description="""
121-
# Contains other types of forces not already defined.
122-
# """,
123-
# repeats=True,
124-
# )
125-
126-
127-
class ForceContributions(ArchiveSection):
111+
112+
class ZeroTemperatureForce(Force):
128113
"""
129-
Section containing contributions to the potential energy from a classical force field.
114+
Physical property section describing...
115+
116+
Contains the value and information regarding the forces on the atoms
117+
corresponding to the minus gradient of energy_T0.
130118
"""
131119

132-
free = SubSection(sub_section=FreeForce.m_def, repeats=False)
120+
def normalize(self, archive, logger) -> None:
121+
super().normalize(archive, logger)
133122

134-
zero_temperature_force = SubSection(
135-
sub_section=ZeroTemperatureForce.m_def, repeats=False
136-
)
137123

138-
raw = SubSection(sub_section=RawForce.m_def, repeats=False)
124+
class RawForce(Force):
125+
"""
126+
Physical property section describing...
127+
128+
Value of the forces acting on the atoms **not including** such as fixed atoms,
129+
distances, angles, dihedrals, etc.
130+
"""
131+
# ? This is VERY imprecise, is this used regularly?
139132

140133
def normalize(self, archive, logger) -> None:
141134
super().normalize(archive, logger)
142-
self.name = self.m_def.name
135+
136+
137+
# ? Do we want to support custom contributions?
138+
# contributions = SubSection(
139+
# sub_section=ForcesEntry.m_def,
140+
# description="""
141+
# Contains other forces contributions to the total atomic forces not already
142+
# defined.
143+
# """,
144+
# repeats=True,
145+
# )
146+
147+
# types = SubSection(
148+
# sub_section=ForcesEntry.m_def,
149+
# description="""
150+
# Contains other types of forces not already defined.
151+
# """,
152+
# repeats=True,
153+
# )
143154

144155

145156
# Old version of the Forces description
@@ -149,28 +160,4 @@ def normalize(self, archive, logger) -> None:
149160
# Cartesian coordinates. In addition, these are obtained by filtering out the
150161
# unitary transformations (center-of-mass translations and rigid rotations for
151162
# non-periodic systems, see value_raw for the unfiltered counterpart).
152-
class TotalForce(PhysicalProperty):
153-
"""
154-
Section containing the total force of a (sub)system.
155-
156-
Contains the value and information regarding the total forces on the atoms
157-
calculated as minus gradient of energy_total.
158-
"""
159-
160-
# ! We need to avoid giving the precise method of calculation without also providing context, this is not necessarily true in general!
161163

162-
value = Quantity(
163-
type=np.float64,
164-
unit='newton',
165-
description="""
166-
The value of the total force.
167-
""",
168-
)
169-
170-
contributions = SubSection(
171-
sub_section=ForceContributions.m_def, repeats=False
172-
)
173-
# ? Do we need to separate classical and quantum contributions here?
174-
175-
def normalize(self, archive, logger) -> None:
176-
super().normalize(archive, logger)

0 commit comments

Comments
 (0)