コード例 #1
0
ファイル: hydrogen-p.py プロジェクト: lisyarus/chembook
def equation(basis):

    B = len(basis)

    H = numpy.zeros((B, B))
    S = numpy.zeros((B, B))

    n = hgto.Nucleus(1.0)

    for i in range(B):
        for j in range(B):
            bi = basis[i]
            bj = basis[j]
            S[i, j] = hgto.overlap(bi, bj)
            H[i, j] = hgto.kinetic(bi, bj) + hgto.nuclear_attraction(bi, bj, n)

    return (H, S)
コード例 #2
0
ファイル: trihydrogen.py プロジェクト: lisyarus/chembook
def equation(basis, nuclei):

    B = len(basis)

    H = numpy.zeros((B, B))
    S = numpy.zeros((B, B))

    total_nuclear_repulsion = 0.0
    for i in range(len(nuclei)):
        for j in range(i + 1, len(nuclei)):
            total_nuclear_repulsion += hgto.nuclear_repulsion(
                nuclei[i], nuclei[j])

    for i in range(B):
        for j in range(B):
            bi = basis[i]
            bj = basis[j]
            S[i, j] = hgto.overlap(bi, bj)
            H[i, j] = hgto.kinetic(bi, bj)
            for n in nuclei:
                H[i, j] += hgto.nuclear_attraction(bi, bj, n)
            H[i, j] += S[i, j] * total_nuclear_repulsion

    return (H, S)