示例#1
0
def main():
    he = Molecule('He',atomlist=[(2,(0.0,0.5,0.0))])
    test_grad(he,npts=5,d=1e-9)
    r = 0.70
    h2 = Molecule('h2',
                  atomlist = [(1,(1.,r/2.,0)),
                              (1,(1.,-r/2.,0))],
                  units='Angs')
    test_grad(h2,npts=5,d=1e-9)
    return
示例#2
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
示例#3
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
示例#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
示例#5
0
def main():
    atomlist = Molecule('oh',
                        atomlist=[(8, (0, 0, 0)), (1, (1., 0, 0))],
                        units='Angstrom',
                        multiplicity=2)
    en = scf(atomlist)
    return en
示例#6
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
示例#7
0
def pyquante_hf(mol, x, eps, basis = "sto-3g"):

    
    atoms = [None]*mol.num_atoms
    for i in xrange(mol.num_atoms):
        atoms[i] = (mol.atoms[i].charge,
                    (mol.atoms[i].rad[0],mol.atoms[i].rad[1],mol.atoms[i].rad[2]))
        
    mol_pq = Molecule(mol.name, atoms, units='Bohr')
    solver = SCF(mol_pq,method="HF",ConvCriteria=1e-7,MaxIter=40,basis=basis)
    print 'SCF iteration - done'


    solver.iterate()
    norb=int(solver.solver.nclosed)
    w=solver.basis_set.get()


    cf=solver.solver.orbs[:,0:norb]

    psi = [None]*norb
    for i in xrange(norb):
        psi[i] = gto2tuck(w,cf[:,i],x)
        print psi[i].r
        psi[i] = local(psi[i],1e-14)
        psi[i] = tuck.round(psi[i],eps)
        print psi[i].r

    E = solver.solver.orbe[:norb]

    return psi,E
示例#8
0
def readTMorbitals(tm_dir):
    from PyQuante.Molecule import Molecule
    from PyQuante.Basis.basis import BasisSet
    """read TM molecular orbitals and energies"""
    # read coord file
    Data = parseTurbomole(tm_dir + "/coord")
    mol = Molecule('', atomlist=Data["coord"])
    # read basis
    Data = parseTurbomole(tm_dir + "/basis")
    bs = BasisSet(mol, basis_data=Data["basis"])

    Data = parseTurbomole(tm_dir + "/control")
    if ("uhf" not in Data):
        Data = parseTurbomole(tm_dir + "/mos")
        orbe, orbs = Data["scfmo"]
        orbea, orbeb = orbe, orbe
        orbsa, orbsb = orbs, orbs
    else:
        Data = parseTurbomole(tm_dir + "/alpha")
        orbea, orbsa = Data["uhfmo_alpha"]
        Data = parseTurbomole(tm_dir + "/beta")
        orbeb, orbsb = Data["uhfmo_beta"]
    """transform from Turbomole's internal mo format to canonical orbitals"""
    orbsa = canonical_mos(bs, orbsa)
    orbsb = canonical_mos(bs, orbsb)
    """check if mos make sense"""
    #    check_mos(bs.bfs, orbsa)
    #    check_mos(bs.bfs, orbsb)
    return (orbea, orbsa), (orbeb, orbsb)
示例#9
0
def main():
    li = Molecule('Li',
                  atomlist = [(3,(0,0,0))],
                  units='Angs',
                  multiplicity=2)
    en,orbe,orbs = dft(li,ETemp=1e4)
    return en
示例#10
0
def makepyquante(atomcoords, atomnos, charge=0, mult=1):
    """Create a PyQuante Molecule."""
    return Molecule("notitle",
                    list(zip(atomnos, atomcoords)),
                    units="Angstrom",
                    charge=charge,
                    multiplicity=mult)
示例#11
0
def main():
    r = 0.7
    h2 = Molecule('h2',
                  atomlist=[(1, (0, 0, r / 2.)), (1, (0, 0, -r / 2.))],
                  units='Angs')
    en, orbe, orbs = dft(h2, ETemp=1e4)
    return en
示例#12
0
def geo_from_output(fname):
    import re
    from PyQuante.Util import parseline, cleansym
    from PyQuante.Element import sym2no
    from PyQuante.Molecule import Molecule
    igeo = re.compile('Input geometry')
    sgeo = re.compile('Symmetrized geometry')
    # Double check the syntax of these last two
    ngeo = re.compile('new geometry')
    fgeo = re.compile('final geometry')
    geo = []
    file = open(fname)
    while 1:
        line = file.readline()
        if not line: break
        if igeo.search(line) or sgeo.search(line) or ngeo.search(line) \
           or fgeo.search(line):
            geo = []
            line = file.readline()
            line = file.readline()
            while 1:
                line = file.readline()
                if len(line.split()) < 4: break
                sym, x, y, z = parseline(line, 'sfff')
                atno = sym2no[cleansym(sym)]
                geo.append((atno, (x, y, z)))
    return Molecule('jaguar molecule', geo)
示例#13
0
def main():
    atomlist = Molecule('h2o',
                        atomlist=[(8, (0, 0, 0)), (1, (1., 0, 0)),
                                  (1, (0, 1., 0))],
                        units='Angstrom')
    en = scf(atomlist)
    return en
示例#14
0
def test_h2o():
    h2o = Molecule('h2o', [(8, (0., 0., 0.)), (1, (1., 0., 0.)),
                           (1, (0., 1., 0.))],
                   units='Angs')
    from PyQuante.basis_sto3g import basis_data
    test_mol(h2o, basis_data=basis_data)
    return
示例#15
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
示例#16
0
def mindo_test():
    """Test the geometry optimization using MINDO forces"""
    from PyQuante.Molecule import Molecule
    from PyQuante.MINDO3 import get_energy_forces
    h2o = Molecule('H2O',atomlist=[(8,(0,0,0)),(1,(1.,0,0)),(1,(0,1.,0))])
    optimizer = GDIIS(60,0.0001)

    for i in range(25):
        energy,forces = get_energy_forces(h2o)
        forces *= -1
        for i in range(len(h2o)):
            atno,(x,y,z) = h2o[i].atuple()
            fx,fy,fz = forces[i]
            print "%2d %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f " %\
                  (atno,x,y,z,fx,fy,fz)
        newgeo = optimizer.newgeo(h2o.atuples(),forces)
        h2o.update_from_atuples(newgeo)
示例#17
0
def utest():
    from PyQuante import Molecule, HFSolver, DFTSolver, UHFSolver
    logging.basicConfig(level=logging.DEBUG, format="%(message)s")
    mol = Molecule("He", [(2, (0, 0, 0))])
    mol = Molecule("Li", [(3, (0, 0, 0))], multiplicity=2)
    solver = UHFSolver(mol)
    solver.iterate()
    print "HF energy = ", solver.energy
    dft_solver = DFTSolver(mol)
    dft_solver.iterate()
    print "DFT energy = ", dft_solver.energy
    oep = UEXXSolver(solver)
    # Testing 0 temp
    oep.iterate()
    # Testing finite temp
    oep.iterate(etemp=10000)
    return
示例#18
0
def main(**opts):
    r = opts.get('r',0.70)
    h2 = Molecule('h2',
                  atomlist = [(1,(0,0,r/2.)),
                              (1,(0,0,-r/2.))],
                  units='Angs')
    en,orbe,orbs = dft(h2,**opts)
    return en
示例#19
0
def main(**opts):
    r = opts.get('r', 1.0)
    lih = Molecule('lih',
                   atomlist=[(3, (0, 0, 0)), (1, (0, 0, r))],
                   units='Angs')
    en, orbe, orbs = dft(lih, **opts)

    return en
示例#20
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
示例#21
0
def main():
    multn = [None, 2, 1, 2, 1, 2, 3, 4, 3, 2, 1]  # multiplicity of neutral
    multc = [None, None, 2, 1, 2, 1, 2, 3, 4, 3, 2]  # multiplicity of cation
    for atno in range(1, 11):
        print symbol[atno]
        neutral = Molecule(symbol[atno], [(atno, (0, 0, 0))],
                           multiplicity=multn[atno])
        en1 = EN2(neutral)
        if atno > 1:
            cation = Molecule(symbol[atno] + "+", [(atno, (0, 0, 0))],
                              charge=1,
                              multiplicity=multc[atno])
            en2 = EN2(cation)
        else:
            en2 = 0
        ie = (en2 - en1) * 27.2114
        print en1, en2, ie
示例#22
0
def test():
    from PyQuante.PyQuante2 import SCF, DmatSolver
    print "Target energy: ", -1.130501
    h2 = Molecule('H2',
                  atomlist=[(1, (0.35, 0, 0)), (1, (-0.35, 0, 0))],
                  units='Angs')
    h2_hf = SCF(h2, method='HF', SolverConstructor=DmatSolver)
    h2_hf.iterate()
    print "Energy:        ", h2_hf.energy
示例#23
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]
示例#24
0
def main():
    dirname = os.path.dirname(os.path.abspath(__file__))
    filename = os.path.join(dirname, 'LiH.xyz')

    mol = Molecule.from_file(filename, format='xyz')
    bfs = getbasis(mol.atoms, 'sto-3g')

    print(der_overlap_matrix(0, bfs))

    return
示例#25
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
示例#26
0
def main():
    dirname = os.path.dirname(os.path.abspath(__file__))
    filename = os.path.join(dirname, 'LiH.xyz')

    mol = Molecule.from_file(filename, format='xyz')
    bfs = getbasis(mol.atoms, 'sto-3g')

    print(der_overlap_matrix(0, bfs))

    return
示例#27
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
示例#28
0
def main(**opts):
    functional = opts.get('functional', 'BLYP')
    h = Molecule('H', atomlist=[(1, (0, 0, 0))], multiplicity=2)
    he = Molecule('He', atomlist=[(2, (0, 0, 0))])
    li = Molecule('Li', atomlist=[(3, (0, 0, 0))], multiplicity=2)
    be = Molecule('Be', atomlist=[(4, (0, 0, 0))])
    b = Molecule('B', atomlist=[(5, (0, 0, 0))], multiplicity=2)
    c = Molecule('C', atomlist=[(6, (0, 0, 0))], multiplicity=3)
    n = Molecule('N', atomlist=[(7, (0, 0, 0))], multiplicity=4)
    o = Molecule('O', atomlist=[(8, (0, 0, 0))], multiplicity=3)
    f = Molecule('F', atomlist=[(9, (0, 0, 0))], multiplicity=2)
    ne = Molecule('Ne', atomlist=[(10, (0, 0, 0))])
    #for atoms in [h,he,li,be,b,c,n,o,f,ne]:
    # Just do singlets now, since higher multiplicities are off
    #  b/c of Average Open Shell issues
    print "Running Pople atom tests using %s functional" % functional
    for atoms in [he, be, ne]:
        en, orbe, orbs = dft(atoms, functional=functional)
        print atoms.name, en
    return
示例#29
0
def parse_atoms(atom_lines,**opts):
    from PyQuante.Molecule import Molecule
    
    atomlist = []
    for line in atom_lines[1:]:
        atno,x,y,z = parseline(line,'xxdfff')
        atomlist.append((atno,(x,y,z)))

    molopts = {}
    if re.search("Angs",atom_lines[0]): molopts['units'] = 'angs'
    atoms = Molecule('Molf',atomlist,**molopts)

    return atoms
示例#30
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
示例#31
0
 def setUp(self):
     from PyQuante.Molecule import Molecule
     self.h2 = Molecule('H2',
                        atomlist=[(1, (0.35, 0, 0)), (1, (-0.35, 0, 0))],
                        units='Angs')
     self.he = Molecule('He', atomlist=[(2, (0, 0, 0))])
     self.li = Molecule('Li', atomlist=[(3, (0, 0, 0))], multiplicity=2)
     self.li_p = Molecule('Li+', atomlist=[(3, (0, 0, 0))], charge=1)
     self.li_m = Molecule('Li-', atomlist=[(3, (0, 0, 0))], charge=-1)
     self.h2o = Molecule('h2o', [(8, (0, 0, 0)), (1, (1., 0, 0)),
                                 (1, (0, 1., 0))],
                         units="Angstrom")
     self.oh = Molecule('oh', [(8, (0, 0, 0)), (1, (1., 0, 0))],
                        units="Angstrom")
     self.lih = Molecule('LiH', [(1, (0, 0, 1.5)), (3, (0, 0, -1.5))],
                         units='Bohr')
示例#32
0
def main():
    he = Molecule('He', atomlist=[(2, (0, 0, 0))])
    ne = Molecule('Ne', atomlist=[(10, (0, 0, 0))])
    he3 = Molecule('He3', atomlist=[(2, (0, 0, 0))], multiplicity=3)

    # S0 functional
    en, orbe, orbs = dft(he, functional='S0', basis=basis_data)
    print "He S0 sb %10.5f is %10.5f" % (-2.7229973821, en)
    en, orbe, orbs = dft(ne, functional='S0', basis=basis_data)
    print "Ne S0 sb %10.5f is %10.5f" % (-127.4597878033, en)
    en, orbe, orbs = dft(he3, functional='S0', basis=basis_data)
    print "He3 S0 sb %10.5f is %10.5f" % (-1.7819689849, en)

    # SVWN functional
    en, orbe, orbs = dft(he, functional='SVWN', basis=basis_data)
    print "He SVWN sb %10.5f is %10.5f" % (-2.834247, en)
    en, orbe, orbs = dft(ne, functional='SVWN', basis=basis_data)
    print "Ne SVWN sb %10.5f is %10.5f" % (-127.203239, en)
    en, orbe, orbs = dft(he3, functional='SVWN', basis=basis_data)
    print "He3 SVWN sb %10.5f is %10.5f" % (-1.833287, en)

    # XPBE functional
    return
示例#33
0
def makepyquante(atomcoords, atomnos, charge=0, mult=1):
    """Create a PyQuante Molecule.

    >>> import numpy
    >>> from PyQuante.hartree_fock import hf
    >>> atomnos = numpy.array([1,8,1],"i")
    >>> a = numpy.array([[-1,1,0],[0,0,0],[1,1,0]],"f")
    >>> pyqmol = makepyquante(a,atomnos)
    >>> en,orbe,orbs = hf(pyqmol)
    >>> print int(en * 10) / 10. # Should be around -73.8
    -73.8
    """
    return Molecule("notitle", list(zip(atomnos, atomcoords)), units="Angstrom",
                    charge=charge, multiplicity=mult)
示例#34
0
def to_pyquante_molecule(avogadro_mol):
    """Convert from Avogadro format to pyquante format

    Arguments:
    - `avogadro_mol`: molecule in Avogadro format
    Returns:
    - pyquante_mol : molecule in pyquante format
    """
    from PyQuante.Molecule import Molecule

    atom_list = []
    for atom in avogadro_mol.atoms:
        atom_entry = (atom.atomicNumber, atom.pos)
        atom_list.append(atom_entry)

    pyquante_mol = Molecule("mol", atom_list)
    return pyquante_mol
示例#35
0
def dissoc(**opts):
    rmin = opts.get('rmin', 0.65)
    rmax = opts.get('rmax', 1.01)
    step = opts.get('step', 0.05)
    doplot = opts.get('doplot', False)
    rs = arange(rmin, rmax, step)
    E = []
    for r in rs:
        lih = Molecule('lih',
                       atomlist=[(3, (0, 0, 0)), (1, (0, 0, r))],
                       units='Angs')
        en, orbe, orbs = dft(lih, **opts)
        print "%.3f %.5f" % (r, en)
        E.append(en)

    if doplot:
        from pylab import plot
        plot(rs, E, 'bo-')
    return
示例#36
0
from PyQuante.Ints      import getbasis
from PyQuante.Molecule  import Molecule
from PyQuante.CGBF      import coulomb
from numpy              import *
from functions	import *
import math
import itertools
import sys

# Read command line arguments
# First arg is atomic number, second basis name
K = int(sys.argv[1])
basisName = sys.argv[2]

molec = Molecule('mol',[(K,(0,0,0))])

# Create a basis for this molecule
# Access the CGBF atributes of the CGBF number n by doing 
# basis.bfs[CGBF_n].atribute (or, since it has some operator overloading defined, 
# basis[n] = basis.bfs[n])
# E.g. basis.bfs[0].powers (basis[0].powers)
# One can also access the contraction coefficients and the exponents of the 
# PGBF making up the CGBF by doing
# basis[CGBF_n].pcoefs[PGBF_i]
# basis[CGBF_n].pexps[PGBF_i]


# Use "6-31g**" for "best" results
# Use "STO-3G" for debbuging
bas = getbasis(molec,basis_data="6-31g**")
示例#37
0
文件: h2o.py 项目: ForNeVeR/Liquid
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)