@@ -19,8 +19,8 @@ def bulk_modulus_fourth(volume, params):
1919 modulus. Pressure must be in :math:`[Pa]`.
2020 """
2121
22- x = params ["V_0" ] / volume
23- f = 0.5 * (pow (x , 2.0 / 3.0 ) - 1.0 )
22+ invVrel = params ["V_0" ] / volume
23+ f = 0.5 * (pow (invVrel , 2.0 / 3.0 ) - 1.0 )
2424
2525 Xi = (3.0 / 4.0 ) * (4.0 - params ["Kprime_0" ])
2626 Zeta = (3.0 / 8.0 ) * (
@@ -45,27 +45,46 @@ def bulk_modulus_fourth(volume, params):
4545
4646
4747def volume_fourth_order (pressure , params ):
48+ """
49+ Volume according to the fourth-order
50+ Birch-Murnaghan equation of state.
51+
52+ :param pressure: Pressure in the same units that are supplied for the reference bulk
53+ modulus (params['K_0'])
54+ :type pressure: float
55+ :param params: parameter dictionary
56+ :type params: dictionary
57+ :return: V/V_0
58+ :rtype: float
59+ """
4860
4961 def delta_pressure (x ):
50- return birch_murnaghan_fourth (params ["V_0" ] / x , params ) - pressure
62+ return pressure_birch_murnaghan_fourth (params ["V_0" ] / x , params ) - pressure
5163
5264 try :
5365 sol = bracket (delta_pressure , params ["V_0" ], 1.0e-2 * params ["V_0" ])
54- except :
66+ except ValueError :
5567 raise ValueError (
5668 "Cannot find a volume, perhaps you are outside of the range of validity for the equation of state?"
5769 )
5870 return opt .brentq (delta_pressure , sol [0 ], sol [1 ])
5971
6072
61- def birch_murnaghan_fourth ( x , params ):
73+ def pressure_birch_murnaghan_fourth ( invVrel , params ):
6274 """
63- equation for the fourth order birch-murnaghan equation of state, returns
64- pressure in the same units that are supplied for the reference bulk
75+ Pressure according to the fourth-order
76+ Birch-Murnaghan equation of state.
77+
78+ :param invVrel: V/V_0
79+ :type invVrel: float or numpy array
80+ :param params: parameter dictionary
81+ :type params: dictionary
82+ :return: Pressure in the same units that are supplied for the reference bulk
6583 modulus (params['K_0'])
84+ :rtype: float or numpy array
6685 """
6786
68- f = 0.5 * (pow (x , 2.0 / 3.0 ) - 1.0 )
87+ f = 0.5 * (pow (invVrel , 2.0 / 3.0 ) - 1.0 )
6988 Xi = (3.0 / 4.0 ) * (4.0 - params ["Kprime_0" ])
7089 Zeta = (3.0 / 8.0 ) * (
7190 (params ["K_0" ] * params ["Kprime_prime_0" ])
@@ -96,7 +115,7 @@ def volume(self, pressure, temperature, params):
96115 return volume_fourth_order (pressure , params )
97116
98117 def pressure (self , temperature , volume , params ):
99- return birch_murnaghan_fourth (params ["V_0" ] / volume , params )
118+ return pressure_birch_murnaghan_fourth (params ["V_0" ] / volume , params )
100119
101120 def isothermal_bulk_modulus_reuss (self , pressure , temperature , volume , params ):
102121 """
0 commit comments