From ee8ea4f2c59fc3f1222915b22458127885d226e9 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Sun, 9 Apr 2023 18:08:32 +0200 Subject: [PATCH] remove epsilons from integration, now 50% faster --- src/nmreval/distributions/intermolecular.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/nmreval/distributions/intermolecular.py b/src/nmreval/distributions/intermolecular.py index 31bfd88..1607361 100644 --- a/src/nmreval/distributions/intermolecular.py +++ b/src/nmreval/distributions/intermolecular.py @@ -19,7 +19,7 @@ class FFHS(Distribution): def integrand(u, tt, tau0): return FFHS.distribution(u, tau0) * np.exp(-tt/u) / u - ret_val = np.array([quad(integrand, 0, np.infty, args=(tt, tau0), epsabs=1e-12, epsrel=1e-12)[0] for tt in t]) + ret_val = np.array([quad(integrand, 0, np.infty, args=(tt, tau0))[0] for tt in t]) return ret_val @@ -29,7 +29,7 @@ class FFHS(Distribution): return u**4 * tau0 / (81 + 9*u**2 - 2*u**4 + u**6) / (u**4 + (o*tau0)**2) # return FFHS.distribution(u, tau0) * u / (1+o**2 * u**2) - ret_val = np.array([quad(integrand, 0, np.infty, args=(o, tau0), epsabs=1e-12, epsrel=1e-12)[0] for o in omega]) + ret_val = np.array([quad(integrand, 0, np.infty, args=(o, tau0))[0] for o in omega]) return ret_val * 54 / np.pi @@ -41,11 +41,9 @@ class FFHS(Distribution): def integrand_imag(u, o, tau0): return FFHS.distribution(u, tau0) * o*u / (1+o**2 * u**2) - ret_val = np.array([quad(integrand_real, 0, np.infty, args=(o, tau0), - epsabs=1e-12, epsrel=1e-12)[0] for o in omega], dtype=complex) + ret_val = np.array([quad(integrand_real, 0, np.infty, args=(o, tau0))[0] for o in omega], dtype=complex) - ret_val.imag += np.array([quad(integrand_imag, 0, np.infty, args=(o, tau0), - epsabs=1e-12, epsrel=1e-12)[0] for o in omega]) + ret_val.imag += np.array([quad(integrand_imag, 0, np.infty, args=(o, tau0))[0] for o in omega]) return ret_val