예제 #1
0
def _main():
   # read a file, including orbitals and basis sets, and test
   # if the output orbitals are orthogonal.
   def rmsd(a):
      return np.mean(a.flatten()**2)**.5
   FileName = "benzene.xml"
   #FileName = "/home/cgk/dev/xml-molpro/test1.xml"
   XmlData = ReadMolproXml(FileName,SkipVirtual=True)
   print("Atoms from file [a.u.]:\n{}".format(XmlData.Atoms.MakeXyz(NumFmt="%20.15f",Scale=1/wmme.ToAng)))
   OrbBasis = XmlData.OrbBasis
   #BasisLibs = ["def2-nzvpp-jkfit.libmol"]


   BasisLibs = []
   ic = wmme.FIntegralContext(XmlData.Atoms, XmlData.OrbBasis, FitBasis="univ-JKFIT", BasisLibs=BasisLibs)
   from wmme import mdot
   C = XmlData.Orbs
   S = ic.MakeOverlap()
   print("Orbital matrix shape: {} (loaded from '{}')".format(C.shape, FileName))
   print("Overlap matrix shape: {} (made via WMME)".format(S.shape))
   np.set_printoptions(precision=4,linewidth=10000,edgeitems=3,suppress=False)
   SMo = mdot(C.T, S, C)
   print("Read orbitals:")
   for OrbInfo in XmlData.Orbitals:
      print("{:30s}".format(OrbInfo.Desc))
   print("MO deviation from orthogonality: {:.2e}".format(rmsd(SMo - np.eye(SMo.shape[0]))))

   pass
예제 #2
0
def _run_with_pyscf(FileNameXml):
    # read Molpro XML file exported via {put,xml,filename}
    print "\n* Reading: '%s'" % FileNameXml
    XmlData = MolproXml.ReadMolproXml(FileNameXml, SkipVirtual=True)
    # Note, that right now the default value is  SkipVirtual =True, that means that Orbitals COrb include only those,
    # which have non-zero occupation numbers in XML file. If you want virtual orbitals too, change SkipVirtual to False.

    print "Atoms from file [a.u.]:\n%s" % XmlData.Atoms.MakeXyz(
        NumFmt="%20.15f", Scale=1 / wmme.ToAng)

    # convert data from XML file (atom positions, basis sets, MO coeffs) into format compatible
    # with PySCF.
    Atoms, Basis, COrb = MolproXmlToPyscf.ConvertMolproXmlToPyscfInput(XmlData)

    # make pyscf Mole object
    mol = gto.Mole()
    mol.build(verbose=0, atom=Atoms, basis=Basis, spin=0)

    # compute overlap matrix with PySCF
    S = mol.intor_symmetric('cint1e_ovlp_sph')
    # compute overlap matrix of MO basis overlap, using the MOs imported from the XML,
    # and the overlap matrix computed with PySCF to check that MO were imported properly.
    SMo = mdot(COrb.T, S, COrb)
    PrintMatrix("MO-Basis overlap (should be unity!)", SMo)
    print "RMSD(SMo-id): %8.2e" % rmsd(SMo - np.eye(SMo.shape[0]))
    print
예제 #3
0
def _run_with_pyscf(FileNameXml):
    from pyscf import gto
    from pyscf import scf

    print("\n* Reading: '%s'" % FileNameXml)
    XmlData = MolproXml.ReadMolproXml(FileNameXml, SkipVirtual=True)
    print("Atoms from file [a.u.]:\n%s" %
          XmlData.Atoms.MakeXyz(NumFmt="%20.15f", Scale=1 / wmme.ToAng))

    #  this gives you data from MolproXmlfile ready for use in PySCF
    Atoms, Basis, COrb = ConvertMolproXmlToPyscfInput(XmlData)

    mol = gto.Mole()
    mol.build(
        verbose=0,
        atom=Atoms,
        basis=Basis,
    )

    # compute overlap matrix with PySCF
    S = mol.intor_symmetric('int1e_ovlp_sph')
    # compute overlap matrix of MO basis overlap, using the MOs imported from the XML,
    # and the overlap matrix computed with PySCF to check that MO were imported properly.
    SMo = mdot(COrb.T, S, COrb)
    PrintMatrix("MO-Basis overlap (should be unity!)", SMo)
    print("RMSD(SMo-id): %8.2e" % _rmsd(SMo - np.eye(SMo.shape[0])))
    print
예제 #4
0
파일: MolproXml.py 프로젝트: eronca/pyscf
def _main():
   # read a file, including orbitals and basis sets, and test
   # if the output orbitals are orthogonal.
   def rmsd(a):
      return np.mean(a.flatten()**2)**.5
   FileName = "benzene.xml"
   #FileName = "/home/cgk/dev/xml-molpro/test1.xml"
   XmlData = ReadMolproXml(FileName,SkipVirtual=True)
   print "Atoms from file [a.u.]:\n%s" % XmlData.Atoms.MakeXyz(NumFmt="%20.15f",Scale=1/wmme.ToAng)
   OrbBasis = XmlData.OrbBasis
   #BasisLibs = ["def2-nzvpp-jkfit.libmol"]


   BasisLibs = []
   ic = wmme.FIntegralContext(XmlData.Atoms, XmlData.OrbBasis, FitBasis="univ-JKFIT", BasisLibs=BasisLibs)
   from wmme import mdot
   C = XmlData.Orbs
   S = ic.MakeOverlap()
   print "Orbital matrix shape: %s (loaded from '%s')" % (C.shape, FileName)
   print "Overlap matrix shape: %s (made via WMME)" % (S.shape,)
   np.set_printoptions(precision=4,linewidth=10000,edgeitems=3,suppress=False)
   SMo = mdot(C.T, S, C)
   print "Read orbitals:"
   for OrbInfo in XmlData.Orbitals:
      print "%30s" % OrbInfo.Desc
   print "MO deviation from orthogonality: %.2e" % rmsd(SMo - np.eye(SMo.shape[0]))

   pass
예제 #5
0
def _run_with_pyscf(FileNameXml):
   from pyscf import gto
   from pyscf import scf

   print "\n* Reading: '%s'" % FileNameXml
   XmlData = MolproXml.ReadMolproXml(FileNameXml, SkipVirtual=True)
   print "Atoms from file [a.u.]:\n%s" % XmlData.Atoms.MakeXyz(NumFmt="%20.15f",Scale=1/wmme.ToAng)


#  this gives you data from MolproXmlfile ready for use in PySCF
   Atoms, Basis, COrb = ConvertMolproXmlToPyscfInput(XmlData)

   mol = gto.Mole()
   mol.build(
      verbose = 0,
      atom = Atoms,
      basis = Basis,
   )

# compute overlap matrix with PySCF
   S = mol.intor_symmetric('cint1e_ovlp_sph')
# compute overlap matrix of MO basis overlap, using the MOs imported from the XML,
# and the overlap matrix computed with PySCF to check that MO were imported properly.
   SMo = mdot(COrb.T, S, COrb)
   PrintMatrix("MO-Basis overlap (should be unity!)", SMo)
   print "RMSD(SMo-id): %8.2e" % _rmsd(SMo - np.eye(SMo.shape[0]))
   print
예제 #6
0
def _run_with_pyscf(FileNameXml):
   # read Molpro XML file exported via {put,xml,filename}
   print "\n* Reading: '%s'" % FileNameXml
   XmlData = MolproXml.ReadMolproXml(FileNameXml, SkipVirtual=True)
# Note, that right now the default value is  SkipVirtual =True, that means that Orbitals COrb include only those,
# which have non-zero occupation numbers in XML file. If you want virtual orbitals too, change SkipVirtual to False.
 
   print "Atoms from file [a.u.]:\n%s" % XmlData.Atoms.MakeXyz(NumFmt="%20.15f",Scale=1/wmme.ToAng)

   # convert data from XML file (atom positions, basis sets, MO coeffs) into format compatible
   # with PySCF.
   Atoms, Basis, COrb = MolproXmlToPyscf.ConvertMolproXmlToPyscfInput(XmlData)

   # make pyscf Mole object
   mol = gto.Mole()
   mol.build(
      verbose = 0,
      atom = Atoms,
      basis = Basis,
      spin = 0
   ) 

   
   # compute overlap matrix with PySCF
   S = mol.intor_symmetric('cint1e_ovlp_sph')
   # compute overlap matrix of MO basis overlap, using the MOs imported from the XML,
   # and the overlap matrix computed with PySCF to check that MO were imported properly.
   SMo = mdot(COrb.T, S, COrb)
   PrintMatrix("MO-Basis overlap (should be unity!)", SMo)
   print "RMSD(SMo-id): %8.2e" % rmsd(SMo - np.eye(SMo.shape[0]))
   print