def E_zpe(): say("ZPE.") """ run hessian on equilibrium geometry get zero point energy. n note: linear tri-atomics and larger give high ZPE values in NWChem @ HF/6-31G* """ global Ezpe global Ethermal global Hthermal global AtomsList # these identifiers replicate those used in NWChem freq calculations # AUKCAL = 627.5093314 # WRONG! AUKCAL = kCalPerHartree c = 2.99792458e10 h = 6.62606957e-27 kgas = 1.3806488e-16 # cgs units Rgas = 1.9872041 / 1000.0 / AUKCAL # atomic units temperature = 298.15 if is_atom(): Ezpe = 0.0 Ethermal = 1.5 * Rgas * temperature # 3/2 * RT Hthermal = Ethermal + (Rgas * temperature) return False # run hessian on equilibrium geometry # ignore ZPE, calculate it from vibrations list try: zpe, vibs, intens = nwchem.task_freq("dft") except NWChemError, message: report("NWChem error: %s\n" % message) report("FAILED: Zero Point Energy calculation") return True
def E_zpe(self): """Run hessian on equilibrium geometry, get zero point energy. n Note: linear tri-atomics and larger give high ZPE values in NWChem @ HF/6-31G* """ self.say('ZPE.') AUKCAL = 627.5093314 c = 2.99792458E+10 h = 6.62606957E-27 kgas = 1.3806488E-16 # cgs units Rgas = 1.9872041/1000.0/AUKCAL # atomic units temperature = 298.15 if self.is_atom(): self.Ezpe = 0.0 self.Ethermal = 1.5 * Rgas * temperature # 3/2 * RT self.Hthermal = self.Ethermal + (Rgas * temperature) return False # run hessian on equilibrium geometry # ignore ZPE, calculate it from vibrations list zpe, vibs, intens = nwchem.task_freq("dft") # Handroll the ZPE because NWChem's zpe accumulates # truncation error from 3 sigfig physical constants. vibsum = 0.0 for freq in vibs: if (freq > 0.1): vibsum += freq cm2Ha = 219474.6 # cm-1 to Hartree conversion self.Ezpe = vibsum / (2.0 * cm2Ha) # shamelessly swipe code from NWCHEM/src/vib_wrtFreq.F eth = 0.0 hth = 0.0 xdum = 0.0 for freq in vibs: if (freq > 0.1): thetav = freq * (h * c / kgas) #freqency temperature in Kelvin from cm-1 if (temperature > 0.0): xdum = math.exp(-thetav/temperature) else: xdum = 0.0 xdum = xdum / (1.0 - xdum) eth = eth + thetav * (0.5 + xdum) eth = eth * Rgas # linear boolean is available only after task_freq('scf') runs # NWChem only writes the flag if molecule is linear try: is_linear = nwchem.rtdb_get("vib:linear") except: is_linear = False if (is_linear): # translational(3/2RT) and rotation(2/2RT) thermal corrections eth = eth + 2.5 * Rgas * temperature else: # translational(3/2RT) and rotation(3/2RT) thermal corrections eth = eth + 3.0 * Rgas * temperature # Hthermal = eth+pV=eth+RT, since pV=RT hth = eth + Rgas * temperature self.debug("Handrolled E,H thermal= %.6f, %.6f\n" % (eth,hth)) self.Ethermal = eth self.Hthermal = hth
def HF_zpe(): ''' run hessian on equilibrium geometry get zero point energy. n note: linear tri-atomics and larger give high ZPE values in NWChem @ HF/6-31G* ''' global Ezpe global Ethermal global Hthermal global AtomsList #AUKCAL = 627.5093314 # bogus AUKCAL = kCalPerHartree c = 2.99792458E+10 h = 6.62606957E-27 kgas = 1.3806488E-16 # cgs units Rgas = 1.9872041 / 1000.0 / AUKCAL # atomic units temperature = T298 say("zpe.") if is_atom(): Ezpe = 0.0 Ethermal = 1.5 * Rgas * temperature Hthermal = Ethermal + (Rgas * temperature) # Ethermal = 0.001416 # 3/2 * RT # Hthermal = 0.002360 # Ethermal + kT return False # run hessian on equilibrium geometry # ignore ZPE, calculate it from vibrations list zpe, vibs, intens = nwchem.task_freq("scf") # Handroll the ZPE because NWChem's zpe accumulates # truncation error from 3 sigfig physical constants. vibsum = 0.0 for freq in vibs: if (freq > 0.1): vibsum += freq cm2Ha = 219474.6 # cm-1 to Hartree conversion Ezpe = vibsum / (2.0 * cm2Ha) # get total thermal energy, enthalpy eth = nwchem.rtdb_get("vib:ethermal") hth = nwchem.rtdb_get("vib:hthermal") debug("NWChem zpe,E,H thermal= %.6f, %.6f, %.6f\n" % (Ezpe,eth, hth)) eth = 0.0 hth = 0.0 xdum = 0.0 for freq in vibs: if (freq > 0.1): # freqency temperature in Kelvin from cm-1 thetav = freq * (h * c / kgas) if (temperature > 0.0): xdum = math.exp(-thetav / temperature) else: xdum = 0.0 xdum = xdum / (1.0 - xdum) eth = eth + thetav * (0.5 + xdum) # linear boolean is available only after task_freq('scf') runs # NWChem only writes the flag if molecule is linear eth = eth * Rgas try: is_linear = nwchem.rtdb_get("vib:linear") except: is_linear = False if (is_linear and QCISDT_flag): # translational(3/2RT) and rotation(2/2RT) thermal corrections eth = eth + 2.5 * Rgas * temperature else: # translational(3/2RT) and rotation(3/2RT) thermal corrections eth = eth + 3.0 * Rgas * temperature # Hthermal = eth+pV=eth+RT, since pV=RT hth = eth + Rgas * temperature debug("RgasT= %.9f, kT_298_perMol= %.9f\n" % (Rgas * temperature, kT_298_perMol)) debug("Handrolled E,H thermal= %.6f, %.6f\n" % (eth, hth)) Ethermal = eth Hthermal = hth return False