def calculate_fy_op_finite_difference(_gto, nucleus): """ Calculate the operator derivative in the y-direction using a finite difference method """ # build integrator object integrator = PyQInt() diff = 0.000001 nucleus[1] -= diff / 2.0 left = integrator.nuclear_gto(_gto, _gto, nucleus) nucleus[1] += diff right = integrator.nuclear_gto(_gto, _gto, nucleus) return (right - left) / diff
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 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)