def GammaDLT0(t, kappa, Omega, diff=0): ''' The decoherence function of the Drude-Lorentz cutoff for T = 0. See Eq.(A9) of Sato J.Chem.Phys.150(2019)224108 diff = 0 : the order of differentiation with respect to time ''' cosh = np.cosh(Omega * t) sinh = np.sinh(Omega * t) # Note: Shi(z) = shici(z)[0] and Chi(z) = shici(z)[1] Shi = shichi(Omega * t)[0] Chi = shichi(Omega * t)[1] if diff == 0: val = sinh * Shi - cosh * Chi val += EulerGamma + np.log(Omega * t) return kappa * val elif diff == 1: val = cosh * Shi - sinh * Chi return kappa * Omega * val elif diff == 2: val = sinh * Shi - cosh * Chi return kappa * Omega**2 * val else: return 0
def test_shichi_consistency(): # Make sure the implementation of shichi for real arguments agrees # with the implementation of shichi for complex arguments. # On the negative real axis Cephes drops the imaginary part in chi def shichi(x): shi, chi = sc.shichi(x + 0j) return shi.real, chi.real # Overflow happens quickly, so limit range x = np.r_[-np.logspace(np.log10(700), -30, 200), 0, np.logspace(-30, 2, np.log10(700))] shi, chi = sc.shichi(x) dataset = np.column_stack((x, shi, chi)) FuncData(shichi, dataset, 0, (1, 2), rtol=1e-14).check()
def test_shichi_consistency(): # Make sure the implementation of shichi for real arguments agrees # with the implementation of shichi for complex arguments. # On the negative real axis Cephes drops the imaginary part in chi def shichi(x): shi, chi = sc.shichi(x + 0j) return shi.real, chi.real # Overflow happens quickly, so limit range x = np.r_[-np.logspace(np.log10(700), -30, 200), 0, np.logspace(-30, np.log10(700), 200)] shi, chi = sc.shichi(x) dataset = np.column_stack((x, shi, chi)) FuncData(shichi, dataset, 0, (1, 2), rtol=1e-14).check()
def exparg(h, k=k1, tb=tbath): """ Argument of the exponentials in the solution of the MCE equation where the magnetic field dependence of the heat capacity C is taken into account. See Wolfram alpha for a human readable version of the solution of the equation Parameters ---------- h : array Reduced magnetic field H/Hc0. k : scalar, optional Prefactor of the second term in the RHS of the equation. The default is k1. tb : scalar, optional Reduced bath temperature Tbat/Tc0. The default is tbath. Returns ------- y : array Final computed quantity. """ y = - k * tb * shichi(2*h/tb)[0] + \ k * tb**2 / (2*h) * (1 + np.cosh(2*h/tb)) return y
def shichi(x): shi, chi = sc.shichi(x + 0j) return shi.real, chi.real
def chi(x): return sc.shichi(x)[1]
def shi(x): return sc.shichi(x)[0]
#add EAGT 12 gsl functions eagt_12f_name=['gsl_airy_ai','gsl_sf_Chi','gsl_sf_Ci','gsl_sf_bessel_J0','gsl_sf_bessel_J1','gsl_sf_bessel_Y0','gsl_sf_bessel_Y1','gsl_sf_eta','gsl_sf_gamma','gsl_sf_legendre_P2','gsl_sf_legendre_P3','gsl_sf_lngamma'] eagt_12f_tmpn=['gsl_airy_ai','gsl_sf_bessel_Y1','gsl_sf_bessel_Y0','gsl_sf_bessel_J1','gsl_sf_bessel_J0','gsl_sf_Chi','gsl_sf_gamma','gsl_sf_Ci','gsl_sf_lngamma','gsl_sf_legendre_P2','gsl_sf_legendre_P3'] gsl_airy_ai = lambda t: sf.airy_Ai(t, 0) bessely1 = lambda t: bessely(1, t) bessely0 = lambda t: bessely(0, t) besselj1 = lambda t: besselj(1, t) besselj0 = lambda t: besselj(0, t) legendre3 = lambda t: legendre(3, t) legendre2 = lambda t: legendre(2, t) pyairyai = lambda z: sc.airy(z)[0] pybessely1 = sc.y1 pybessely0 = sc.y0 pybesselj1 = sc.j1 pybesselj0 = sc.j0 pychi = lambda z: sc.shichi(z)[1] pyeta = lambda x: (1.0-math.pow(2.0,1.0-x))*sc.zeta(x,1) pygamma = sc.gamma pyci = lambda z:sc.sici(z)[1] pyloggamma = lambda z: (sc.loggamma(z)).real pylegendre3 = lambda x: sc.eval_legendre(3, x) pylegendre2 = lambda x: sc.eval_legendre(2, x) rf_12_l = [airyai,bessely1,bessely0,besselj1,besselj0,chi,altzeta,gamma,ci,loggamma,legendre3,legendre2] gf_12_l = [gsl_airy_ai,sf.bessel_Y1,sf.bessel_Y0,sf.bessel_J1,sf.bessel_J0,sf.Chi,sf.eta,sf.gamma,sf.Ci,sf.lngamma,sf.legendre_P3,sf.legendre_P2] pf_12_l = [pyairyai,pybessely1,pybessely0,pybesselj1,pybesselj0,pychi,pyeta,pygamma,pyci,pyloggamma,pylegendre3,pylegendre2] input_domain_12 = [[[-823549.6645, 102]],[[1.0, 1.7e10]],[[1.0, 1.7e10]],[[0, 1.7e+100]],[[0, 1.7e+100]],[[0, 700]],[[-168, 100]],[[-168, 168]],[[1.0, 823549]],[[0.0, 1000.0]],[[-1.7976931348623157e+10, 1.7976931348623157e+10]],[[-1.7976931348623157e+10, 1.7976931348623157e+10]]] input_domain_12_py = [[[-823549.6645, 102]],[[1.0, 1.7e10]],[[1.0, 1.7e10]],[[0, 1.7e+100]],[[0, 1.7e+100]],[[0, 700]],[[1, 100]],[[0, 168]],[[1.0, 823549]],[[0.0, 1000.0]],[[-1.7976931348623157e+10, 1.7976931348623157e+10]],[[-1.7976931348623157e+10, 1.7976931348623157e+10]]] # The iteration number n_r_iter = 20 mp.pre = 200 x = 1.2414480316687057e+40