示例#1
0
def main():
  data = CanTherm()
  inputFile = open(sys.argv[1],'r') 
  oFile = open('cantherm.out','w')
  readGeomFc.readInputFile(inputFile,data)

  data.Entropy=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Cp=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Thermal=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Partition=len(data.MoleculeList)*len(data.Temp)*[1.0]
  Entropy = data.Entropy
  Cp = data.Cp
  Thermal = data.Thermal
  Partition = data.Partition

  for i in range(len(data.MoleculeList)):
     molecule = data.MoleculeList[i]
     oFile.write('Molecule '+str(i+1)+':\n')
     oFile.write('-----------\n\n')
     molecule.printData(oFile)

     oFile.write('\nThermodynamic Data\n')

     Temp = data.Temp
     #translation
     (ent,cp,dh,q) = molecule.getTranslationThermo(oFile,data.Temp) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j]=Partition[i*len(Temp)+j]*q[j]
  
     #vibrational
     (ent,cp,dh,q) = molecule.getVibrationalThermo(oFile,data.Temp,data.scale) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]
         #print '%12.2f'%float(ent[j]),
     #print '\n'

     #Internal rotational
     if molecule.numRotors != 0:
      (ent,cp,dh,q) = molecule.getIntRotationalThermo_Q(oFile,data.Temp) 
      for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]
         #print '%12.2f'%float(ent[j]),
     #print '\n'

     #External rotational
     (ent,cp,dh,q) = molecule.getExtRotationalThermo(oFile,data.Temp) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]

     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+1.985*math.log(molecule.nelec)
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j] * molecule.nelec

     #print Enthalpy
     H = molecule.Energy
     atoms = readGeomFc.getAtoms(molecule.Mass)
     atomsH = 0.0
     if molecule.Etype == 'cbsqb3':
        atomE = data.atomEcbsqb3
     if molecule.Etype == 'g3':
        atomE = data.atomEg3
     for atom in atoms:
         H -= atomE[atom]
         atomsH += data.atomH[atom]
     H = H*627.5095+atomsH

     if molecule.Etype == 'cbsqb3':
       b = 0
       for bonds in molecule.bonds:
         H += bonds*data.bondC[b]
         b += 1


     #MRH 30Jan2010
     #This E0 will be used in the Eckart tunneling calculation
     molecule.E0 = H

     H += Thermal[i*len(Temp)+0]

     print '%12.2f'%H + '%12.2f'%Entropy[i*len(Temp)+0],
     for c in range(1,len(Temp)):
        print '%12.2f'%Cp[i*len(Temp)+c],
     print '\n'

     #for c in range(len(Temp)):
        #print '%12.2e'%Partition[i*len(Temp)+c],
     #print

  if len(data.MoleculeList) == 1:
     return

  #fit the rate coefficient
  A = matrix(zeros((len(Temp),3),dtype=float))
  A1 = matrix(zeros((len(Temp),2),dtype=float))
  y = matrix(zeros((len(Temp),1),dtype=float))

  rate = [0.0]*len(Temp)
  for j in range(len(Temp)):

    if (data.ReacType == 'Unimol'):
      #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*math.exp((Entropy[len(Temp)+j]-Entropy[j])/1.985)*math.exp(-(data.MoleculeList[1].Energy - data.MoleculeList[0].Energy)*627.5095*1.0e3/1.985/Temp[j])
      kbT_h = (1.381e-23*Temp[j]/6.626e-34)
      G_TS = Thermal[len(Temp)+j]*1e3+data.MoleculeList[1].Energy*627.5095*1e3-Temp[j]*Entropy[len(Temp)+j]
      G_react = Thermal[j]*1e3+data.MoleculeList[0].Energy*627.5095*1e3-Temp[j]*Entropy[j]
      #qTS_qA = Partition[len(Temp)+j]/Partition[j]
      #exp_e_RT = math.exp(-(data.MoleculeList[1].Energy-data.MoleculeList[0].Energy)*627.5095*1e3/1.985/Temp[j])
      #print kbT_h * exp_S_R * exp_H_RT
      #print qTS_qA * exp_e_RT
      rate[j] = kbT_h * math.exp(-(G_TS-G_react)/1.985/Temp[j])

      #Tunneling:
      #Wigner - need imaginary frequency + temperature
      if data.TunnelType == 'Wigner' :
          kappa = 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[1].imagFreq/Temp[j])**2
          print kappa
          rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[1].imagFreq/Temp[j])**2
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
      elif data.TunnelType == 'sEckart' :
          delV1 = data.MoleculeList[1].E0-data.MoleculeList[0].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[1].imagFreq)
          alpha2 = alpha1
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
      elif data.TunnelType == 'aEckart' :
          delV1 = data.MoleculeList[1].E0-data.MoleculeList[0].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[1].imagFreq)
          if data.numProds == 1 :
              delV2 = data.MoleculeList[1].E0-data.MoleculeList[2].E0
          else :
              delV2 = data.MoleculeList[1].E0-data.MoleculeList[2].E0-data.MoleculeList[3].E0
          alpha2 = 2*math.pi*delV2/6.022e23/6.626e-34/3.00e10*4184/(-1*data.MoleculeList[1].imagFreq)
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)

    elif (data.ReacType == 'Bimol'):
      #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*(82.05746*Temp[j]/1.0)*math.exp((Entropy[2*len(Temp)+j]-Entropy[len(Temp)+j]-Entropy[j])/1.985)*math.exp(-(data.MoleculeList[2].Energy - data.MoleculeList[0].Energy - data.MoleculeList[1].Energy)*627.5095*1.0e3/1.985/Temp[j])
      
      kbT_h = (1.381e-23*Temp[j]/6.626e-34)
      exp_S_R = math.exp((Entropy[2*len(Temp)+j]-Entropy[len(Temp)+j]-Entropy[j])/1.985)
      exp_H_RT = math.exp(-(Thermal[2*len(Temp)+j]-Thermal[len(Temp)+j]-Thermal[j])*1e3/1.985/Temp[j])
      rate[j] = kbT_h * exp_S_R * exp_H_RT

      #wigner correction
      #rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[2].imagFreq/Temp[j])**2
      #Tunneling:
      #Wigner - need imaginary frequency + temperature
      if data.TunnelType == 'Wigner' :
          rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[2].imagFreq/Temp[j])**2
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
      elif data.TunnelType == 'sEckart' :
          delV1 = data.MoleculeList[2].E0-data.MoleculeList[0].E0-data.MoleculeList[1].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[2].imagFreq)
          alpha2 = alpha1
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
      elif data.TunnelType == 'aEckart' :
          delV1 = data.MoleculeList[2].E0-data.MoleculeList[0].E0-data.MoleculeList[1].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[2].imagFreq)
          if data.numProds == 1 :
              delV2 = data.MoleculeList[2].E0-data.MoleculeList[3].E0
          else :
              delV2 = data.MoleculeList[2].E0-data.MoleculeList[3].E0-data.MoleculeList[4].E0
          alpha2 = 2*math.pi*delV2/6.022e23/6.626e-34/3.00e10*4184/(-1*data.MoleculeList[2].imagFreq)
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)

    A[j,:] = mat([1.0, math.log(Temp[j]), -1.0/1.985/Temp[j]])
    y[j] = log(rate[j])
    A1[j,:] = mat([1.0, -1.0/1.985/Temp[j]])
  b = linalg.inv(transpose(A)*A)*(transpose(A)*y)
  b1 = linalg.inv(transpose(A1)*A1)*(transpose(A1)*y)
  oFile.write('\n\nRate Data: Modified Arrhenius format\n')
  oFile.write('r = A*(T/1000)^n*exp(-Ea/R/T)'+'%12.2e'%(exp(b[0])*1000.0**float(b[1]))+'%6.2f'%b[1]+'%12.2f'%(b[2]/1.0e3)+'\n')
  oFile.write('r = A*T^n*exp(-Ea/R/T)'+'%12.2e'%(exp(b[0]))+'%6.2f'%b[1]+'%12.2f'%(b[2]/1.0e3)+'\n')
  oFile.write('%12s'%'Temperature'+'%12s'%'Rate'+'%12s\n'%'Fit Rate')
  for j in range(len(Temp)):
      fitrate = exp(b[0])*Temp[j]**float(b[1])*exp(-b[2]/1.985/Temp[j])
      oFile.write('%12.2f'%Temp[j]+'%12.2e'%rate[j]+'%12.2e\n'%fitrate)
  oFile.write('\n\n')
  oFile.write('Rate Data: Arrhenius format\n')
  oFile.write('r = A*exp(-Ea/R/T)'+'%12.2e'%(exp(b1[0]))+'%12.2f'%(b1[1]/1.0e3)+'\n')
  oFile.write('%12s'%'Temperature'+'%12s'%'Rate'+'%12s\n'%'Fit Rate')
  for j in range(len(Temp)) :
      fitrate2 = exp(b1[0])*exp(-b1[1]/1.985/Temp[j])
      oFile.write('%12.2f'%Temp[j]+'%12.2e'%rate[j]+'%12.2e\n'%fitrate2)
  oFile.write('\n\n')
  oFile.close()
def main():
  data = CanTherm()
  inputFile = open(sys.argv[1],'r') 
  readGeomFc.readInputFile(inputFile,data)
  
  mol = data.MoleculeList[0]
  symm = mol.extSymm
  Mass = mol.Mass
  geom = mol.geom

  print "NearProlateP"
  print  "NElecStatesD"
  print  "1"
  print  "ElecStatesL"
  print mol.nelec," , 0.0D0"
  print "NModesD"
  print len(mol.Freq), " ,0.99"
  print  "ModesL"
  for i in range(len(mol.Freq)/3+1):
      for j in range(3):
          if 3*i+j <len(mol.Freq):
              print '%10.3f'%mol.Freq[3*i+j],
      print
  print
  if (len(mol.Harmonics) != 0):
    print "HindRotorD"
    print len(mol.Harmonics)
    for i in range(len(mol.Harmonics)):
       harmonic = mol.Harmonics[i]
       rot = mol.rotors[i+1]
       symm = symm * mol.rotors[i+1].symm
       print " "
       print "CartesianP"
       print "NMAtomsD"
       print len(rot.atomsList)," ", len(rot.nonRotorList)   
       print "PositionL"
       for j in rot.atomsList:
         print "%12.6f"%float(Mass[j-1]), "%12.3f"%geom[j-1,0], "%12.3f"%geom[j-1,1], "%12.3f"%geom[j-1,2]
       print "%12.6f"%float(Mass[rot.pivot2-1]), "%12.3f"%geom[rot.pivot2-1,0], "%12.3f"%geom[rot.pivot2-1,1], "%12.3f"%geom[rot.pivot2-1,2]
       for j in rot.nonRotorList:
         if (j != rot.pivot2):
           print "%12.6f"%float(Mass[j-1]), "%12.3f"%geom[j-1,0], "%12.3f"%geom[j-1,1], "%12.3f"%geom[j-1,2]

       print "HindTypeD"
       print "10"
       print "NCOSNSIND"
       print "5 5"
       print "HindParL"
       for i in range(5):
          print '%12.4e'%harmonic.Kcos[i], i+1
       for i in range(5):
          print '%12.4e'%harmonic.Ksin[i], i+1

       print "0.0"
    print
  print "SigRotD"
  print symm 
  print " "
  print "CartesianP"
  print "NAtomsD"
  print len(mol.Mass)
  print "PositionL"
  for i in range(len(Mass)):
    print "%12.6f"%float(Mass[i]), "%12.3f"%geom[i,0], "%12.3f"%geom[i,1], "%12.3f"%geom[i,2], '!#',i+1
示例#3
0
def main():
    data = CanTherm()
    inputFile = open(sys.argv[1], 'r')
    readGeomFc.readInputFile(inputFile, data)

    mol = data.MoleculeList[0]
    symm = mol.extSymm
    Mass = mol.Mass
    geom = mol.geom

    print "NearProlateP"
    print "NElecStatesD"
    print "1"
    print "ElecStatesL"
    print mol.nelec, " , 0.0D0"
    print "NModesD"
    print len(mol.Freq), " ,0.99"
    print "ModesL"
    for i in range(len(mol.Freq) / 3 + 1):
        for j in range(3):
            if 3 * i + j < len(mol.Freq):
                print '%10.3f' % mol.Freq[3 * i + j],
        print
    print
    if (len(mol.Harmonics) != 0):
        print "HindRotorD"
        print len(mol.Harmonics)
        for i in range(len(mol.Harmonics)):
            harmonic = mol.Harmonics[i]
            rot = mol.rotors[i + 1]
            symm = symm * mol.rotors[i + 1].symm
            print " "
            print "CartesianP"
            print "NMAtomsD"
            print len(rot.atomsList), " ", len(rot.nonRotorList)
            print "PositionL"
            for j in rot.atomsList:
                print "%12.6f" % float(Mass[j - 1]), "%12.3f" % geom[
                    j - 1, 0], "%12.3f" % geom[j - 1,
                                               1], "%12.3f" % geom[j - 1, 2]
            print "%12.6f" % float(Mass[rot.pivot2 - 1]), "%12.3f" % geom[
                rot.pivot2 - 1,
                0], "%12.3f" % geom[rot.pivot2 - 1,
                                    1], "%12.3f" % geom[rot.pivot2 - 1, 2]
            for j in rot.nonRotorList:
                if (j != rot.pivot2):
                    print "%12.6f" % float(Mass[j - 1]), "%12.3f" % geom[
                        j - 1, 0], "%12.3f" % geom[j - 1,
                                                   1], "%12.3f" % geom[j - 1,
                                                                       2]

            print "HindTypeD"
            print "10"
            print "NCOSNSIND"
            print "5 5"
            print "HindParL"
            for i in range(5):
                print '%12.4e' % harmonic.Kcos[i], i + 1
            for i in range(5):
                print '%12.4e' % harmonic.Ksin[i], i + 1

            print "0.0"
        print
    print "SigRotD"
    print symm
    print " "
    print "CartesianP"
    print "NAtomsD"
    print len(mol.Mass)
    print "PositionL"
    for i in range(len(Mass)):
        print "%12.6f" % float(Mass[i]), "%12.3f" % geom[
            i, 0], "%12.3f" % geom[i, 1], "%12.3f" % geom[i, 2], '!#', i + 1
示例#4
0
def main():
  data = CanTherm()
  inputFile = open(sys.argv[1],'r')
  #determine the output file name by removing the contents of the input filename following the first period and appending the .canout suffix
  periodPosition = sys.argv[1].rfind(".")
  outfilename = sys.argv[1][0:periodPosition]+".canout"
  oFile = open(outfilename,'w')
  readGeomFc.readInputFile(inputFile,data)

  data.Entropy=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Cp=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Thermal=len(data.MoleculeList)*len(data.Temp)*[0.0]
  data.Partition=len(data.MoleculeList)*len(data.Temp)*[1.0]
  Entropy = data.Entropy
  Cp = data.Cp
  Thermal = data.Thermal
  Partition = data.Partition
  Entropy298=0.0
  Thermal298=0.0

  for i in range(len(data.MoleculeList)):
     molecule = data.MoleculeList[i]
     oFile.write('Molecule '+str(i+1)+':\n')
     oFile.write('-----------\n\n')
     molecule.printData(oFile)

     oFile.write('\nThermodynamic Data\n')

     Temp = data.Temp
     temp298 = [298.15] #use 298.15 K as well; this will be used below for printing Hf298, S298
     #translation
     (ent,cp,dh,q) = molecule.getTranslationThermo(oFile,data.Temp) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j]=Partition[i*len(Temp)+j]*q[j]
     (ent298,cp298,dh298,q298) = molecule.getTranslationThermo(oFile,temp298)
     Entropy298=Entropy298+ent298[0]
     Thermal298=Thermal298+dh298[0]
  
     #vibrational
     (ent,cp,dh,q) = molecule.getVibrationalThermo(oFile,data.Temp,data.scale) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]
         #print '%12.2f'%float(ent[j]),
     #print '\n'
     (ent298,cp298,dh298,q298) = molecule.getVibrationalThermo(oFile,temp298,data.scale)
     Entropy298=Entropy298+ent298[0]
     Thermal298=Thermal298+dh298[0]

     #Internal rotational
     if molecule.numRotors != 0:
      (ent,cp,dh,q) = molecule.getIntRotationalThermo_Q(oFile,data.Temp) 
      for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]
         #print '%12.2f'%float(ent[j]),
      #print '\n'
      (ent298,cp298,dh298,q298) = molecule.getIntRotationalThermo_Q(oFile,temp298)
      Entropy298=Entropy298+ent298[0]
      Thermal298=Thermal298+dh298[0]

     #External rotational
     (ent,cp,dh,q) = molecule.getExtRotationalThermo(oFile,data.Temp) 
     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+ent[j]
         Cp[i*len(Temp)+j]=Cp[i*len(Temp)+j]+cp[j]
         Thermal[i*len(Temp)+j]=Thermal[i*len(Temp)+j]+dh[j]
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j]*q[j]
     (ent298,cp298,dh298,q298) = molecule.getExtRotationalThermo(oFile,temp298)
     Entropy298=Entropy298+ent298[0]
     Thermal298=Thermal298+dh298[0]

     for j in range(len(Temp)):
         Entropy[i*len(Temp)+j]=Entropy[i*len(Temp)+j]+1.9872*math.log(molecule.nelec)
         Partition[i*len(Temp)+j] = Partition[i*len(Temp)+j] * molecule.nelec
     Entropy298=Entropy298+1.9872*math.log(molecule.nelec)

     #print Enthalpy

     H = molecule.Energy
     if not molecule.Etype == 'mm4':#for the MM4 case, the value passed in should be in kcal/mol and should not require unit adjustments or atomization energy information
	 atoms = readGeomFc.getAtoms(molecule.Mass)
	 atomsH = 0.0
	 #atomsH0 = 0.0
	 if molecule.Etype == 'cbsqb3':
	    atomE = data.atomEcbsqb3
	 if molecule.Etype == 'cbsqb3uf':
	    atomE = data.atomEcbsqb3uf
	 if molecule.Etype == 'g3':
	    atomE = data.atomEg3
	 if molecule.Etype == 'klip_1':
	    atomE = data.atomEKlip_1
	 if molecule.Etype == 'klip_2':
	    atomE = data.atomEKlip_2
	 if molecule.Etype == 'klip_2_cc':
	    atomE = data.atomEKlip_2_cc
	 for atom in atoms:
	     H -= atomE[atom]
	     atomsH += data.atomH[atom]
	#     atomsH0 += data.atomH0[atom]
	 H = H*627.5095+atomsH
	# H0 = H*627.5095+atomsH0

     if (molecule.Etype == 'cbsqb3' or molecule.Etype == 'cbsqb3uf') :
       b = 0
       for bonds in molecule.bonds:
         H += bonds*data.bondC[b]
         b += 1


     #MRH 30Jan2010
     #This E0 will be used in the Eckart tunneling calculation
     molecule.E0 = H

     H298 = H + Thermal298
     H += Thermal[i*len(Temp)+0]

     print '%12.2f'%H298 + '%12.2f'%Entropy298,
#     print '%12.2f'%float(H*4.187) + '%12.2f'%float(Entropy[i*len(Temp)+0]*4.187)
     for c in range(0,len(Temp)):
        print '%12.2f'%Cp[i*len(Temp)+c],
     print '\n'

     oFile.write("Hf298 S298 Cps:\n")
     oFile.write(str(H298)+" "+ str(Entropy298))
#     print '%12.2f'%float(H*4.187) + '%12.2f'%float(Entropy[i*len(Temp)+0]*4.187)
     for c in range(0,len(Temp)):
        oFile.write(" "+str(Cp[i*len(Temp)+c]))
#     print '\n'

     #for c in range(len(Temp)):
        #print '%12.2e'%Partition[i*len(Temp)+c],
     #print
     if data.fitcp:
       FitCp.FitHeatCapacity(Temp,Cp, molecule.linearity, molecule.Freq, molecule.numRotors, molecule.R, oFile)

  if len(data.MoleculeList) == 1:
     return

  #fit the rate coefficient
  A = matrix(zeros((len(Temp),3),dtype=float))
  A1 = matrix(zeros((len(Temp),2),dtype=float))
  y = matrix(zeros((len(Temp),1),dtype=float))

  rate = [0.0]*len(Temp)
  for j in range(len(Temp)):

    if (data.ReacType == 'Unimol'):
      #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*math.exp((Entropy[len(Temp)+j]-Entropy[j])/1.9872)*math.exp(-(data.MoleculeList[1].Energy - data.MoleculeList[0].Energy)*627.5095*1.0e3/1.9872/Temp[j])
      kbT_h = (1.381e-23*Temp[j]/6.626e-34)
      G_TS = Thermal[len(Temp)+j]*1e3+data.MoleculeList[1].Energy*627.5095*1e3-Temp[j]*Entropy[len(Temp)+j]
      G_react = Thermal[j]*1e3+data.MoleculeList[0].Energy*627.5095*1e3-Temp[j]*Entropy[j]
      #qTS_qA = Partition[len(Temp)+j]/Partition[j]
      #exp_e_RT = math.exp(-(data.MoleculeList[1].Energy-data.MoleculeList[0].Energy)*627.5095*1e3/1.9872/Temp[j])
      #print kbT_h * exp_S_R * exp_H_RT
      #print qTS_qA * exp_e_RT
      rate[j] = kbT_h * math.exp(-(G_TS-G_react)/1.9872/Temp[j])

      #Tunneling:
      #Wigner - need imaginary frequency + temperature
      if data.TunnelType == 'Wigner' :
          kappa = 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[1].imagFreq/Temp[j])**2
          print kappa
          rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[1].imagFreq/Temp[j])**2
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
      elif data.TunnelType == 'sEckart' :
          delV1 = data.MoleculeList[1].E0-data.MoleculeList[0].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[1].imagFreq)
          alpha2 = alpha1
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
      elif data.TunnelType == 'aEckart' :
          delV1 = data.MoleculeList[1].E0-data.MoleculeList[0].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[1].imagFreq)
          if data.numProds == 1 :
              delV2 = data.MoleculeList[1].E0-data.MoleculeList[2].E0
          else :
              delV2 = data.MoleculeList[1].E0-data.MoleculeList[2].E0-data.MoleculeList[3].E0
          delV2 = delV2 / 6.022e23 * 4184
          alpha2 = 2*math.pi*delV2/6.626e-34/3.00e10/(-1*data.MoleculeList[1].imagFreq)
          if (alpha1<alpha2):
              rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
          else:
              # reverse the direction: pass delV2 and alpha1 in place of alpha2
              rate[j] *= Eckart.computeTunnelingCorrection(delV2,Temp[j],alpha2,alpha1)

    elif (data.ReacType == 'Bimol'):
      #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*(82.05746*Temp[j]/1.0)*math.exp((Entropy[2*len(Temp)+j]-Entropy[len(Temp)+j]-Entropy[j])/1.9872)*math.exp(-(data.MoleculeList[2].Energy - data.MoleculeList[0].Energy - data.MoleculeList[1].Energy)*627.5095*1.0e3/1.9872/Temp[j])
      
      kbT_hC = (1.381e-23*Temp[j]/6.626e-34)*(82.05746*Temp[j]/1.0)
      G_TS = Thermal[2*len(Temp)+j]*1e3+data.MoleculeList[2].Energy*627.5095*1e3-Temp[j]*Entropy[2*len(Temp)+j]
      G_react1 = Thermal[len(Temp)+j]*1e3+data.MoleculeList[1].Energy*627.5095*1e3-Temp[j]*Entropy[len(Temp)+j]
      G_react2 = Thermal[j]*1e3+data.MoleculeList[0].Energy*627.5095*1e3-Temp[j]*Entropy[j]
      rate[j] = kbT_hC * math.exp(-(G_TS-G_react1-G_react2)/1.9872/Temp[j])

      #wigner correction
      #rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[2].imagFreq/Temp[j])**2
      #Tunneling:
      #Wigner - need imaginary frequency + temperature
      if data.TunnelType == 'Wigner' :
          rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[2].imagFreq/Temp[j])**2
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
      elif data.TunnelType == 'sEckart' :
          delV1 = data.MoleculeList[2].E0-data.MoleculeList[0].E0-data.MoleculeList[1].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[2].imagFreq)
          alpha2 = alpha1
          rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
      #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
      elif data.TunnelType == 'aEckart' :
          delV1 = data.MoleculeList[2].E0-data.MoleculeList[0].E0-data.MoleculeList[1].E0
          delV1 = delV1 / 6.022e23 * 4184
          alpha1 = 2*math.pi*delV1/6.626e-34/3.00e10/(-1*data.MoleculeList[2].imagFreq)
          if data.numProds == 1 :
              delV2 = data.MoleculeList[2].E0-data.MoleculeList[3].E0
          else :
              delV2 = data.MoleculeList[2].E0-data.MoleculeList[3].E0-data.MoleculeList[4].E0
          delV2 = delV2 / 6.022e23 * 4184
          alpha2 = 2*math.pi*delV2/6.626e-34/3.00e10/(-1*data.MoleculeList[2].imagFreq)
          if (alpha1<alpha2):
              rate[j] *= Eckart.computeTunnelingCorrection(delV1,Temp[j],alpha1,alpha2)
          else:
              # reverse the direction: pass delV2 and alpha1 in place of alpha2
              rate[j] *= Eckart.computeTunnelingCorrection(delV2,Temp[j],alpha2,alpha1)

    A[j,:] = mat([1.0, math.log(Temp[j]), -1.0/1.9872/Temp[j]])
    y[j] = log(rate[j])
    A1[j,:] = mat([1.0, -1.0/1.9872/Temp[j]])
  b = linalg.inv(transpose(A)*A)*(transpose(A)*y)
  b1 = linalg.inv(transpose(A1)*A1)*(transpose(A1)*y)
  oFile.write('\n\nRate Data: Modified Arrhenius format\n')
  oFile.write('r = A*(T/1000)^n*exp(-Ea/R/T)'+'%12.2e'%(exp(b[0])*1000.0**float(b[1]))+'%6.2f'%b[1]+'%12.2f'%(b[2]/1.0e3)+'\n')
  oFile.write('r = A*T^n*exp(-Ea/R/T)'+'%12.2e'%(exp(b[0]))+'%6.2f'%b[1]+'%12.2f'%(b[2]/1.0e3)+'\n')
  oFile.write('%12s'%'Temperature'+'%12s'%'Rate'+'%12s\n'%'Fit Rate')
  for j in range(len(Temp)):
      fitrate = exp(b[0])*Temp[j]**float(b[1])*exp(-b[2]/1.9872/Temp[j])
      oFile.write('%12.2f'%Temp[j]+'%12.2e'%rate[j]+'%12.2e\n'%fitrate)
  oFile.write('\n\n')
  oFile.write('Rate Data: Arrhenius format\n')
  oFile.write('r = A*exp(-Ea/R/T)'+'%12.2e'%(exp(b1[0]))+'%12.2f'%(b1[1]/1.0e3)+'\n')
  oFile.write('%12s'%'Temperature'+'%12s'%'Rate'+'%12s\n'%'Fit Rate')
  for j in range(len(Temp)) :
      fitrate2 = exp(b1[0])*exp(-b1[1]/1.9872/Temp[j])
      oFile.write('%12.2f'%Temp[j]+'%12.2e'%rate[j]+'%12.2e\n'%fitrate2)
  oFile.write('\n\n')
  oFile.close()
示例#5
0
def main():
    data = CanTherm()
    inputFile = open(sys.argv[1], 'r')
    #determine the output file name by removing the contents of the input filename following the first period and appending the .canout suffix
    periodPosition = sys.argv[1].rfind(".")
    outfilename = sys.argv[1][0:periodPosition] + ".canout"
    oFile = open(outfilename, 'w')
    readGeomFc.readInputFile(inputFile, data)

    data.Entropy = len(data.MoleculeList) * len(data.Temp) * [0.0]
    data.Cp = len(data.MoleculeList) * len(data.Temp) * [0.0]
    data.Thermal = len(data.MoleculeList) * len(data.Temp) * [0.0]
    data.Partition = len(data.MoleculeList) * len(data.Temp) * [1.0]
    Entropy = data.Entropy
    Cp = data.Cp
    Thermal = data.Thermal
    Partition = data.Partition
    Entropy298 = 0.0
    Thermal298 = 0.0

    for i in range(len(data.MoleculeList)):
        molecule = data.MoleculeList[i]
        oFile.write('Molecule ' + str(i + 1) + ':\n')
        oFile.write('-----------\n\n')
        molecule.printData(oFile)

        oFile.write('\nThermodynamic Data\n')

        Temp = data.Temp
        temp298 = [
            298.15
        ]  #use 298.15 K as well; this will be used below for printing Hf298, S298
        #translation
        (ent, cp, dh, q) = molecule.getTranslationThermo(oFile, data.Temp)
        for j in range(len(Temp)):
            Entropy[i * len(Temp) + j] = Entropy[i * len(Temp) + j] + ent[j]
            Cp[i * len(Temp) + j] = Cp[i * len(Temp) + j] + cp[j]
            Thermal[i * len(Temp) + j] = Thermal[i * len(Temp) + j] + dh[j]
            Partition[i * len(Temp) + j] = Partition[i * len(Temp) + j] * q[j]
        (ent298, cp298, dh298,
         q298) = molecule.getTranslationThermo(oFile, temp298)
        Entropy298 = Entropy298 + ent298[0]
        Thermal298 = Thermal298 + dh298[0]

        #vibrational
        (ent, cp, dh,
         q) = molecule.getVibrationalThermo(oFile, data.Temp, data.scale)
        for j in range(len(Temp)):
            Entropy[i * len(Temp) + j] = Entropy[i * len(Temp) + j] + ent[j]
            Cp[i * len(Temp) + j] = Cp[i * len(Temp) + j] + cp[j]
            Thermal[i * len(Temp) + j] = Thermal[i * len(Temp) + j] + dh[j]
            Partition[i * len(Temp) + j] = Partition[i * len(Temp) + j] * q[j]
            #print '%12.2f'%float(ent[j]),
        #print '\n'
        (ent298, cp298, dh298,
         q298) = molecule.getVibrationalThermo(oFile, temp298, data.scale)
        Entropy298 = Entropy298 + ent298[0]
        Thermal298 = Thermal298 + dh298[0]

        #Internal rotational
        if molecule.numRotors != 0:
            (ent, cp, dh,
             q) = molecule.getIntRotationalThermo_Q(oFile, data.Temp)
            for j in range(len(Temp)):
                Entropy[i * len(Temp) +
                        j] = Entropy[i * len(Temp) + j] + ent[j]
                Cp[i * len(Temp) + j] = Cp[i * len(Temp) + j] + cp[j]
                Thermal[i * len(Temp) + j] = Thermal[i * len(Temp) + j] + dh[j]
                Partition[i * len(Temp) +
                          j] = Partition[i * len(Temp) + j] * q[j]
                #print '%12.2f'%float(ent[j]),
            #print '\n'
            (ent298, cp298, dh298,
             q298) = molecule.getIntRotationalThermo_Q(oFile, temp298)
            Entropy298 = Entropy298 + ent298[0]
            Thermal298 = Thermal298 + dh298[0]

        #External rotational
        (ent, cp, dh, q) = molecule.getExtRotationalThermo(oFile, data.Temp)
        for j in range(len(Temp)):
            Entropy[i * len(Temp) + j] = Entropy[i * len(Temp) + j] + ent[j]
            Cp[i * len(Temp) + j] = Cp[i * len(Temp) + j] + cp[j]
            Thermal[i * len(Temp) + j] = Thermal[i * len(Temp) + j] + dh[j]
            Partition[i * len(Temp) + j] = Partition[i * len(Temp) + j] * q[j]
        (ent298, cp298, dh298,
         q298) = molecule.getExtRotationalThermo(oFile, temp298)
        Entropy298 = Entropy298 + ent298[0]
        Thermal298 = Thermal298 + dh298[0]

        for j in range(len(Temp)):
            Entropy[i * len(Temp) +
                    j] = Entropy[i * len(Temp) +
                                 j] + 1.9872 * math.log(molecule.nelec)
            Partition[i * len(Temp) +
                      j] = Partition[i * len(Temp) + j] * molecule.nelec
        Entropy298 = Entropy298 + 1.9872 * math.log(molecule.nelec)

        #print Enthalpy

        H = molecule.Energy
        if not molecule.Etype == 'mm4':  #for the MM4 case, the value passed in should be in kcal/mol and should not require unit adjustments or atomization energy information
            atoms = readGeomFc.getAtoms(molecule.Mass)
            atomsH = 0.0
            #atomsH0 = 0.0
            if molecule.Etype == 'cbsqb3':
                atomE = data.atomEcbsqb3
            if molecule.Etype == 'cbsqb3uf':
                atomE = data.atomEcbsqb3uf
            if molecule.Etype == 'g3':
                atomE = data.atomEg3
            if molecule.Etype == 'klip_1':
                atomE = data.atomEKlip_1
            if molecule.Etype == 'klip_2':
                atomE = data.atomEKlip_2
            if molecule.Etype == 'klip_2_cc':
                atomE = data.atomEKlip_2_cc
            for atom in atoms:
                H -= atomE[atom]
                atomsH += data.atomH[atom]
#     atomsH0 += data.atomH0[atom]
            H = H * 627.5095 + atomsH
# H0 = H*627.5095+atomsH0

        if (molecule.Etype == 'cbsqb3' or molecule.Etype == 'cbsqb3uf'):
            b = 0
            for bonds in molecule.bonds:
                H += bonds * data.bondC[b]
                b += 1

        #MRH 30Jan2010
        #This E0 will be used in the Eckart tunneling calculation
        molecule.E0 = H

        H298 = H + Thermal298
        H += Thermal[i * len(Temp) + 0]

        print '%12.2f' % H298 + '%12.2f' % Entropy298,
        #     print '%12.2f'%float(H*4.187) + '%12.2f'%float(Entropy[i*len(Temp)+0]*4.187)
        for c in range(0, len(Temp)):
            print '%12.2f' % Cp[i * len(Temp) + c],
        print '\n'

        oFile.write("Hf298 S298 Cps:\n")
        oFile.write(str(H298) + " " + str(Entropy298))
        #     print '%12.2f'%float(H*4.187) + '%12.2f'%float(Entropy[i*len(Temp)+0]*4.187)
        for c in range(0, len(Temp)):
            oFile.write(" " + str(Cp[i * len(Temp) + c]))


#     print '\n'

#for c in range(len(Temp)):
#print '%12.2e'%Partition[i*len(Temp)+c],
#print
        if data.fitcp:
            FitCp.FitHeatCapacity(Temp, Cp, molecule.linearity, molecule.Freq,
                                  molecule.numRotors, molecule.R, oFile)

    if len(data.MoleculeList) == 1:
        return

    #fit the rate coefficient
    A = matrix(zeros((len(Temp), 3), dtype=float))
    A1 = matrix(zeros((len(Temp), 2), dtype=float))
    y = matrix(zeros((len(Temp), 1), dtype=float))

    rate = [0.0] * len(Temp)
    for j in range(len(Temp)):

        if (data.ReacType == 'Unimol'):
            #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*math.exp((Entropy[len(Temp)+j]-Entropy[j])/1.9872)*math.exp(-(data.MoleculeList[1].Energy - data.MoleculeList[0].Energy)*627.5095*1.0e3/1.9872/Temp[j])
            kbT_h = (1.381e-23 * Temp[j] / 6.626e-34)
            G_TS = Thermal[len(Temp) + j] * 1e3 + data.MoleculeList[
                1].Energy * 627.5095 * 1e3 - Temp[j] * Entropy[len(Temp) + j]
            G_react = Thermal[j] * 1e3 + data.MoleculeList[
                0].Energy * 627.5095 * 1e3 - Temp[j] * Entropy[j]
            #qTS_qA = Partition[len(Temp)+j]/Partition[j]
            #exp_e_RT = math.exp(-(data.MoleculeList[1].Energy-data.MoleculeList[0].Energy)*627.5095*1e3/1.9872/Temp[j])
            #print kbT_h * exp_S_R * exp_H_RT
            #print qTS_qA * exp_e_RT
            rate[j] = kbT_h * math.exp(-(G_TS - G_react) / 1.9872 / Temp[j])

            #Tunneling:
            #Wigner - need imaginary frequency + temperature
            if data.TunnelType == 'Wigner':
                kappa = 1.0 + 1.0 / 24.0 * (
                    1.44 * data.MoleculeList[1].imagFreq / Temp[j])**2
                print kappa
                rate[j] *= 1.0 + 1.0 / 24.0 * (
                    1.44 * data.MoleculeList[1].imagFreq / Temp[j])**2
            #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
            elif data.TunnelType == 'sEckart':
                delV1 = data.MoleculeList[1].E0 - data.MoleculeList[0].E0
                delV1 = delV1 / 6.022e23 * 4184
                alpha1 = 2 * math.pi * delV1 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[1].imagFreq)
                alpha2 = alpha1
                rate[j] *= Eckart.computeTunnelingCorrection(
                    delV1, Temp[j], alpha1, alpha2)
            #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
            elif data.TunnelType == 'aEckart':
                delV1 = data.MoleculeList[1].E0 - data.MoleculeList[0].E0
                delV1 = delV1 / 6.022e23 * 4184
                alpha1 = 2 * math.pi * delV1 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[1].imagFreq)
                if data.numProds == 1:
                    delV2 = data.MoleculeList[1].E0 - data.MoleculeList[2].E0
                else:
                    delV2 = data.MoleculeList[1].E0 - data.MoleculeList[
                        2].E0 - data.MoleculeList[3].E0
                delV2 = delV2 / 6.022e23 * 4184
                alpha2 = 2 * math.pi * delV2 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[1].imagFreq)
                if (alpha1 < alpha2):
                    rate[j] *= Eckart.computeTunnelingCorrection(
                        delV1, Temp[j], alpha1, alpha2)
                else:
                    # reverse the direction: pass delV2 and alpha1 in place of alpha2
                    rate[j] *= Eckart.computeTunnelingCorrection(
                        delV2, Temp[j], alpha2, alpha1)

        elif (data.ReacType == 'Bimol'):
            #rate[j] = (1.381e-23*Temp[j]/6.626e-34)*(82.05746*Temp[j]/1.0)*math.exp((Entropy[2*len(Temp)+j]-Entropy[len(Temp)+j]-Entropy[j])/1.9872)*math.exp(-(data.MoleculeList[2].Energy - data.MoleculeList[0].Energy - data.MoleculeList[1].Energy)*627.5095*1.0e3/1.9872/Temp[j])

            kbT_hC = (1.381e-23 * Temp[j] / 6.626e-34) * (82.05746 * Temp[j] /
                                                          1.0)
            G_TS = Thermal[2 * len(Temp) + j] * 1e3 + data.MoleculeList[
                2].Energy * 627.5095 * 1e3 - Temp[j] * Entropy[2 * len(Temp) +
                                                               j]
            G_react1 = Thermal[len(Temp) + j] * 1e3 + data.MoleculeList[
                1].Energy * 627.5095 * 1e3 - Temp[j] * Entropy[len(Temp) + j]
            G_react2 = Thermal[j] * 1e3 + data.MoleculeList[
                0].Energy * 627.5095 * 1e3 - Temp[j] * Entropy[j]
            rate[j] = kbT_hC * math.exp(
                -(G_TS - G_react1 - G_react2) / 1.9872 / Temp[j])

            #wigner correction
            #rate[j] *= 1.0 + 1.0/24.0 * (1.44*data.MoleculeList[2].imagFreq/Temp[j])**2
            #Tunneling:
            #Wigner - need imaginary frequency + temperature
            if data.TunnelType == 'Wigner':
                rate[j] *= 1.0 + 1.0 / 24.0 * (
                    1.44 * data.MoleculeList[2].imagFreq / Temp[j])**2
            #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react)
            elif data.TunnelType == 'sEckart':
                delV1 = data.MoleculeList[2].E0 - data.MoleculeList[
                    0].E0 - data.MoleculeList[1].E0
                delV1 = delV1 / 6.022e23 * 4184
                alpha1 = 2 * math.pi * delV1 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[2].imagFreq)
                alpha2 = alpha1
                rate[j] *= Eckart.computeTunnelingCorrection(
                    delV1, Temp[j], alpha1, alpha2)
            #Symmetric Eckart - need imaginary frequency + temperature + (E0_TS - E_react) + (E0_TS - E_prod)
            elif data.TunnelType == 'aEckart':
                delV1 = data.MoleculeList[2].E0 - data.MoleculeList[
                    0].E0 - data.MoleculeList[1].E0
                delV1 = delV1 / 6.022e23 * 4184
                alpha1 = 2 * math.pi * delV1 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[2].imagFreq)
                if data.numProds == 1:
                    delV2 = data.MoleculeList[2].E0 - data.MoleculeList[3].E0
                else:
                    delV2 = data.MoleculeList[2].E0 - data.MoleculeList[
                        3].E0 - data.MoleculeList[4].E0
                delV2 = delV2 / 6.022e23 * 4184
                alpha2 = 2 * math.pi * delV2 / 6.626e-34 / 3.00e10 / (
                    -1 * data.MoleculeList[2].imagFreq)
                if (alpha1 < alpha2):
                    rate[j] *= Eckart.computeTunnelingCorrection(
                        delV1, Temp[j], alpha1, alpha2)
                else:
                    # reverse the direction: pass delV2 and alpha1 in place of alpha2
                    rate[j] *= Eckart.computeTunnelingCorrection(
                        delV2, Temp[j], alpha2, alpha1)

        A[j, :] = mat([1.0, math.log(Temp[j]), -1.0 / 1.9872 / Temp[j]])
        y[j] = log(rate[j])
        A1[j, :] = mat([1.0, -1.0 / 1.9872 / Temp[j]])
    b = linalg.inv(transpose(A) * A) * (transpose(A) * y)
    b1 = linalg.inv(transpose(A1) * A1) * (transpose(A1) * y)
    oFile.write('\n\nRate Data: Modified Arrhenius format\n')
    oFile.write('r = A*(T/1000)^n*exp(-Ea/R/T)' + '%12.2e' %
                (exp(b[0]) * 1000.0**float(b[1])) + '%6.2f' % b[1] + '%12.2f' %
                (b[2] / 1.0e3) + '\n')
    oFile.write('r = A*T^n*exp(-Ea/R/T)' + '%12.2e' % (exp(b[0])) +
                '%6.2f' % b[1] + '%12.2f' % (b[2] / 1.0e3) + '\n')
    oFile.write('%12s' % 'Temperature' + '%12s' % 'Rate' +
                '%12s\n' % 'Fit Rate')
    for j in range(len(Temp)):
        fitrate = exp(b[0]) * Temp[j]**float(b[1]) * exp(
            -b[2] / 1.9872 / Temp[j])
        oFile.write('%12.2f' % Temp[j] + '%12.2e' % rate[j] +
                    '%12.2e\n' % fitrate)
    oFile.write('\n\n')
    oFile.write('Rate Data: Arrhenius format\n')
    oFile.write('r = A*exp(-Ea/R/T)' + '%12.2e' % (exp(b1[0])) + '%12.2f' %
                (b1[1] / 1.0e3) + '\n')
    oFile.write('%12s' % 'Temperature' + '%12s' % 'Rate' +
                '%12s\n' % 'Fit Rate')
    for j in range(len(Temp)):
        fitrate2 = exp(b1[0]) * exp(-b1[1] / 1.9872 / Temp[j])
        oFile.write('%12.2f' % Temp[j] + '%12.2e' % rate[j] +
                    '%12.2e\n' % fitrate2)
    oFile.write('\n\n')
    oFile.close()