Example #1
0
def main():
    h2 = Molecule('h2',
                  atomlist = [(1,(0.,0.,0.7)),(1,(0.,0.,-0.7))],
                  units = 'Bohr')
    en,orbe,orbs = rhf(h2,ETemp=1e4)
    print "Energy ",en,abs(en-energy)
    print "Spectrum ",orbe
    return en
Example #2
0
def main():
    atoms = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))])
    bfs = getbasis(atoms)
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints))
    occs = [1.]+[0.]*9

    Ecis = CIS(Ints,orbs,orbe,1,9,en)
    return Ecis[0]
def calculate(self):
    
    if self.log == 1:
        f = open('calc.log','w')
        f.close()
        configure_output("calc.log")
    x_1 = float(self.coor1_x.GetValue())
    y_1 = float(self.coor1_y.GetValue())
    z_1 = float(self.coor1_z.GetValue())
    x_2 = float(self.coor2_x.GetValue())
    y_2 = float(self.coor2_y.GetValue())
    z_2 = float(self.coor2_z.GetValue())
 
    mol = Molecule('h2',[(self.atom_no_1,(x_1,y_1,z_1)),
                          (self.atom_no_2,(x_2,y_2,z_2))])
    print mol
    bf_name = self.Bf_box.GetValue()
    
        #Why?
    if bf_name == "sto-3g":
        bf_name = "sto-3g"
    elif bf_name == "6-31g":
        bf_name = "6-31g"
    elif bf_name == "3-21g":
        bf_name = "3-21g"
    elif bf_name == "6-31g**":
        bf_name = "6-31g**"
    elif bf_name == "6-31g**++":
        bf_name = "6-31g**++"
    elif bf_name == "6-311g**":
        bf_name = "6-311g**"
    elif bf_name == "6-311g++(2d,2p)":
        bf_name = "6-311g++(2d,2p)"
    elif bf_name == "6-311g++(3d,3p)":
        bf_name = "6-311g++(3d,3p)"
    elif bf_name == "6-311g++(3df,3pd)":
        bf_name = "6-311g++(3df,3pd)"
    elif bf_name == "sto-6g":
        bf_name = "sto-6g"
    elif bf_name == "lacvp":
        bf_name = "lacvp"
    elif bf_name == "cc-pvdz":
        bf_name = "cc-pvdz"
    elif bf_name == "cc-pvtz":
        bf_name = "cc-pvtz"
    elif bf_name == "dzvp":
        bf_name = "dzvp"
        
    en,orbe,orbs = rhf(mol,basis_data=bf_name)
    if self.log == 1:
        with open('calc.log','a') as f_handle:
            f_handle.write("\norbs is\n")
            np.savetxt(f_handle,orbs)
            f_handle.write("\norbe is\n")
            np.savetxt(f_handle,orbe)
    
    self.console_box.SetValue('energy=%f' % en)
Example #4
0
def main():
    atoms = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))])
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints),)

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)  
    return en+emp2
Example #5
0
def test_exx():
    logging.basicConfig(filename='test_exx.log',
                        level=logging.INFO,
                        format="%(message)s",
                        filemode='w')
    logging.info("Testing EXX functions")
    logging.info(time.asctime())

    h2o = Molecule('H2O',
                   atomlist = [(8,(0,0,0)),    # the geo corresponds to the 
                               (1,(0.959,0,0)),# one that Yang used
                               (1,(-.230,0.930,0))],
                   units = 'Angstrom')

    h2 = Molecule('H2',
                   atomlist = [(1,(0.,0.,0.7)),(1,(0.,0.,-0.7))],
                   units = 'Bohr')
    he = Molecule('He',atomlist = [(2,(0,0,0))])
    ne = Molecule('Ne',atomlist = [(10,(0,0,0))])
    ohm = Molecule('OH-',atomlist = [(8,(0.0,0.0,0.0)),
                                     (1,(0.971,0.0,0.0))],
                   units = 'Angstrom',
                   charge = -1)
    be = Molecule('Be',atomlist = [(4,(0.0,0.0,0.0))],
                  units = 'Angstrom')
    lih = Molecule('LiH',
                   atomlist = [(1,(0,0,1.5)),(3,(0,0,-1.5))],
                   units = 'Bohr')
    #for atoms in [h2,he,be,lih,ohm,ne,h2o]:
    for atoms in [h2,lih]:
        logging.info("--%s--" % atoms.name)

        # Caution: the rydberg molecules (He, Ne) will need a
        #  much much larger basis set than the default returned
        # by getbasis (which is 6-31G**)
        bfs = getbasis(atoms)
        S,h,Ints = getints(bfs,atoms)

        enhf,orbehf,orbshf = rhf(atoms,integrals=(S,h,Ints))
        logging.info("HF  total energy = %f"% enhf)

        enlda,orbelda,orbslda = dft(atoms,
                                   integrals=(S,h,Ints),
                                   bfs = bfs)
        logging.info("LDA total energy = %f" % enlda)

        energy,orbe_exx,orbs_exx = exx(atoms,orbslda,
                                       integrals=(S,h,Ints),
                                       bfs = bfs,
                                       verbose=True,
                                       opt_method="BFGS")
        logging.info("EXX total energy = %f" % energy)
    return
Example #6
0
def main():
    atoms = Molecule('He',
                     [(2,( .0000000000, .0000000000, .0000000000))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints))

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)
    return en+emp2
Example #7
0
def main():
    atoms = Molecule('h2', [(1, (1., 0, 0)), (1, (-1., 0, 0))])
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel / 2
    S, h, Ints = getints(bfs, atoms)
    en, orbe, orbs = rhf(
        atoms,
        integrals=(S, h, Ints),
    )

    emp2 = MP2(Ints, orbs, orbe, nocc, nbf - nocc)
    return en + emp2
Example #8
0
def main(**opts):
    do_oep_an = opts.get('do_oep_an',True)
    mol = Molecule('LiH',[(1,(0,0,1.5)),(3,(0,0,-1.5))],units = 'Bohr')

    bfs = getbasis(mol)
    S,h,Ints = getints(bfs,mol)
    E_hf,orbe_hf,orbs_hf = rhf(mol,bfs=bfs,integrals=(S,h,Ints),
                               DoAveraging=True)
    if do_oep_an:
        E_exx,orbe_exx,orbs_exx = oep_hf_an(mol,orbs_hf,bfs=bfs,
                                            integrals=(S,h,Ints))
    else:
        E_exx,orbe_exx,orbs_exx = oep_hf(mol,orbs_hf,bfs=bfs,
                                         integrals=(S,h,Ints))
    return E_exx
Example #9
0
def main():
    LiH = Molecule('lih', [(3, (.0000000000, .0000000000, .0000000000)),
                           (1, (.0000000000, .0000000000, 1.629912))],
                   units='Angstroms')
    bfs = getbasis(LiH)
    nbf = len(bfs)
    nocc, nopen = LiH.get_closedopen()
    assert nopen == 0
    S, h, Ints = getints(bfs, LiH)
    en, orbe, orbs = rhf(LiH, integrals=(S, h, Ints))
    print "SCF completed, E = ", en

    emp2 = MP2(Ints, orbs, orbe, nocc, nbf - nocc)
    print "MP2 correction = ", emp2
    print "Final energy = ", en + emp2
    return en + emp2
Example #10
0
def main():
    LiH = Molecule('lih',
                     [(3,( .0000000000, .0000000000, .0000000000)),
                      (1,( .0000000000, .0000000000,1.629912))],
                     units='Angstroms')
    bfs = getbasis(LiH)
    nbf = len(bfs)
    nocc,nopen = LiH.get_closedopen()
    assert nopen==0
    S,h,Ints = getints(bfs,LiH)
    en,orbe,orbs = rhf(LiH,integrals=(S,h,Ints))
    print "SCF completed, E = ",en 

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)
    print "MP2 correction = ",emp2 
    print "Final energy = ",en+emp2 
    return en+emp2
Example #11
0
def test_old():
    from PyQuante.Molecule import Molecule
    from PyQuante.Ints import getbasis,getints
    from PyQuante.hartree_fock import rhf

    logging.basicConfig(level=logging.DEBUG,format="%(message)s")

    #mol = Molecule('HF',[('H',(0.,0.,0.)),('F',(0.,0.,0.898369))],
    #              units='Angstrom')
    mol = Molecule('LiH',[(1,(0,0,1.5)),(3,(0,0,-1.5))],units = 'Bohr')
    
    bfs = getbasis(mol)
    S,h,Ints = getints(bfs,mol)
    print "after integrals"
    E_hf,orbe_hf,orbs_hf = rhf(mol,bfs=bfs,integrals=(S,h,Ints),DoAveraging=True)
    print "RHF energy = ",E_hf
    E_exx,orbe_exx,orbs_exx = exx(mol,orbs_hf,bfs=bfs,integrals=(S,h,Ints))
    return
Example #12
0
def main():
    atoms = Molecule('ch4', [(6, (.0000000000, .0000000000, .0000000000)),
                             (1, (.0000000000, .0000000000, 1.0836058890)),
                             (1, (1.0216334297, .0000000000, -.3612019630)),
                             (1, (-.5108167148, .8847605034, -.3612019630)),
                             (1, (-.5108167148, -.8847605034, -.3612019630))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel / 2
    S, h, Ints = getints(bfs, atoms)
    en, orbe, orbs = rhf(atoms, integrals=(S, h, Ints))
    print "SCF completed, E = ", en

    emp2 = MP2(Ints, orbs, orbe, nocc, nbf - nocc)
    print "MP2 correction = ", emp2
    print "Final energy = ", en + emp2
    return en + emp2
Example #13
0
def main():
    atoms = Molecule('ch4',
                     [(6,( .0000000000, .0000000000, .0000000000)),
                      (1,( .0000000000, .0000000000,1.0836058890)),
                      (1,(1.0216334297, .0000000000,-.3612019630)),
                      (1,(-.5108167148, .8847605034,-.3612019630)),
                      (1,(-.5108167148,-.8847605034,-.3612019630))],
                     units='Angstroms')
    bfs = getbasis(atoms)
    nel = atoms.get_nel()
    nbf = len(bfs)
    nocc = nel/2
    S,h,Ints = getints(bfs,atoms)
    en,orbe,orbs = rhf(atoms,integrals=(S,h,Ints))
    print "SCF completed, E = ",en 

    emp2 = MP2(Ints,orbs,orbe,nocc,nbf-nocc)
    print "MP2 correction = ",emp2 
    print "Final energy = ",en+emp2 
    return en+emp2
Example #14
0
File: cis.py Project: globulion/bqc
def test(file):

    # Make a test molecule for the calculation
    p = QMFile(file,mol=1)
    h2 = p.get_mol()
    #h2 = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))])

    # Get a basis set and compute the integrals.
    # normally the routine will do this automatically, but we
    # do it explicitly here so that we can pass the same set
    # of integrals into the CI code and thus not recompute them.
    bfs = getbasis(h2)
    S,h,Ints = getints(bfs,h2)

    # Compute the HF wave function for our molecule
    en,orbe,orbs = rhf(h2,
                       integrals=(S,h,Ints)
                       )
    print "SCF completed, E = ",en
    print " orbital energies "
    PRINT (orbe)

    # Compute the occupied and unoccupied orbitals, used in the
    # CIS program to generate the excitations
    nclosed,nopen = h2.get_closedopen()
    nbf = len(bfs)
    nocc = nclosed+nopen
    nvirt = nbf-nocc

    # Call the CI program:
    #Ecis = CIS(Ints,orbs,orbe,nocc,nvirt,en)
    #print "Ecis = ",Ecis
    print orbs
    
    CIS_H = CISMatrix(Ints, orbs, en, orbe, nocc, nvirt)
    EN, U = linalg.eig(CIS_H)
    EE = EN; EE.sort()
    print " CIS Energies [eV]"
    PRINT ( EE )#* UNITS.HartreeToElectronVolt)
    print " First excited state energy = %20.4f" % min(EN)
    return
Example #15
0
def main(**opts):
    do_oep_an = opts.get('do_oep_an', True)
    mol = Molecule('LiH', [(1, (0, 0, 1.5)), (3, (0, 0, -1.5))], units='Bohr')

    bfs = getbasis(mol)
    S, h, Ints = getints(bfs, mol)
    E_hf, orbe_hf, orbs_hf = rhf(mol,
                                 bfs=bfs,
                                 integrals=(S, h, Ints),
                                 DoAveraging=True)
    if do_oep_an:
        E_exx, orbe_exx, orbs_exx = oep_hf_an(mol,
                                              orbs_hf,
                                              bfs=bfs,
                                              integrals=(S, h, Ints))
    else:
        E_exx, orbe_exx, orbs_exx = oep_hf(mol,
                                           orbs_hf,
                                           bfs=bfs,
                                           integrals=(S, h, Ints))
    return E_exx
Example #16
0
def test_old():
    from PyQuante.Molecule import Molecule
    from PyQuante.Ints import getbasis, getints
    from PyQuante.hartree_fock import rhf

    logging.basicConfig(level=logging.DEBUG, format="%(message)s")

    #mol = Molecule('HF',[('H',(0.,0.,0.)),('F',(0.,0.,0.898369))],
    #              units='Angstrom')
    mol = Molecule('LiH', [(1, (0, 0, 1.5)), (3, (0, 0, -1.5))], units='Bohr')

    bfs = getbasis(mol)
    S, h, Ints = getints(bfs, mol)
    print "after integrals"
    E_hf, orbe_hf, orbs_hf = rhf(mol,
                                 bfs=bfs,
                                 integrals=(S, h, Ints),
                                 DoAveraging=True)
    print "RHF energy = ", E_hf
    E_exx, orbe_exx, orbs_exx = exx(mol,
                                    orbs_hf,
                                    bfs=bfs,
                                    integrals=(S, h, Ints))
    return
Example #17
0
#!/usr/bin/env python
from PyQuante.hartree_fock import rhf
from PyQuante.Molecule import Molecule
from PyQuante.force import *


bl=1.4

mol = Molecule('H2',[(1,(0.,0.,0.)),(1,(0.0,0.0,bl))])
en,orb_en,coefs = rhf(mol,MaxIter=20,basis_data="sto-3g")

bfs = getbasis(mol,'sto-3g')

dHcore_dXa,dHcore_dYa,dHcore_dZa = der_Hcore_matrix(1,bfs,mol.atoms)

dS_dXa,dS_dYa,dS_dZa  = der_overlap_matrix(1,bfs)

print "\n*** Analytic gradients ***\n"

print "\ndHcore/dZa\n",dHcore_dZa

print "\ndS/dZa\n",dS_dZa
Example #18
0
def main():
    r = 1. / 0.52918
    h2o = Molecule('h2o',
                   atomlist=[(8, (0, 0, 0)), (1, (r, 0, 0)), (1, (0, r, 0))])
    en, orbe, orbs = rhf(h2o)
    return en
Example #19
0
def H2O_Molecule(tst,info,auX,auZ):
    H2O = Molecule('H2O',
           [('O',  ( 0.0,  0.0, 0.0)),
            ('H',  ( auX,  0.0, auZ)),
            ('H',  (-auX,  0.0, auZ))],
           units='Bohr')

    # Get a better energy estimate
    if dft:
        print "# info=%s A.U.=(%g,%g) " % (info,auX,auZ)
        edft,orbe2,orbs2 = dft(H2O,functional='SVWN')

    bfs= getbasis(H2O,basis_data=basis_data) 
    #S is overlap of 2 basis funcs 
    #h is (kinetic+nucl) 1 body term 
    #ints is 2 body terms 
    S,h,ints=getints(bfs,H2O) 


    #enhf is the Hartee-Fock energy 
    #orbe is the orbital energies 
    #orbs is the orbital overlaps 
    enhf,orbe,orbs=rhf(H2O,integrals=(S,h,ints))
    enuke   = Molecule.get_enuke(H2O)

    # print "orbe=%d" % len(orbe)

    temp = matrixmultiply(h,orbs) 
    hmol = matrixmultiply(transpose(orbs),temp) 

    MOInts = TransformInts(ints,orbs) 

    if single:
         print "h = \n",h
         print "S = \n",S
         print "ints = \n",ints
         print "orbe = \n",orbe
         print "orbs = \n",orbs
         print ""
         print "Index 0: 1 or 2 in the paper, Index 1: 3 or 4 in the paper (for pqrs)"
         print ""
         print "hmol = \n",hmol
         print "MOInts:"
         print "I,J,K,L = PQRS order: Cre1,Cre2,Ann1,Ann2"

    if 1:
        print "tst=%d info=%s nuc=%.9f Ehf=%.9f" % (tst,info,enuke,enhf),

    cntOrbs    = 0
    maxOrb    = 0
    npts    = len(hmol[:])
    for i in xrange(npts):
        for j in range(i,npts):
            if abs(hmol[i,j]) > 1.0e-7:
                print "%d,%d=%.9f" % (i,j,hmol[i,j]),
        cntOrbs += 1
        if i > maxOrb: maxOrb = i
        if j > maxOrb: maxOrb = j

    nbf,nmo    = orbs.shape
    mos        = range(nmo)
    for i in mos:
        for j in xrange(i+1):
            ij      = i*(i+1)/2+j
            for k in mos:
                for l in xrange(k+1):
                    kl = k*(k+1)/2+l
                    if ij >= kl:
                        ijkl = ijkl2intindex(i,j,k,l)
                        if abs(MOInts[ijkl]) > 1.0e-7:
                            print "%d,%d,%d,%d=%.9f" % (l,i,j,k,MOInts[ijkl]),
            cntOrbs += 1
            if i > maxOrb: maxOrb = i
            if j > maxOrb: maxOrb = j
    print ""

    return (maxOrb,cntOrbs)
Example #20
0
def main():
    ne = Molecule('Ne',atomlist = [(10,(0,0,0))])
    en,orbe,orbs = rhf(ne)
    return en
Example #21
0
def main():
    h2 = Molecule('h2',
                  atomlist=[(1, (0, 0, 0.6921756113231793)),
                            (1, (0, 0, -0.6921756113231793))])
    en, orbe, orbs = rhf(h2, basis="sto3g")
    return en
Example #22
0
def main():
    he = Molecule('He', atomlist=[(2, (0, 0, 0))])
    en, orbe, orbs = rhf(he)
    return en
Example #23
0
def main():
    oh = Molecule('OH-',
                  atomlist=[(8, (0, 0, 0)), (1, (0.957939 * ang2bohr, 0, 0))],
                  charge=-1)
    en, orbe, orbs = rhf(oh)
    return en
Example #24
0
def main():
    h2 = Molecule("h2", atomlist=[(1, (0.0, 0.0, 0.7)), (1, (0.0, 0.0, -0.7))], units="Bohr")
    en, orbe, orbs = rhf(h2, ETemp=1e4)
    print "Energy ", en, abs(en - energy)
    print "Spectrum ", orbe
    return en
Example #25
0
def H2O_Molecule(tst, info, auX, auZ):
    H2O = Molecule('H2O', [('O', (0.0, 0.0, 0.0)), ('H', (auX, 0.0, auZ)),
                           ('H', (-auX, 0.0, auZ))],
                   units='Bohr')

    # Get a better energy estimate
    if dft:
        print "# info=%s A.U.=(%g,%g) " % (info, auX, auZ)
        edft, orbe2, orbs2 = dft(H2O, functional='SVWN')

    bfs = getbasis(H2O, basis_data=basis_data)
    #S is overlap of 2 basis funcs
    #h is (kinetic+nucl) 1 body term
    #ints is 2 body terms
    S, h, ints = getints(bfs, H2O)

    #enhf is the Hartee-Fock energy
    #orbe is the orbital energies
    #orbs is the orbital overlaps
    enhf, orbe, orbs = rhf(H2O, integrals=(S, h, ints))
    enuke = Molecule.get_enuke(H2O)

    # print "orbe=%d" % len(orbe)

    temp = matrixmultiply(h, orbs)
    hmol = matrixmultiply(transpose(orbs), temp)

    MOInts = TransformInts(ints, orbs)

    if single:
        print "h = \n", h
        print "S = \n", S
        print "ints = \n", ints
        print "orbe = \n", orbe
        print "orbs = \n", orbs
        print ""
        print "Index 0: 1 or 2 in the paper, Index 1: 3 or 4 in the paper (for pqrs)"
        print ""
        print "hmol = \n", hmol
        print "MOInts:"
        print "I,J,K,L = PQRS order: Cre1,Cre2,Ann1,Ann2"

    if 1:
        print "tst=%d info=%s nuc=%.9f Ehf=%.9f" % (tst, info, enuke, enhf),

    cntOrbs = 0
    maxOrb = 0
    npts = len(hmol[:])
    for i in xrange(npts):
        for j in range(i, npts):
            if abs(hmol[i, j]) > 1.0e-7:
                print "%d,%d=%.9f" % (i, j, hmol[i, j]),
        cntOrbs += 1
        if i > maxOrb: maxOrb = i
        if j > maxOrb: maxOrb = j

    nbf, nmo = orbs.shape
    mos = range(nmo)
    for i in mos:
        for j in xrange(i + 1):
            ij = i * (i + 1) / 2 + j
            for k in mos:
                for l in xrange(k + 1):
                    kl = k * (k + 1) / 2 + l
                    if ij >= kl:
                        ijkl = ijkl2intindex(i, j, k, l)
                        if abs(MOInts[ijkl]) > 1.0e-7:
                            print "%d,%d,%d,%d=%.9f" % (l, i, j, k,
                                                        MOInts[ijkl]),
            cntOrbs += 1
            if i > maxOrb: maxOrb = i
            if j > maxOrb: maxOrb = j
    print ""

    return (maxOrb, cntOrbs)
Example #26
0
def main():
    h2 = Molecule('h2', atomlist=[(1, (0, 0, 0)), (1, (1.0, 0, 0))])
    en, orbe, orbs = rhf(h2)
    return en
def visualize(self):
    if self.log == 1:
        f = open('calc.log','w')
        f.close()
        configure_output("calc.log")
    x_1 = float(self.coor1_x.GetValue())
    y_1 = float(self.coor1_y.GetValue())
    z_1 = float(self.coor1_z.GetValue())
    x_2 = float(self.coor2_x.GetValue())
    y_2 = float(self.coor2_y.GetValue())
    z_2 = float(self.coor2_z.GetValue())
    z_pos = float(self.z_pos.GetValue())
    mol = Molecule('h2',[(self.atom_no_1,(y_1,x_1,z_1)),
                          (self.atom_no_2,(y_2,x_2,z_2))],
                   units='Angstrom')
    bf_name = self.Bf_box.GetValue()
    
        #Why?
    if bf_name == "sto-3g":
        bf_name = "sto-3g"
    elif bf_name == "6-31g":
        bf_name = "6-31g"
    elif bf_name == "3-21g":
        bf_name = "3-21g"
    elif bf_name == "6-31g**":
        bf_name = "6-31g**"
    elif bf_name == "6-31g**++":
        bf_name = "6-31g**++"
    elif bf_name == "6-311g**":
        bf_name = "6-311g**"
    elif bf_name == "6-311g++(2d,2p)":
        bf_name = "6-311g++(2d,2p)"
    elif bf_name == "6-311g++(3d,3p)":
        bf_name = "6-311g++(3d,3p)"
    elif bf_name == "6-311g++(3df,3pd)":
        bf_name = "6-311g++(3df,3pd)"
    elif bf_name == "sto-6g":
        bf_name = "sto-6g"
    elif bf_name == "lacvp":
        bf_name = "lacvp"
    elif bf_name == "cc-pvdz":
        bf_name = "cc-pvdz"
    elif bf_name == "cc-pvtz":
        bf_name = "cc-pvtz"
    elif bf_name == "dzvp":
        bf_name = "dzvp"
        
    en,orbe,orbs = rhf(mol,basis_data=bf_name)
    self.console_box.SetValue('energy=%f' % en)

    bfs = getbasis(mol,bf_name)

    delta = 0.1
    c_range = 5.0
#setting for visualize
    x = np.arange(-1*c_range,c_range,delta)
    y = np.arange(-1*c_range,c_range,delta)
    X,Y = p.meshgrid(x,y)
    Z = np.zeros((len(X),len(Y)))
    Z_2 = np.zeros((len(X),len(Y)))
    
#print C matrix
#print "C=",orbs

    #bounding = self.orb_bound_box.GetValue()
        
#calculate wave function
    for k,bf in enumerate(bfs.bfs):
        for i,x1 in enumerate(x):
            for j,y1 in enumerate(y):
            #calculate wave function
            #basic function multiply
                #if bounding == "boundary":
                Z[i,j] += bf.amp(x1,y1,z_pos) * orbs[k,0]
                #else:
                #    Z[i,j] += bf.amp(x1,y1,z_pos) * orbs[k,1]

    if self.log == 1:
        with open('calc.log','a') as f_handle:
            f_handle.write("\norbs is\n")
            np.savetxt(f_handle,orbs)
            f_handle.write("\norbe is\n")
            np.savetxt(f_handle,orbe)
                    
#####  visualize #####
    fig = p.figure()
    ax = Axes3D(fig)
    #ax.plot_surface(X,Y,Z)
    ax.plot_wireframe(X,Y,Z,color = 'b')
    ax.set_xlabel('X')
    ax.set_ylabel('Y')
    ax.set_zlabel('Z')
    p.show()
Example #28
0
def main():
    h2 = Molecule('h2',atomlist=[(1,(0,0,0)),(1,(1.0,0,0))])
    en,orbe,orbs = rhf(h2)
    return en
Example #29
0
 def runapp(self):
     molecule = self.m
     res = rhf(molecule)
     SCF(molecule).iterate()
Example #30
0
#!/usr/bin/env python
from PyQuante.hartree_fock import rhf
from PyQuante.Molecule import Molecule
from PyQuante.force import *

bl = 1.4

mol = Molecule('H2', [(1, (0., 0., 0.)), (1, (0.0, 0.0, bl))])
en, orb_en, coefs = rhf(mol, MaxIter=20, basis_data="sto-3g")

bfs = getbasis(mol, 'sto-3g')

dHcore_dXa, dHcore_dYa, dHcore_dZa = der_Hcore_matrix(1, bfs, mol.atoms)

dS_dXa, dS_dYa, dS_dZa = der_overlap_matrix(1, bfs)

print "\n*** Analytic gradients ***\n"

print "\ndHcore/dZa\n", dHcore_dZa

print "\ndS/dZa\n", dS_dZa
Example #31
0
def main():
    ne = Molecule('Ne', atomlist=[(10, (0, 0, 0))])
    en, orbe, orbs = rhf(ne)
    return en
Example #32
0
def main():
    h2 = Molecule('h2',atomlist=[(1,(0,0,0.6921756113231793)),(1,(0,0,-0.6921756113231793))])
    en,orbe,orbs = rhf(h2,basis="sto3g")
    return en
Example #33
0
benz = Molecule('benzene', [(6, (0.000, 1.396, 0.000)),
                            (6, (1.209, 0.698, 0.000)),
                            (6, (1.209, -0.698, 0.000)),
                            (6, (0.000, -1.396, 0.000)),
                            (6, (-1.209, -0.698, 0.000)),
                            (6, (-1.209, 0.698, 0.000)),
                            (1, (0.000, 2.479, 0.000)),
                            (1, (2.147, 1.240, 0.000)),
                            (1, (2.147, -1.240, 0.000)),
                            (1, (0.000, -2.479, 0.000)),
                            (1, (-2.147, -1.240, 0.000)),
                            (1, (-2.147, 1.240, 0.000))],
                units='Angstrom')

print "------------     h2      ------------"
en, orbe, orbs = rhf(h2)

print 'orbe', orbe
print 'orbs', orbs

print "------------     h2o     ------------"

en, orbe, orbs = rhf(h2o)

print 'orbe', orbe
print 'orbs', orbs

print "------------   beneze   ------------"

en, orbe, orbs = rhf(benz)
Example #34
0
def main():
    he = Molecule('He',atomlist = [(2,(0,0,0))])
    en,orbe,orbs = rhf(he)
    return en
Example #35
0
def main():
    r = 1./0.52918
    h2o=Molecule('h2o',atomlist = [(8,(0,0,0)),(1,(r,0,0)),(1,(0,r,0))])
    en,orbe,orbs = rhf(h2o)
    return en
Example #36
0
def main():
    oh=Molecule('OH-',
                atomlist = [(8,(0,0,0)),(1,(0.957939*ang2bohr,0,0))],
                charge=-1)
    en,orbe,orbs = rhf(oh)
    return en