generated from FAIRmat-NFDI/nomad-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jrudz
committed
Jul 11, 2024
1 parent
ab030ee
commit d3d2f17
Showing
4 changed files
with
36,326 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from nomad.metainfo import MEnum, Quantity | ||
from nomad_simulations.properties.energies import EnergyContribution | ||
|
||
|
||
class DoubleCountingEnergy(EnergyContribution): | ||
type = Quantity( | ||
type=MEnum('double_counting'), | ||
) | ||
|
||
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: | ||
super().normalize(archive, logger) | ||
|
||
if not self.type: | ||
self.type = 'double_counting' | ||
|
||
|
||
class HartreeDCEnergy(DoubleCountingEnergy): | ||
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: | ||
super().normalize(archive, logger) | ||
|
||
|
||
class XCdcEnergy(DoubleCountingEnergy): | ||
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: | ||
super().normalize(archive, logger) | ||
|
||
|
||
class UnknownEnergy(EnergyContribution): | ||
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: | ||
super().normalize(archive, logger) | ||
|
||
|
||
class TotalEnergy(nomad_simulations.schema_packages.properties.TotalEnergy): | ||
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: | ||
super().normalize(archive, logger) | ||
|
||
if not self.value: | ||
return | ||
if not self.contributions: | ||
return | ||
|
||
value = self.value | ||
unknown_energy_exists = False | ||
for contribution in self.contributions: | ||
if not contribution.value: | ||
continue | ||
if contribution.name == 'UnknownEnergy': | ||
unknown_energy_exists = True | ||
|
||
value -= contribution.value | ||
if not unknown_energy_exists: | ||
self.contributions.append(UnknownEnergy(value=value)) |
Oops, something went wrong.