Ejemplo n.º 1
0
    def vertical_recursion(self, r, m, g1, g2, g3, g4, g5, g6):
        out1 = out2 = out3 = out4 = out5 = 0

        a_1 = g1.exponent
        a_2 = g2.exponent
        a_3 = g3.exponent
        a_4 = g4.exponent
        a_5 = a_1 + a_2
        a_6 = a_3 + a_4

        r_1 = g1.coordinates
        r_2 = g2.coordinates
        r_5 = gaussian_product_coordinate(a_1, r_1, a_2, r_2)

        if r_5[r] != r_1[r]:
            out1 = (r_5[r] - r_1[r]) * self.hgp_begin_vertical(m, g1, g2, g3, g4)
        if self.r_7[r] != r_5[r]:
            out2 = (self.r_7[r] - r_5[r]) * self.hgp_begin_vertical((m+1), g1, g2, g3, g4)
        if g5.integral_exponents[r] >= 0:
            out3 = self.os_count(g1.integral_exponents[r]) * (1 / (2 * a_5)) * self.hgp_begin_vertical(m, g5, g2, g3, g4)
            out4 = self.os_count(g1.integral_exponents[r]) * (self.a_7 / (2 * a_5**2)) * self.hgp_begin_vertical((m+1), g5, g2, g3, g4)
        if g6.integral_exponents[r] >= 0:
            out5 = self.os_count(g3.integral_exponents[r]) * (1 / (2*(a_5 + a_6))) * self.hgp_begin_vertical((m+1), g1, g2, g6, g4)

        return out1 + out2 + out3 - out4 + out5
def nuclear_attraction(gaussian_1, gaussian_2, nuclei):
    a_1 = gaussian_1.exponent
    a_2 = gaussian_2.exponent
    l_1 = gaussian_1.integral_exponents
    l_2 = gaussian_2.integral_exponents

    r_a = gaussian_1.coordinates
    r_b = gaussian_2.coordinates
    r_c = nuclei.coordinates
    r_p = gaussian_product_coordinate(a_1, r_a, a_2, r_b)

    r_ab = coordinate_distance(r_a, r_b)
    r_pc = coordinate_distance(r_p, r_c)

    r_p_a = vector_minus(r_p, r_a)
    r_p_b = vector_minus(r_p, r_b)
    r_p_c = vector_minus(r_p, r_c)

    g = a_1 + a_2

    ans = 0
    for l in range(l_1[0] + l_2[0] + 1):
        for r in range(int(l / 2) + 1):
            for i in range(int((l - 2 * r) / 2) + 1):
                out1 = a_function(l, r, i, l_1[0], l_2[0], r_p_a[0], r_p_b[0],
                                  r_p_c[0], g)
                for m in range(l_1[1] + l_2[1] + 1):
                    for s in range(int(m / 2) + 1):
                        for j in range(int((m - 2 * s) / 2) + 1):
                            out2 = a_function(m, s, j, l_1[1], l_2[1],
                                              r_p_a[1], r_p_b[1], r_p_c[1], g)
                            for n in range(l_1[2] + l_2[2] + 1):
                                for t in range(int(n / 2) + 1):
                                    for k in range(int((n - 2 * t) / 2) + 1):
                                        out3 = a_function(
                                            n, t, k, l_1[2], l_2[2], r_p_a[2],
                                            r_p_b[2], r_p_c[2], g)
                                        v = (l + m +
                                             n) - 2 * (r + s + t) - (i + j + k)
                                        out4 = boys_function(v, g * r_pc**2)
                                        out5 = out1 * out2 * out3 * out4
                                        ans += out5
    ans *= ((2 * pi) / g) * exp(-(a_1 * a_2 * r_ab**2) / g)
    return ans
Ejemplo n.º 3
0
def orbital_overlap(gaussian_1, gaussian_2):
    a_1 = gaussian_1.exponent
    a_2 = gaussian_2.exponent
    l_1 = gaussian_1.integral_exponents
    l_2 = gaussian_2.integral_exponents

    r_a = gaussian_1.coordinates
    r_b = gaussian_2.coordinates
    r_ab = coordinate_distance(r_a, r_b)

    r_p = gaussian_product_coordinate(a_1, r_a, a_2, r_b)
    r_p_a = vector_minus(r_p, r_a)
    r_p_b = vector_minus(r_p, r_b)

    g = a_1 + a_2

    s_x = s_function(l_1[0], l_2[0], r_p_a[0], r_p_b[0], g)
    s_y = s_function(l_1[1], l_2[1], r_p_a[1], r_p_b[1], g)
    s_z = s_function(l_1[2], l_2[2], r_p_a[2], r_p_b[2], g)
    s_ij = (pi / g)**(3 / 2) * exp(-a_1 * a_2 * r_ab**2 / g) * s_x * s_y * s_z
    return s_ij
Ejemplo n.º 4
0
    def os_recursive(self, r, m, g1, g2, g3, g4, g5, g6, g7, g8):
        out1 = out2 = out3 = out4 = out5 = out6 = out7 = out8 = 0

        a_1 = g1.exponent
        a_2 = g2.exponent
        a_3 = g3.exponent
        a_4 = g4.exponent
        a_5 = a_1 + a_2
        a_6 = a_3 + a_4

        r_1 = g1.coordinates
        r_2 = g2.coordinates
        r_5 = gaussian_product_coordinate(a_1, r_1, a_2, r_2)

        if r_5[r] != r_1[r]:
            out1 = (r_5[r] - r_1[r]) * self.os_begin(m, g1, g2, g3, g4)
        if self.r_7[r] != r_5[r]:
            out2 = (self.r_7[r] - r_5[r]) * self.os_begin(
                m + 1, g1, g2, g3, g4)
        if g5.integral_exponents[r] >= 0:
            out3 = self.os_int(g1.integral_exponents[r]) * (
                1 / (2 * a_5)) * self.os_begin(m, g5, g2, g3, g4)
            out4 = self.os_int(g1.integral_exponents[r]) * (
                self.a_7 /
                (2 * a_5**2)) * self.os_begin(m + 1, g5, g2, g3, g4)
        if g6.integral_exponents[r] >= 0:
            out5 = self.os_int(g2.integral_exponents[r]) * (
                1 / (2 * a_5)) * self.os_begin(m, g1, g6, g3, g4)
            out6 = self.os_int(g2.integral_exponents[r]) * (
                self.a_7 /
                (2 * a_5**2)) * self.os_begin(m + 1, g1, g6, g3, g4)
        if g7.integral_exponents[r] >= 0:
            out7 = self.os_int(g3.integral_exponents[r]) * (
                1 / (2 * (a_5 + a_6))) * self.os_begin(m + 1, g1, g2, g7, g4)
        if g8.integral_exponents[r] >= 0:
            out8 = self.os_int(g4.integral_exponents[r]) * (
                1 / (2 * (a_5 + a_6))) * self.os_begin(m + 1, g1, g2, g3, g8)

        return out1 + out2 + out3 - out4 + out5 - out6 + out7 + out8
Ejemplo n.º 5
0
    def integrate(self, basis_i, basis_j, basis_k, basis_l):
        l_1 = basis_i.integral_exponents
        l_2 = basis_j.integral_exponents
        l_3 = basis_k.integral_exponents
        l_4 = basis_l.integral_exponents
        l_total = sum(l_1) + sum(l_2) + sum(l_3) + sum(l_4)

        r_1 = basis_i.coordinates
        r_2 = basis_j.coordinates
        r_3 = basis_k.coordinates
        r_4 = basis_l.coordinates

        primitives_i = basis_i.primitive_gaussian_array
        primitives_j = basis_j.primitive_gaussian_array
        primitives_k = basis_k.primitive_gaussian_array
        primitives_l = basis_l.primitive_gaussian_array

        ans = 0.0
        for g1, g2, g3, g4 in itertools.product(primitives_i, primitives_j,
                                                primitives_k, primitives_l):
            c_1 = g1.contraction
            c_2 = g2.contraction
            c_3 = g3.contraction
            c_4 = g4.contraction
            n_1 = g1.normalisation
            n_2 = g2.normalisation
            n_3 = g3.normalisation
            n_4 = g4.normalisation
            contraction = c_1 * c_2 * c_3 * c_4 * n_1 * n_2 * n_3 * n_4

            a_1 = g1.exponent
            a_2 = g2.exponent
            a_3 = g3.exponent
            a_4 = g4.exponent
            a_5 = a_1 + a_2
            a_6 = a_3 + a_4
            self.a_7 = (a_5 * a_6) / (a_5 + a_6)

            r_5 = gaussian_product_coordinate(a_1, r_1, a_2, r_2)
            r_6 = gaussian_product_coordinate(a_3, r_3, a_4, r_4)
            self.r_7 = gaussian_product_coordinate(a_5, r_5, a_6, r_6)

            r_12 = coordinate_distance(r_1, r_2)
            r_34 = coordinate_distance(r_3, r_4)
            r_56 = coordinate_distance(r_5, r_6)

            boys_x = (a_5 * a_6 * r_56**2) / (a_5 + a_6)
            boys_out1 = (2 * pi**(5 / 2)) / (a_5 * a_6 * sqrt(a_5 + a_6))
            boys_out2 = exp(((-a_1 * a_2 * r_12**2) / a_5) -
                            ((a_3 * a_4 * r_34**2) / a_6))
            boys_out3 = boys_function(l_total, boys_x)
            self.end_dict = {l_total: boys_out1 * boys_out2 * boys_out3}

            m = l_total
            while m >= 1:
                boys_out3 = boys_function_recursion(m, boys_x, boys_out3)
                m -= 1
                self.end_dict[m] = boys_out1 * boys_out2 * boys_out3

            ans += contraction * self.os_begin(0, g1, g2, g3, g4)

        return ans