sarkas.potentials.yukawa.calc_force_error_quad
sarkas.potentials.yukawa.calc_force_error_quad#
- sarkas.potentials.yukawa.calc_force_error_quad(a, rc, pot_matrix)[source]#
Calculate the force error by integrating the square modulus of the force over the neglected volume.n The force error is calculated from
\[\Delta F = \left [ 4 \pi \int_{r_c}^{\infty} dr \, r^2 \left ( \frac{d\phi(r)}{r} \right )^2 ]^{1/2}\]where \(\phi(r)\) is only the radial part of the potential, \(r_c\) is the cutoff radius, and \(r\) is scaled by the input parameter a.n The integral is calculated using scipy.integrate.quad. The derivative of the potential is obtained from
potential_derivatives().- Parameters
a (float) – Rescaling length. Usually it is the Wigner-Seitz radius.
rc (float) – Cutoff radius to be used as the lower limit of the integral. The lower limit is actually rc /a.
pot_matrix (numpy.ndarray) – Slice of the sarkas.potentials.Potential.matrix containing the parameters of the potential. It must be a 1D-array.
- Returns
f_err (float) – Force error. It is the sqrt root of the integral. It is calculated using scipy.integrate.quad and
potential_derivatives().
Examples
>>> import numpy as np >>> potential_matrix = np.zeros(2) >>> a = 1.0 # Wigner-seitz radius >>> kappa = 2.0 # in units of a_ws >>> potential_matrix[1] = kappa >>> rc = 6.0 # in units of a_ws >>> calc_force_error_quad(a, rc, potential_matrix) 6.636507826720378e-06