コード例 #1
0
    def hgp_vertical_factory(self, r, g1, g2, g3, g4):
        d_1 = g1.contraction
        d_3 = g3.contraction
        a_1 = g1.exponent
        a_3 = g3.exponent
        r_1 = g1.coordinates
        r_3 = g3.coordinates
        l_1 = g1.integral_exponents
        l_3 = g3.integral_exponents

        if r == 0:
            g1xm1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0] - 1, l_1[1], l_1[2]))
            g1xm2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0] - 2, l_1[1], l_1[2]))
            g3xm1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0] - 1, l_3[1], l_3[2]))
            return g1xm1, g2, g3, g4, g1xm2, g3xm1
        elif r == 1:
            g1ym1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1] - 1, l_1[2]))
            g1ym2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1] - 2, l_1[2]))
            g3ym1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0], l_3[1] - 1, l_3[2]))
            return g1ym1, g2, g3, g4, g1ym2, g3ym1
        elif r == 2:
            g1zm1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1], l_1[2] - 1))
            g1zm2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1], l_1[2] - 2))
            g3zm1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0], l_3[1], l_3[2] - 1))
            return g1zm1, g2, g3, g4, g1zm2, g3zm1
コード例 #2
0
 def test_del_operate_on_gaussian_returns_s_orbital_2(self):
     primitive_gaussian = PrimitiveBasis(0.15432897, 3.42525091,
                                         (0, 0, 0.7316), (0, 0, 0))
     array = del_operator(primitive_gaussian)
     testing.assert_approx_equal(array[1].contraction, -23.46468759, 7)
     self.assertEqual(array[1].exponent, 3.42525091)
     self.assertEqual(array[1].integral_exponents, (2, 0, 0))
     self.assertEqual(array[1].coordinates, (0, 0, 0.7316))
コード例 #3
0
    def horizontal_recursion(self, r, g1, g2, g3, g4):
        g1a1 = g2m1 = None
        out2 = 0

        d_1 = g1.contraction
        d_2 = g2.contraction
        a_1 = g1.exponent
        a_2 = g2.exponent
        r_1 = g1.coordinates
        r_2 = g2.coordinates
        l_1 = g1.integral_exponents
        l_2 = g2.integral_exponents

        if r == 0:
            g1a1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0] + 1, l_1[1], l_1[2]))
            g2m1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0] - 1, l_2[1], l_2[2]))
        elif r == 1:
            g1a1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1] + 1, l_1[2]))
            g2m1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0], l_2[1] - 1, l_2[2]))
        elif r == 2:
            g1a1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1], l_1[2] + 1))
            g2m1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0], l_2[1], l_2[2] - 1))

        out1 = self.hgp_begin_horizontal(g1a1, g2m1, g3, g4)
        if r_1[r] != r_2[r]:
            out2 = (r_1[r] - r_2[r]) * self.hgp_begin_horizontal(
                g1, g2m1, g3, g4)
        return out1 + out2
コード例 #4
0
def gaussian_product(gaussian1, gaussian2):
    d_1 = gaussian1.contraction
    a_1 = gaussian1.exponent
    l_1 = gaussian1.integral_exponents
    r_1 = gaussian1.coordinates
    d_2 = gaussian2.contraction
    a_2 = gaussian2.exponent
    l_2 = gaussian2.integral_exponents
    r_2 = gaussian2.coordinates

    d_3 = d_1 * d_2
    a_3 = a_1 + a_2
    l_3 = (l_1[0] + l_2[0], l_1[1] + l_2[1], l_1[2] + l_2[2])
    r_3 = (a_1 * r_1[0] + a_2 * r_2[0]) / a_3, (
        a_1 * r_1[1] + a_2 * r_2[1]) / a_3, (a_1 * r_1[2] + a_2 * r_2[2]) / a_3
    return PrimitiveBasis(d_3, a_3, r_3, l_3)
コード例 #5
0
def del_operator(primitive_gaussian):
    primitive_array = []
    l = primitive_gaussian.integral_exponents[0]
    m = primitive_gaussian.integral_exponents[1]
    n = primitive_gaussian.integral_exponents[2]
    a = primitive_gaussian.exponent
    coordinates = primitive_gaussian.coordinates

    contraction = a * ((2 * (l + m + n)) + 3)
    primitive_basis = PrimitiveBasis(contraction, a, coordinates, (l, m, n))
    primitive_array.append(primitive_basis)

    contraction = -2 * a**2
    primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                     (l + 2, m, n))
    primitive_array.append(primitive_basis)
    primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                     (l, m + 2, n))
    primitive_array.append(primitive_basis)
    primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                     (l, m, n + 2))
    primitive_array.append(primitive_basis)

    if l >= 2:
        contraction = -(1 / 2) * (l * (l - 1))
        primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                         (l - 2, m, n))
        primitive_array.append(primitive_basis)
    if m >= 2:
        contraction = -(1 / 2) * (m * (m - 1))
        primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                         (l, m - 2, n))
        primitive_array.append(primitive_basis)
    if n >= 2:
        contraction = -(1 / 2) * (n * (n - 1))
        primitive_basis = PrimitiveBasis(contraction, a, coordinates,
                                         (l, m, n - 2))
        primitive_array.append(primitive_basis)

    return primitive_array
コード例 #6
0
    def os_gaussian_factory(self, r, g1, g2, g3, g4):
        d_1 = g1.contraction
        d_2 = g2.contraction
        d_3 = g3.contraction
        d_4 = g4.contraction

        a_1 = g1.exponent
        a_2 = g2.exponent
        a_3 = g3.exponent
        a_4 = g4.exponent

        r_1 = g1.coordinates
        r_2 = g2.coordinates
        r_3 = g3.coordinates
        r_4 = g4.coordinates

        l_1 = g1.integral_exponents
        l_2 = g2.integral_exponents
        l_3 = g3.integral_exponents
        l_4 = g4.integral_exponents

        if r == 0:
            g1x1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0] - 1, l_1[1], l_1[2]))
            g1x2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0] - 2, l_1[1], l_1[2]))
            g2x1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0] - 1, l_2[1], l_2[2]))
            g3x1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0] - 1, l_3[1], l_3[2]))
            g4x1 = PrimitiveBasis(d_4, a_4, r_4, (l_4[0] - 1, l_4[1], l_4[2]))
            return g1x1, g2, g3, g4, g1x2, g2x1, g3x1, g4x1
        elif r == 1:
            g1y1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1] - 1, l_1[2]))
            g1y2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1] - 2, l_1[2]))
            g2y1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0], l_2[1] - 1, l_2[2]))
            g3y1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0], l_3[1] - 1, l_3[2]))
            g4y1 = PrimitiveBasis(d_4, a_4, r_4, (l_4[0], l_4[1] - 1, l_4[2]))
            return g1y1, g2, g3, g4, g1y2, g2y1, g3y1, g4y1
        elif r == 2:
            g1z1 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1], l_1[2] - 1))
            g1z2 = PrimitiveBasis(d_1, a_1, r_1, (l_1[0], l_1[1], l_1[2] - 2))
            g2z1 = PrimitiveBasis(d_2, a_2, r_2, (l_2[0], l_2[1], l_2[2] - 1))
            g3z1 = PrimitiveBasis(d_3, a_3, r_3, (l_3[0], l_3[1], l_3[2] - 1))
            g4z1 = PrimitiveBasis(d_4, a_4, r_4, (l_4[0], l_4[1], l_4[2] - 1))
            return g1z1, g2, g3, g4, g1z2, g2z1, g3z1, g4z1
コード例 #7
0
 def test_del_operate_on_s_gaussian_returns_four_gaussians(self):
     primitive_gaussian = PrimitiveBasis(0.15432897, 3.42525091,
                                         (0, 0, 0.7316), (0, 0, 0))
     array = del_operator(primitive_gaussian)
     self.assertEqual(len(array), 4)
コード例 #8
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_1(
         self):
     primitive_gaussian = PrimitiveBasis(0.15432897, 3.42525091,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 1.794441832218435, 7)
コード例 #9
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_6(
         self):
     primitive_gaussian = PrimitiveBasis(0.44463454, 0.48084429,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 0.41154131374122654, 7)
コード例 #10
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_5(
         self):
     primitive_gaussian = PrimitiveBasis(0.53532814, 1.77669115,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 1.0967787981767012, 7)
コード例 #11
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_4(
         self):
     primitive_gaussian = PrimitiveBasis(0.15432897, 9.75393461,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 3.9336432656254527, 7)
コード例 #12
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_3(
         self):
     primitive_gaussian = PrimitiveBasis(0.44463454, 0.16885540,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 0.18773545851092535, 7)
コード例 #13
0
 def test_expand_normalisation_returns_the_normalisation_of_a_gaussian_2(
         self):
     primitive_gaussian = PrimitiveBasis(0.53532814, 0.62391373,
                                         (0, 0, 0.7316), (0, 0, 0))
     testing.assert_approx_equal(primitive_gaussian.normalisation,
                                 0.5003264923314032, 7)
コード例 #14
0
def expand_basis_set(file_list, coordinates):
    basis_list = []
    for a in range(len(file_list)):
        if file_list[a][0] == 'S':
            primitive_basis_s_list = []
            for b in range(1, len(file_list[a])):
                primitive_basis = PrimitiveBasis(file_list[a][b][0],
                                                 file_list[a][b][1],
                                                 coordinates, (0, 0, 0))
                primitive_basis_s_list.append(primitive_basis)
            basis_s = Basis(primitive_basis_s_list, coordinates, (0, 0, 0))
            basis_list.append(basis_s)
        elif file_list[a][0] == 'L':
            primitive_basis_s_list = []
            primitive_basis_px_list = []
            primitive_basis_py_list = []
            primitive_basis_pz_list = []
            for b in range(1, len(file_list[a])):
                primitive_basis_s = PrimitiveBasis(file_list[a][b][0],
                                                   file_list[a][b][1],
                                                   coordinates, (0, 0, 0))
                primitive_basis_px = PrimitiveBasis(file_list[a][b][2],
                                                    file_list[a][b][1],
                                                    coordinates, (1, 0, 0))
                primitive_basis_py = PrimitiveBasis(file_list[a][b][2],
                                                    file_list[a][b][1],
                                                    coordinates, (0, 1, 0))
                primitive_basis_pz = PrimitiveBasis(file_list[a][b][2],
                                                    file_list[a][b][1],
                                                    coordinates, (0, 0, 1))
                primitive_basis_s_list.append(primitive_basis_s)
                primitive_basis_px_list.append(primitive_basis_px)
                primitive_basis_py_list.append(primitive_basis_py)
                primitive_basis_pz_list.append(primitive_basis_pz)
            basis_s = Basis(primitive_basis_s_list, coordinates, (0, 0, 0))
            basis_px = Basis(primitive_basis_px_list, coordinates, (1, 0, 0))
            basis_py = Basis(primitive_basis_py_list, coordinates, (0, 1, 0))
            basis_pz = Basis(primitive_basis_pz_list, coordinates, (0, 0, 1))
            basis_list.append(basis_s)
            basis_list.append(basis_px)
            basis_list.append(basis_py)
            basis_list.append(basis_pz)
        elif file_list[a][0] == 'P':
            primitive_basis_px_list = []
            primitive_basis_py_list = []
            primitive_basis_pz_list = []
            for b in range(1, len(file_list[a])):
                primitive_basis_px = PrimitiveBasis(file_list[a][b][0],
                                                    file_list[a][b][1],
                                                    coordinates, (1, 0, 0))
                primitive_basis_py = PrimitiveBasis(file_list[a][b][0],
                                                    file_list[a][b][1],
                                                    coordinates, (0, 1, 0))
                primitive_basis_pz = PrimitiveBasis(file_list[a][b][0],
                                                    file_list[a][b][1],
                                                    coordinates, (0, 0, 1))
                primitive_basis_px_list.append(primitive_basis_px)
                primitive_basis_py_list.append(primitive_basis_py)
                primitive_basis_pz_list.append(primitive_basis_pz)
            basis_px = Basis(primitive_basis_px_list, coordinates, (1, 0, 0))
            basis_py = Basis(primitive_basis_py_list, coordinates, (0, 1, 0))
            basis_pz = Basis(primitive_basis_pz_list, coordinates, (0, 0, 1))
            basis_list.append(basis_px)
            basis_list.append(basis_py)
            basis_list.append(basis_pz)
        elif file_list[a][0] == 'D':
            primitive_basis_dxx_list = []
            primitive_basis_dyy_list = []
            primitive_basis_dzz_list = []
            primitive_basis_dxy_list = []
            primitive_basis_dxz_list = []
            primitive_basis_dyz_list = []
            for b in range(1, len(file_list[a])):
                primitive_basis_dxx = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (2, 0, 0))
                primitive_basis_dyy = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (0, 2, 0))
                primitive_basis_dzz = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (0, 0, 2))
                primitive_basis_dxy = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (1, 1, 0))
                primitive_basis_dxz = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (1, 0, 1))
                primitive_basis_dyz = PrimitiveBasis(file_list[a][b][0],
                                                     file_list[a][b][1],
                                                     coordinates, (0, 1, 1))
                primitive_basis_dxx_list.append(primitive_basis_dxx)
                primitive_basis_dyy_list.append(primitive_basis_dyy)
                primitive_basis_dzz_list.append(primitive_basis_dzz)
                primitive_basis_dxy_list.append(primitive_basis_dxy)
                primitive_basis_dxz_list.append(primitive_basis_dxz)
                primitive_basis_dyz_list.append(primitive_basis_dyz)
            basis_dxx = Basis(primitive_basis_dxx_list, coordinates, (2, 0, 0))
            basis_dyy = Basis(primitive_basis_dyy_list, coordinates, (0, 2, 0))
            basis_dzz = Basis(primitive_basis_dzz_list, coordinates, (0, 0, 2))
            basis_dxy = Basis(primitive_basis_dxy_list, coordinates, (1, 1, 0))
            basis_dxz = Basis(primitive_basis_dxz_list, coordinates, (1, 0, 1))
            basis_dyz = Basis(primitive_basis_dyz_list, coordinates, (0, 1, 1))
            basis_list.append(basis_dxx)
            basis_list.append(basis_dyy)
            basis_list.append(basis_dzz)
            basis_list.append(basis_dxy)
            basis_list.append(basis_dxz)
            basis_list.append(basis_dyz)
    return basis_list