@@ -19,8 +19,8 @@ def bulk_modulus_fourth(volume, params):
19
19
modulus. Pressure must be in :math:`[Pa]`.
20
20
"""
21
21
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 )
24
24
25
25
Xi = (3.0 / 4.0 ) * (4.0 - params ["Kprime_0" ])
26
26
Zeta = (3.0 / 8.0 ) * (
@@ -45,24 +45,46 @@ def bulk_modulus_fourth(volume, params):
45
45
46
46
47
47
def volume_fourth_order (pressure , params ):
48
- func = lambda x : birch_murnaghan_fourth (params ["V_0" ] / x , params ) - pressure
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
+ """
60
+
61
+ def delta_pressure (x ):
62
+ return pressure_birch_murnaghan_fourth (params ["V_0" ] / x , params ) - pressure
63
+
49
64
try :
50
- sol = bracket (func , params ["V_0" ], 1.0e-2 * params ["V_0" ])
51
- except :
65
+ sol = bracket (delta_pressure , params ["V_0" ], 1.0e-2 * params ["V_0" ])
66
+ except ValueError :
52
67
raise ValueError (
53
68
"Cannot find a volume, perhaps you are outside of the range of validity for the equation of state?"
54
69
)
55
- return opt .brentq (func , sol [0 ], sol [1 ])
70
+ return opt .brentq (delta_pressure , sol [0 ], sol [1 ])
56
71
57
72
58
- def birch_murnaghan_fourth ( x , params ):
73
+ def pressure_birch_murnaghan_fourth ( invVrel , params ):
59
74
"""
60
- equation for the fourth order birch-murnaghan equation of state, returns
61
- 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
62
83
modulus (params['K_0'])
84
+ :rtype: float or numpy array
63
85
"""
64
86
65
- f = 0.5 * (pow (x , 2.0 / 3.0 ) - 1.0 )
87
+ f = 0.5 * (pow (invVrel , 2.0 / 3.0 ) - 1.0 )
66
88
Xi = (3.0 / 4.0 ) * (4.0 - params ["Kprime_0" ])
67
89
Zeta = (3.0 / 8.0 ) * (
68
90
(params ["K_0" ] * params ["Kprime_prime_0" ])
@@ -93,7 +115,7 @@ def volume(self, pressure, temperature, params):
93
115
return volume_fourth_order (pressure , params )
94
116
95
117
def pressure (self , temperature , volume , params ):
96
- return birch_murnaghan_fourth ( volume / params ["V_0" ], params )
118
+ return pressure_birch_murnaghan_fourth ( params ["V_0" ] / volume , params )
97
119
98
120
def isothermal_bulk_modulus_reuss (self , pressure , temperature , volume , params ):
99
121
"""
0 commit comments