@@ -24,6 +24,7 @@ def decorator(fn):
2424from . import equation_of_state as eos
2525from ..utils .math import bracket
2626from . import bukowinski_electronic as el
27+ from .anharmonic_debye_pade import AnharmonicDebyePade as Anharmonic
2728
2829
2930class ModularMGD (eos .EquationOfState ):
@@ -91,6 +92,11 @@ def pressure(self, temperature, volume, params):
9192 * (temperature * temperature - T_0 * T_0 )
9293 / volume
9394 )
95+
96+ # If the material has an anharmonic component, add it
97+ if params ["a_anh" ] is not None :
98+ P += Anharmonic .pressure (temperature , volume , params )
99+
94100 return P
95101
96102 def isothermal_bulk_modulus_reuss (self , pressure , temperature , volume , params ):
@@ -119,6 +125,7 @@ def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params):
119125 )
120126
121127 KT = KT_ref + V * d2FthdV2
128+
122129 # If the material is conductive, add the electronic contribution
123130 if params ["bel_0" ] is not None :
124131 KT += volume * el .KToverV (
@@ -129,6 +136,11 @@ def isothermal_bulk_modulus_reuss(self, pressure, temperature, volume, params):
129136 params ["bel_0" ],
130137 params ["gel" ],
131138 )
139+
140+ # If the material has an anharmonic component, add it
141+ if params ["a_anh" ] is not None :
142+ KT += Anharmonic .isothermal_bulk_modulus (temperature , volume , params )
143+
132144 return KT
133145
134146 def _molar_heat_capacity_v (self , pressure , temperature , volume , params ):
@@ -143,6 +155,11 @@ def _molar_heat_capacity_v(self, pressure, temperature, volume, params):
143155 bel_0 = params ["bel_0" ]
144156 gel = params ["gel" ]
145157 C_v += temperature * el .CVoverT (volume , params ["V_0" ], bel_0 , gel )
158+
159+ # If the material has an anharmonic component, add it
160+ if params ["a_anh" ] is not None :
161+ C_v += Anharmonic .heat_capacity_v (temperature , volume , params )
162+
146163 return C_v
147164
148165 def thermal_expansivity (self , pressure , temperature , volume , params ):
@@ -163,6 +180,10 @@ def thermal_expansivity(self, pressure, temperature, volume, params):
163180 gel = params ["gel" ]
164181 aKT += el .aKT (temperature , volume , params ["V_0" ], bel_0 , gel )
165182
183+ # If the material has an anharmonic component, add it
184+ if params ["a_anh" ] is not None :
185+ aKT += Anharmonic .dSdV (temperature , volume , params )
186+
166187 KT = self .isothermal_bulk_modulus_reuss (pressure , temperature , volume , params )
167188
168189 return aKT / KT
@@ -180,6 +201,11 @@ def entropy(self, pressure, temperature, volume, params):
180201 S += el .entropy (
181202 temperature , volume , params ["V_0" ], params ["bel_0" ], params ["gel" ]
182203 )
204+
205+ # If the material has an anharmonic component, add it
206+ if params ["a_anh" ] is not None :
207+ S += Anharmonic .entropy (temperature , volume , params )
208+
183209 return S
184210
185211 def _helmholtz_energy (self , pressure , temperature , volume , params ):
@@ -213,6 +239,10 @@ def _helmholtz_energy(self, pressure, temperature, volume, params):
213239 params ["gel" ],
214240 )
215241
242+ # If the material has an anharmonic component, add it
243+ if params ["a_anh" ] is not None :
244+ F += Anharmonic .helmholtz_energy (temperature , volume , params )
245+
216246 return F
217247
218248 # Derived properties from here
@@ -296,6 +326,11 @@ def validate_parameters(self, params):
296326 raise KeyError ("params object missing parameter : " + k )
297327
298328 # Check if material is conductive
299- if not hasattr ( params , "bel_0" ) :
329+ if "bel_0" not in params :
300330 params ["bel_0" ] = None
301331 params ["gel" ] = None
332+
333+ # Check if material has an anharmonic component
334+ if "a_anh" not in params :
335+ params ["a_anh" ] = None
336+ params ["m_anh" ] = None
0 commit comments