|
| 1 | +# |
| 2 | +# Copyright The NOMAD Authors. |
| 3 | +# |
| 4 | +# This file is part of NOMAD. See https://nomad-lab.eu for further info. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +# |
| 18 | +# |
| 19 | +# Copyright The NOMAD Authors. |
| 20 | +# |
| 21 | +# This file is part of NOMAD. |
| 22 | +# See https://nomad-lab.eu for further info. |
| 23 | +# |
| 24 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 25 | +# you may not use this file except in compliance with the License. |
| 26 | +# You may obtain a copy of the License at |
| 27 | +# |
| 28 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 29 | +# |
| 30 | +# Unless required by applicable law or agreed to in writing, software |
| 31 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 32 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 33 | +# See the License for the specific language governing permissions and |
| 34 | +# limitations under the License. |
| 35 | +# |
| 36 | + |
| 37 | +import numpy as np |
| 38 | +from nomad.metainfo import Quantity, SubSection, MEnum |
| 39 | +from .physical_property import PhysicalProperty |
| 40 | + |
| 41 | +class Enthalpy(PhysicalProperty): |
| 42 | + """ |
| 43 | + Section containing the enthalpy (i.e. energy_total + pressure * volume.) of a (sub)system. |
| 44 | + """ |
| 45 | + |
| 46 | + value = Quantity( |
| 47 | + type=np.float64, |
| 48 | + unit='joule', |
| 49 | + description=""" |
| 50 | + Value of the enthalpy. |
| 51 | + """, |
| 52 | + ) |
| 53 | + |
| 54 | + def normalize(self, archive, logger) -> None: |
| 55 | + super().normalize(archive, logger) |
| 56 | + |
| 57 | +class Entropy(PhysicalProperty): |
| 58 | + """ |
| 59 | + Section containing the entropy of a (sub)system. |
| 60 | + """ |
| 61 | + |
| 62 | + value = Quantity( |
| 63 | + type=np.float64, |
| 64 | + unit='joule / kelvin', |
| 65 | + description=""" |
| 66 | + Value of the entropy. |
| 67 | + """, |
| 68 | + ) |
| 69 | + |
| 70 | + def normalize(self, archive, logger) -> None: |
| 71 | + super().normalize(archive, logger) |
| 72 | + |
| 73 | +class ChemicalPotential(PhysicalProperty): |
| 74 | + """ |
| 75 | + Section containing the chemical potential of a (sub)system. |
| 76 | + """ |
| 77 | + |
| 78 | + value = Quantity( |
| 79 | + type=np.float64, |
| 80 | + unit='joule', |
| 81 | + description=""" |
| 82 | + Value of the chemical potential. |
| 83 | + """, |
| 84 | + ) |
| 85 | + |
| 86 | + def normalize(self, archive, logger) -> None: |
| 87 | + super().normalize(archive, logger) |
| 88 | + |
| 89 | +class Pressure(PhysicalProperty): |
| 90 | + """ |
| 91 | + Section containing the pressure of a (sub)system. |
| 92 | + """ |
| 93 | + |
| 94 | + value = Quantity( |
| 95 | + type=np.float64, |
| 96 | + unit='pascal', |
| 97 | + description=""" |
| 98 | + Value of the pressure. |
| 99 | + """, |
| 100 | + ) |
| 101 | + |
| 102 | + def normalize(self, archive, logger) -> None: |
| 103 | + super().normalize(archive, logger) |
| 104 | + |
| 105 | +class Virial(PhysicalProperty): |
| 106 | + """ |
| 107 | + Section containing the virial (cross product between positions and forces) of a (sub)system. |
| 108 | + """ |
| 109 | + |
| 110 | + value = Quantity( |
| 111 | + type=np.float64, |
| 112 | + unit='joule', |
| 113 | + description=""" |
| 114 | + Value of the pressure. |
| 115 | + """, |
| 116 | + ) |
| 117 | + |
| 118 | + def normalize(self, archive, logger) -> None: |
| 119 | + super().normalize(archive, logger) |
| 120 | + |
| 121 | +class Temperature(PhysicalProperty): |
| 122 | + """ |
| 123 | + Section containing the temperature of a (sub)system. |
| 124 | + """ |
| 125 | + |
| 126 | + value = Quantity( |
| 127 | + type=np.float64, |
| 128 | + unit='kelvin', |
| 129 | + description=""" |
| 130 | + Value of the pressure. |
| 131 | + """, |
| 132 | + ) |
| 133 | + |
| 134 | + def normalize(self, archive, logger) -> None: |
| 135 | + super().normalize(archive, logger) |
| 136 | + |
| 137 | +class Volume(PhysicalProperty): |
| 138 | + """ |
| 139 | + Section containing the volume of a (sub)system. |
| 140 | + """ |
| 141 | + |
| 142 | + value = Quantity( |
| 143 | + type=np.float64, |
| 144 | + unit='m ** 3', |
| 145 | + description=""" |
| 146 | + Value of the volume. |
| 147 | + """, |
| 148 | + ) |
| 149 | + |
| 150 | + def normalize(self, archive, logger) -> None: |
| 151 | + super().normalize(archive, logger) |
| 152 | + |
| 153 | +class Density(PhysicalProperty): |
| 154 | + """ |
| 155 | + Section containing the density of a (sub)system. |
| 156 | + """ |
| 157 | + |
| 158 | + value = Quantity( |
| 159 | + type=np.float64, |
| 160 | + unit='kg / m ** 3', |
| 161 | + description=""" |
| 162 | + Value of the density. |
| 163 | + """, |
| 164 | + ) |
| 165 | + |
| 166 | + def normalize(self, archive, logger) -> None: |
| 167 | + super().normalize(archive, logger) |
| 168 | + |
| 169 | +# ? Does this go here or in energies? |
| 170 | +# ? Naming specific to Potential Energy? |
| 171 | +class Hessian(PhysicalProperty): |
| 172 | + """ |
| 173 | + Section containing the Hessian matrix, i.e., 2nd derivatives with respect to geometric (typically particle) displacements, |
| 174 | + of the potential energy of a (sub)system. |
| 175 | + """ |
| 176 | + |
| 177 | + value = Quantity( |
| 178 | + type=np.float64, |
| 179 | + unit='joule / m ** 2', |
| 180 | + description=""" |
| 181 | + Value of the Hessian. |
| 182 | + """, |
| 183 | + ) |
| 184 | + |
| 185 | + def normalize(self, archive, logger) -> None: |
| 186 | + super().normalize(archive, logger) |
| 187 | + |
| 188 | + |
| 189 | +class HeatCapacityCV(PhysicalProperty): |
| 190 | + """ |
| 191 | + Section containing the heat capacity at constant volume for a (sub)system. |
| 192 | + """ |
| 193 | + |
| 194 | + value = Quantity( |
| 195 | + type=np.float64, |
| 196 | + unit='joule / kelvin', |
| 197 | + description=""" |
| 198 | + Value of the heat capacity. |
| 199 | + """, |
| 200 | + ) |
| 201 | + |
| 202 | +class HeatCapacityCP(PhysicalProperty): |
| 203 | + """ |
| 204 | + Section containing the heat capacity at constant volume for a (sub)system. |
| 205 | + """ |
| 206 | + |
| 207 | + value = Quantity( |
| 208 | + type=np.float64, |
| 209 | + unit='joule / kelvin', |
| 210 | + description=""" |
| 211 | + Value of the heat capacity. |
| 212 | + """, |
| 213 | + ) |
| 214 | + |
| 215 | + def normalize(self, archive, logger) -> None: |
| 216 | + super().normalize(archive, logger) |
| 217 | + |
| 218 | + |
| 219 | + # ? Is this ever used? |
| 220 | + # internal_energy = Quantity( |
| 221 | + # type=np.dtype(np.float64), |
| 222 | + # shape=[], |
| 223 | + # unit='joule', |
| 224 | + # description=""" |
| 225 | + # Value of the internal energy. |
| 226 | + # """, |
| 227 | + # ) |
| 228 | + |
| 229 | + # vibrational_free_energy_at_constant_volume = Quantity( |
| 230 | + # type=np.dtype(np.float64), |
| 231 | + # shape=[], |
| 232 | + # unit='joule', |
| 233 | + # description=""" |
| 234 | + # Value of the vibrational free energy per cell unit at constant volume. |
| 235 | + # """, |
| 236 | + # ) |
| 237 | + |
| 238 | + |
0 commit comments