Exemple #1
0
def pyq2_dft(atomtuples=[(2,0,0,0)],basis = '6-31G**',maxit=10,xcname='svwn'):
    import pyquante2 as pyq2
    print ("pyq2 DFT run")
    geo = pyq2.molecule(atomtuples)
    bfs = pyq2.basisset(geo,name=basis)
    i1 = pyq2.onee_integrals(bfs,geo)
    i2 = pyq2.twoe_integrals(bfs)
    grid = pyq2.grid(geo)
    h = i1.T + i1.V
    orbe,orbs = pyq2.geigh(h,i1.S)
    eold = 0
    grid.setbfamps(bfs)
    E0 = geo.nuclear_repulsion()

    for i in range(maxit):
        D = pyq2.dmat(orbs,geo.nocc())
        E1 = 2*pyq2.trace2(h,D)

        J = i2.get_j(D)
        Ej = 2*pyq2.trace2(J,D)

        Exc,Vxc = pyq2.get_xc(grid,0.5*D,xcname=xcname)

        energy = E0+E1+Ej+Exc
        F = h+2*J+Vxc

        orbe,orbs = pyq2.geigh(F,i1.S)

        print (i,energy,E1,Ej,Exc,E0)
        if np.isclose(energy,eold):
            break
        eold = energy
    return energy
Exemple #2
0
def test_mesh():
    from pyquante2 import grid,h2o
    from pyquante2.viewer.viewer import Shapes,Viewer
    h2o_mesh = grid(h2o)
    shapes = Shapes(h2o)
    shapes.add_points_weights(h2o_mesh.points)
    win = Viewer()
    win.calllist(shapes.shapelist)
    win.run()
    return
Exemple #3
0
def test_mesh():
    from pyquante2 import grid, h2o
    from pyquante2.viewer.viewer import Shapes, Viewer
    h2o_mesh = grid(h2o)
    shapes = Shapes(h2o)
    shapes.add_points_weights(h2o_mesh.points)
    win = Viewer()
    win.calllist(shapes.shapelist)
    win.run()
    return
Exemple #4
0
def pyq2_dft(atomtuples=[(2, 0, 0, 0)],
             basis='6-31G**',
             maxit=10,
             xcname='svwn'):
    import pyquante2 as pyq2
    print("pyq2 DFT run")
    geo = pyq2.molecule(atomtuples)
    bfs = pyq2.basisset(geo, name=basis)
    i1 = pyq2.onee_integrals(bfs, geo)
    i2 = pyq2.twoe_integrals(bfs)
    grid = pyq2.grid(geo)
    h = i1.T + i1.V
    orbe, orbs = pyq2.geigh(h, i1.S)
    eold = 0
    grid.setbfamps(bfs)
    E0 = geo.nuclear_repulsion()

    for i in range(maxit):
        D = pyq2.dmat(orbs, geo.nocc())
        E1 = 2 * pyq2.trace2(h, D)

        J = i2.get_j(D)
        Ej = 2 * pyq2.trace2(J, D)

        Exc, Vxc = pyq2.get_xc(grid, 0.5 * D, xcname=xcname)

        energy = E0 + E1 + Ej + Exc
        F = h + 2 * J + Vxc

        orbe, orbs = pyq2.geigh(F, i1.S)

        print(i, energy, E1, Ej, Exc, E0)
        if np.isclose(energy, eold):
            break
        eold = energy
    return energy