def test_gto_nuclear(self): """ Test nuclear attraction integral for GTOs V^{(c)}_ij = <gto_i | -1 / |r-Rc| | gto_j> """ # construct integrator object integrator = PyQInt() # test GTO gto1 = gto(0.154329, [0.0, 0.0, 0.0], 3.425251, 0, 0, 0) gto2 = gto(0.535328, [0.0, 0.0, 0.0], 0.623914, 0, 0, 0) gto3 = gto(0.444635, [0.0, 0.0, 0.0], 0.168855, 0, 0, 0) nuclear = integrator.nuclear_gto(gto1, gto1, [0.0, 0.0, 1.0]) result = -0.31049036979675293 np.testing.assert_almost_equal(nuclear, result, 4)
def test_gto_repulsion(self): """ Test two-electron integrals for primitive GTOs (ij|kl) = <gto_i gto_j | r_ij | gto_k gto_l> """ # construct integrator object integrator = PyQInt() # test GTO gto1 = gto(0.154329, [0.0, 0.0, 0.0], 3.425251, 0, 0, 0) gto2 = gto(0.535328, [0.0, 0.0, 0.0], 0.623914, 0, 0, 0) gto3 = gto(0.444635, [0.0, 0.0, 0.0], 0.168855, 0, 0, 0) repulsion = integrator.repulsion_gto(gto1, gto1, gto1, gto1) result = 0.20141123130697272 np.testing.assert_almost_equal(repulsion, result, 4)
def calculate_fy_bf_finite_difference(_gto, nucleus): """ Calculate the basis function derivative in the y-direction using a finite difference method """ # build integrator object integrator = PyQInt() diff = 0.01 gto1 = gto(0.154329, [_gto.p[0], _gto.p[1] - diff / 2, _gto.p[2]], 3.425251, _gto.l, _gto.m, _gto.n) gto2 = gto(0.154329, [_gto.p[0], _gto.p[1] + diff / 2, _gto.p[2]], 3.425251, _gto.l, _gto.m, _gto.n) left = integrator.nuclear_gto(gto1, gto1, nucleus) right = integrator.nuclear_gto(gto2, gto2, nucleus) return (right - left) / diff
def testDerivRepulsionGTO(self): # construct integrator object integrator = PyQInt() # build gtos gto1 = gto(0.154329, [-0.50, 0.0, 0.0], 3.425251, 0, 0, 0) gto2 = gto(0.154329, [-0.50, 0.0, 0.0], 3.425251, 0, 0, 0) gto3 = gto(0.154329, [0.50, 0.0, 0.0], 3.425251, 0, 0, 0) gto4 = gto(0.154329, [0.50, 0.0, 0.0], 3.425251, 0, 0, 0) # perform integration rep1 = integrator.repulsion_gto_deriv(gto1, gto2, gto3, gto4, 0) rep2 = integrator.repulsion_gto_deriv(gto2, gto1, gto3, gto4, 0) # perform finite difference ans1 = calculate_deriv_gto(gto1, gto2, gto3, gto4, 0) np.testing.assert_almost_equal(rep1, ans1, 4)
def calculate_deriv_gto(gto1, gto2, gto3, gto4, coord): # build integrator object integrator = PyQInt() # distance diff = 0.00001 p = np.zeros(3) p[coord] = diff gto1_new1 = gto(gto1.c, gto1.p - 0.5 * p, gto1.alpha, gto1.l, gto1.m, gto1.n) gto1_new2 = gto(gto1.c, gto1.p + 0.5 * p, gto1.alpha, gto1.l, gto1.m, gto1.n) # build hydrogen molecule left = integrator.repulsion_gto(gto1_new1, gto2, gto3, gto4) right = integrator.repulsion_gto(gto1_new2, gto2, gto3, gto4) return (right - left) / diff