def calc(): ## optimized basis set b = STOs() b.add(2, 0.9965751177 -0.0013743026j) b.add(2, 1.0030366528 -0.2836728004j) b.add(2, 0.8462928140 -0.6952686244j) b.add(2, 0.4818046345 -1.0023929406j) b.add(2, 0.1412093744 -1.0662761427j) b.setup() ## velocity driven term driv = LC_STOs() driv.add(2.0, 2, 1.0) ## print claculation inputs f.write("calculation of hydrogen atom photoionization in length form\n") f.write("solve radial equation\n") f.write("(H-E)psi=driv\n") f.write("\n") f.write(">>> INPUTS >>> \n") f.write("L = {0}\n".format(L)) f.write("energy = {0}\n".format(ene)) f.write("driv = {0}\n".format(driv.str())) f.write("basis = \n") f.write("grid = ({0}, {1})".format(n, h)) f.write(b.str()) ## calculation lmat = ( b.calc_d2_mat()* (-0.5) + b.calc_rm_mat(-2)* (0.5*(L*(L+1))) + b.calc_rm_mat(-1) * (-1.0) + b.calc_rm_mat(0) * (-ene)) mvec = b.calc_vec(driv) cs = solve(lmat, mvec) alpha = np.dot(cs, mvec) ## calculate by CBF rs = np.linspace(0, 100, 300) ys = np.array(b.at_r(rs, cs)) df = pd.DataFrame([rs, ys.real, ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(psi_csv, index=False) ## calculate by grid s = lambda r: driv.at_r([r])[0] v = lambda r: L*(L+1)/(2.0*r*r) -1.0/r (rs, ys) = solve_driv(v, ene, s, n, h) df = pd.DataFrame([rs.real, ys.real, ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(grid_csv, index=False) ## print outpus f.write("\n>>> RESULTS >>> \n") f.write("psi_csv = {0}\n".format(psi_csv)) f.write("grid_csv = {0}\n".format(grid_csv)) f.write("cs = \n") for c in cs: f.write("{0}\n".format(c)) f.write("alpha = {0} {1}\n".format(alpha.real, alpha.imag))
def calc(): ## optimized basis set b = STOs() b.add(2, 0.9965751177 - 0.0013743026j) b.add(2, 1.0030366528 - 0.2836728004j) b.add(2, 0.8462928140 - 0.6952686244j) b.add(2, 0.4818046345 - 1.0023929406j) b.add(2, 0.1412093744 - 1.0662761427j) b.setup() ## velocity driven term driv = LC_STOs() driv.add(2.0, 2, 1.0) ## print claculation inputs f.write("calculation of hydrogen atom photoionization in length form\n") f.write("solve radial equation\n") f.write("(H-E)psi=driv\n") f.write("\n") f.write(">>> INPUTS >>> \n") f.write("L = {0}\n".format(L)) f.write("energy = {0}\n".format(ene)) f.write("driv = {0}\n".format(driv.str())) f.write("basis = \n") f.write("grid = ({0}, {1})".format(n, h)) f.write(b.str()) ## calculation lmat = (b.calc_d2_mat() * (-0.5) + b.calc_rm_mat(-2) * (0.5 * (L * (L + 1))) + b.calc_rm_mat(-1) * (-1.0) + b.calc_rm_mat(0) * (-ene)) mvec = b.calc_vec(driv) cs = solve(lmat, mvec) alpha = np.dot(cs, mvec) ## calculate by CBF rs = np.linspace(0, 100, 300) ys = np.array(b.at_r(rs, cs)) df = pd.DataFrame([rs, ys.real, ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(psi_csv, index=False) ## calculate by grid s = lambda r: driv.at_r([r])[0] v = lambda r: L * (L + 1) / (2.0 * r * r) - 1.0 / r (rs, ys) = solve_driv(v, ene, s, n, h) df = pd.DataFrame([rs.real, ys.real, ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(grid_csv, index=False) ## print outpus f.write("\n>>> RESULTS >>> \n") f.write("psi_csv = {0}\n".format(psi_csv)) f.write("grid_csv = {0}\n".format(grid_csv)) f.write("cs = \n") for c in cs: f.write("{0}\n".format(c)) f.write("alpha = {0} {1}\n".format(alpha.real, alpha.imag))
import sys import numpy as np sys.path.append("../../") from driv_grid import solve_driv ## system L = 1.0 ene = 0.5 ## driven term s = lambda r: 2.0 * r * r * np.exp(-r) ## potential v = lambda r: -1.0/r + L*(L+1)/(2.0*r*r) ## grid points n = 1000 h = 0.1 ## calculate (rs, ys) = solve_driv(v, ene, s, n, h) ## write with open("h_length.csv", "w") as f: for (r, y) in zip(rs, ys): f.write("{0},{1},{2}\n".format(r, y.real, y.imag))
import sys sys.path.append("../../../src_py/driv_grid") from driv_grid import solve_driv sys.path.append("../../../r1basis") from opt_green import * grid_csv = "grid.csv" channel = '1s->kp' dipole = 'length' h_pi = H_Photoionization(channel, dipole) L = h_pi.L1 w0 = 1.0 n = 1000 h = 0.1 s = lambda r: h_pi.driv.at_r([r])[0] v = lambda r: L * (L + 1) / (2.0 * r * r) - 1.0 / r (rs, ys) = solve_driv(v, w0 + h_pi.E0, s, n, h) df = pd.DataFrame([rs.real, -ys.real, -ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(grid_csv, index=False)
## system L = 1.0 ene = 0.5 ## driven term s = lambda r: 2.0 * r * r * np.exp(-r) ## potential v = lambda r: -1.0/r + L*(L+1)/(2.0*r*r) ## grid points n = 10000 h = 0.1 ## calculate (rs, ys) = solve_driv(v, ene, s, n, h) ## write with open("h_length.csv", "w") as f: for (r, y) in zip(rs, ys): f.write("{0},{1},{2}\n".format(r, y.real, y.imag)) ## compute dipole, written as M in the paper k = np.sqrt(2.0 * ene) y = ys[-2] r = rs[-2] print "dip = ", abs(y*k / (4*np.exp(complex(0, k*r - np.pi*L/2.0 + 1.0/k * np.log(2*k*r) )))) ## compute dipole from matrix element of Green's operator xs = np.array([(i+1)*h for i in range(n)]) ss = np.array([s(x) for x in xs])
import sys sys.path.append("../../../src_py/driv_grid") from driv_grid import solve_driv sys.path.append("../../../r1basis") from opt_green import * grid_csv = "grid.csv" channel = '1s->kp' dipole = 'length' h_pi = H_Photoionization(channel, dipole) L = h_pi.L1 w0 = 1.0 n = 1000 h = 0.1 s = lambda r: h_pi.driv.at_r([r])[0] v = lambda r: L*(L+1)/(2.0*r*r) -1.0/r (rs, ys) = solve_driv(v, w0+h_pi.E0, s, n, h) df = pd.DataFrame([rs.real, -ys.real, -ys.imag]).T df.columns = ["r", "re_y", "im_y"] df.to_csv(grid_csv, index=False)