def characteriseTSExt(self, mol, low, path, QTS3): os.chdir((self.workingDir)) # Higher level optimisation via some external program if low: print("looking for TS at lower level") mol = tl.setCalc(mol, self.lowString, self.lowMeth + 'TS', self.lowLev) else: mol = tl.setCalc(mol, self.highString, self.highMeth + 'TS', self.highLev) try: mol.get_forces() except: pass if not low and self.highMeth == "gauss": mol, imaginaryFreq, TSFreqs, zpe, rmol, pmol = tl.getGausTSOut( self.workingDir + '/Raw/calcHigh' + self.procNum, path, self.highLev, self.CombReac, self.CombProd, mol, self.is_bimol_reac, QTS3) os.chdir((self.workingDir)) else: print("getting TS geom") if low: mol = tl.getOptGeom( self.workingDir + '/Raw/' + 'calcLow' + self.procNum + '/', 'none', self.Reac, self.lowMeth) else: mol = tl.getOptGeom( self.workingDir + '/Raw/' + 'calcLow' + self.procNum + '/', 'none', self.Reac, self.lowMeth) # Then calculate frequencies os.chdir((self.workingDir + '/Raw/' + self.procNum)) print("getting TS freqs") if low: mol = tl.setCalc(mol, self.lowString, self.lowMeth + 'Freq', self.lowLev) else: mol = tl.setCalc(mol, self.highString, self.highMeth + 'Freq', self.highLev) try: mol.get_forces() except: pass print("reading TS freqs") if low: try: imaginaryFreq, TSFreqs, zpe, rmol, pmol = tl.getTSFreqs( self.workingDir + '/Raw/' + self.procNum + '/Raw/calcLow' + self.procNum, path + '/TSPreDirectImag', self.lowMeth, self.TS) except: os.chdir((self.workingDir)) else: try: imaginaryFreq, TSFreqs, zpe, rmol, pmol = tl.getTSFreqs( self.workingDir + '/Raw/' + self.procNum + '/Raw/calcHigh' + self.procNum, path + '/TSDirectImag', self.highMeth, self.TS) except: os.chdir((self.workingDir)) os.chdir((self.workingDir)) # Finally get single point energy mol = tl.setCalc(mol, self.singleString, self.singleMeth, self.singleLev) print("Getting single point energy for reaction" + str(self.ReacName) + "_" + str(self.ProdName) + " TS = " + str(mol.get_potential_energy()) + "zpe = " + str(zpe) + "reactant energy = " + str(self.reactantEnergy)) energy = mol.get_potential_energy() + zpe return TSFreqs, imaginaryFreq, zpe, energy, mol, rmol, pmol
def characteriseMinExt(self, mol, high): # Low level optimisation with BFGS os.chdir((self.workingDir)) mol = tl.setCalc(mol, self.lowString, self.lowMeth, self.lowLev) min = BFGS(mol) try: min.run(fmax=0.1, steps=100) except: min.run(fmax=0.1, steps=100) if high: if self.highMeth == "gauss": mol, freqs, zpe = tl.getGausOut( self.workingDir + '/Raw/calcHigh' + self.procNum, self.highLev, mol) os.chdir((self.workingDir)) else: # Higher level optimisation via some external program mol = tl.setCalc(mol, self.highString, self.highMeth + 'Opt', self.highLev) try: mol.get_forces() except: pass mol = tl.getOptGeom( self.workingDir + '/' + 'Raw/calcHigh' + self.procNum + '/', 'none', self.Reac, self.highMeth) # Then calculate frequencies os.chdir((self.workingDir + '/Raw/' + self.procNum)) mol = tl.setCalc(mol, self.highString, self.highMeth + 'Freq', self.highLev) try: mol.get_forces() except: pass freqs, zpe = self.characteriseFreqInternal(mol) os.chdir((self.workingDir)) else: if self.lowMeth == "gauss": mol, freqs, zpe = tl.getGausOut( self.workingDir + '/Raw/calcLow' + self.procNum, self.lowLev, mol) os.chdir((self.workingDir)) else: # Higher level optimisation via some external program mol = tl.setCalc(mol, self.lowString, self.lowMeth + 'Opt', self.lowLev) try: mol.get_forces() except: pass mol = tl.getOptGeom( self.workingDir + '/Raw/' + 'calcLow' + self.procNum + '/', 'none', self.Reac, self.lowMeth) # Then calculate frequencies os.chdir((self.workingDir + '/Raw/' + self.procNum)) mol = tl.setCalc(mol, self.lowString, self.lowMeth + 'Freq', self.lowLev) try: mol.get_forces() except: pass freqs, zpe = tl.getFreqs(mol) os.chdir((self.workingDir)) # Finally get single point energy mol = tl.setCalc(mol, self.singleString, self.singleMeth, self.singleLev) energy = mol.get_potential_energy() + zpe return freqs, energy, mol