pymatgen.util.convergence module
function for calculating the convergence of an x, y data set main api:
test_conv(xs, ys, name, tol)
tries to fit multiple functions to the x, y data
calculates which function fits best for tol < 0 returns the x value for which y is converged within tol of the asymptotic value for tol > 0 returns the x_value for which dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists for the best fit a gnuplot line is printed plotting the data, the function and the asymptotic value
- exception SplineInputError(msg)[source]
Bases:
Exception
Error for Spline input
- Parameters:
msg (str) – Message
- determine_convergence(xs, ys, name, tol: float = 0.0001, extra='', verbose=False, mode='extra', plots=True)[source]
test it and at which x_value dy(x)/dx < tol for all x >= x_value, conv is true is such a x_value exists.
- extrapolate_reciprocal(xs, ys, n, noise)[source]
return the parameters such that a + b / x^n hits the last two data points
- get_derivatives(xs, ys, fd=False)[source]
return the derivatives of y(x) at the points x if scipy is available a spline is generated to calculate the derivatives if scipy is not available the left and right slopes are calculated, if both exist the average is returned putting fd to zero always returns the finite difference slopes
- id_generator(size=8, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')[source]
- Parameters:
() (chars) –
() –
Returns:
- multi_curve_fit(xs, ys, verbose)[source]
fit multiple functions to the x, y data, return the best fit
- multi_reciprocal_extra(xs, ys, noise=False)[source]
Calculates for a series of powers ns the parameters for which the last two points are at the curve. With these parameters measure how well the other data points fit. return the best fit.