EOS package¶
EOS.EOS module¶
Created on Wed Dec 9 10:51:00 2014
@author: Matti Ropo @author: Henrik Levämäki
-
class
EOS.EOS.EOS(name, xc='PBE', method='morse', units='bohr', warnings=True)[source]¶ Bases:
objectFit equation of state for bulk systems.
The following equations are available:
morse PRB 37, 790 (1988) sjeos PRB 63, 224115 (2001) taylor A third order Taylor series expansion about the minimum volume murnaghan PRB 28, 5480 (1983) birch Intermetallic compounds: Principles and Practice, Vol I: Principles. pages 195-210 birchmurnaghan PRB 70, 224107 pouriertarantola PRB 70, 224107 vinet PRB 70, 224107 antonschmidt Intermetallics 11, 23-32 (2003) oldpoly A third order polynomial fit (alternative implementation) Usage:
eos = EquationOfState(volumes, energies, eos='murnaghan') v0, e0, B = eos.fit() eos.plot()
Parameters: - name –
- xc – (Default value = ‘PBE’)
- method – (Default value = ‘morse’)
- units – (Default value = ‘bohr’)
Returns: Return type: -
antonschmidt(V, Einf, B, n, V0)[source]¶ From Intermetallics 11, 23-32 (2003)
Einf should be E_infinity, i.e. infinite separation, but according to the paper it does not provide a good estimate of the cohesive energy. They derive this equation from an empirical formula for the volume dependence of pressure,
E(vol) = E_inf + int(P dV) from V=vol to V=infinity
but the equation breaks down at large volumes, so E_inf is not that meaningful
n should be about -2 according to the paper.
I find this equation does not fit volumetric data as well as the other equtions do.
Parameters: - V –
- Einf –
- B –
- n –
- V0 –
Returns: Energy
Return type: float
-
birch(V, E0, B0, BP, V0)[source]¶ From Intermetallic compounds: Principles and Practice, Vol. I: Principles Chapter 9 pages 195-210 by M. Mehl. B. Klein, D. Papaconstantopoulos paper downloaded from Web
case where n=0
Parameters: - V –
- E0 –
- B0 –
- BP –
- V0 –
Returns: Return type:
-
birchmurnaghan(V, E0, B0, BP, V0)[source]¶ BirchMurnaghan equation from PRB 70, 224107
Parameters: - V –
- E0 –
- B0 –
- BP –
- V0 –
Returns: Return type:
-
ca_fit(x, y, n, debug=False, title='', find_best_fit=False)[source]¶ Fits a polynomial to x vs. y data and calculates xmin and ymin from the curve.
Parameters: - x –
- y –
- n –
Returns: Return type:
-
compute_eos_fit()[source]¶ Performs the least-squares curve fitting for the chosen EOS function. Ground state quantities are returned.
-
distortion_fit(x, y, num=2, title='', ascii_art=False)[source]¶ Fits the distortion_poly function to the distortion data.
- num : number of variables in the fitting function
- 1 : E=a2*x**2 2 : E=a2*x**2 + a0 3 : E=a2*x**2 + a1*x + a0
The fit coefficient(s) and r-squared describing the accuracy of the fit are returned.
Parameters: - x –
- y –
- num – (Default value = 2)
Returns: Return type:
-
distortion_poly1(x, a2)[source]¶ - One variable form of the 2nd order polynomial
- which is used to fitting distortion vs. energy data in order to find elastic constants.
Parameters: - x –
- a2 –
- a1 –
Returns: Return type:
-
distortion_poly2(x, a2, a0)[source]¶ - Two variable form of the 2nd order polynomial
- which is used to fitting distortion vs. energy data in order to find elastic constants.
Parameters: - x –
- a2 –
- a0 –
Returns: Return type:
-
distortion_poly3(x, a2, a1, a0)[source]¶ - Three variable form of the 2nd order polynomial
- which is used to fitting distortion vs. energy data in order to find elastic constants.
Parameters: - x –
- a2 –
- a1 –
- a0 –
Returns: Return type:
-
fit(swses, energies, shift=False, show_plot=False, show_output=True, pressure=False)[source]¶ Calculate volume, energy, and bulk modulus.
About the units:
Input “swses” should be the WS-radii in bohr. Input “energies” should be the energies in Ry.
Volumes are always in Angstrom**3 Bulk moduli are always in GPa
Parameters: - swses (list(float)) – List of WS-radii
- energies (list(float)) – List of energies
- shift (True or False) – Shift the energies so that the lowest energy is zero. Improves fit quality. Sometimes instable.
Returns: Eq. WS-rad, energy, bulk modulus, Gruneisen parameter
Return type: float, float, float, float
-
fit_eval(sws)[source]¶ Evaluate the fitting function at given points
Parameters: sws – Returns: Return type:
-
murnaghan(V, E0, B0, BP, V0)[source]¶ From PRB 28,5480 (1983)
Parameters: - V –
- E0 –
- B0 –
- BP –
- V0 –
Returns: Return type:
-
oldpoly(V, c0, c1, c2, c3)[source]¶ polynomial fit, 3rd order
Parameters: - V –
- c0 –
- c1 –
- c2 –
- c3 –
Returns: Energy
Return type: float
-
parabola(x, a, b, c)[source]¶ Parabola polynomial function
This function is used to fit the data to get good guesses for the equation of state fits.
A 4th order polynomial fit to get good guesses for was not a good idea because for noisy data the fit is too wiggly 2nd order seems to be sufficient, and guarentees a single minimum.
Parameters: - x –
- a –
- b –
- c –
Returns: Energy
Return type: float
-
plot(filename=None, show=True)[source]¶ Plot fitted energy curve.
Uses Matplotlib to plot the energy curve. Use show=True to show the figure and filename=’abc.png’ or filename=’abc.eps’ to save the figure to a file.
Parameters: - filename – (Default value = None)
- show – (Default value = None)
Returns: Return type:
-
pouriertarantola(V, E0, B0, BP, V0)[source]¶ Pourier-Tarantola equation from PRB 70, 224107
Parameters: - V –
- E0 –
- B0 –
- BP –
- V0 –
Returns: Return type:
-
predicted()[source]¶ Evaluates the EOS function using the calc. EOS params.
Returns: EOS function Return type: func
-
relax_fit(x, y, n, debug=False, title='')[source]¶ Fits a polynomial to x vs. y data and calculates xmin and ymin from the curve.
Parameters: - x –
- y –
- n –
Returns: Return type:
-
sjeos(V, a, b, c, d)[source]¶ Stabilized jellium (SJEOS) fitting function from PRB 63, 224115 (2001).
- Note: EOS parameters here differ from the PRB definitions
- by having V0 being included in them. a(PRB) = a/V0 b(PRB) = b/V0**(2/3) c(PRB) = c/V0**(1/3)
-
taylor(V, E0, beta, alpha, V0)[source]¶ Taylor Expansion up to 3rd order about V0
Parameters: - V –
- E0 –
- beta –
- alpha –
- V0 –
Returns: Return type:
-
EOS.EOS.curve_fit(f, x, y, p0)[source]¶ Fits an arbitraty function to data (x,y).
This part comes from: http://projects.scipy.org/scipy/browser/trunk/scipy/optimize/minpack.py
Parameters: - f –
- x –
- y –
- p0 –
Returns: Return type: