Beispiel #1
0
    def loadScanEnergies(self):
        """
        Extract the optimized energies in J/mol from a Qchem log file, e.g. the 
        result of a Qchem "PES Scan" quantum chemistry calculation.
        """
        Vlist = []
        angle = []
        f = open(self.path, 'r')
        line = f.readline()
        while line != '':
            if 'Summary of potential scan:' in line:
                line = f.readline()
                print 'found a sucessfully completed Qchem Job'
                while '-----------------' not in line:
                    #            print len(line.split())
                    #            Vlist.append(float(line.split()[1]))
                    values = [float(item) for item in line.split()]
                    angle.append(values[0])
                    Vlist.append(values[1])
                    # Read the next line in the file
                    line = f.readline()
            line = f.readline()
            if 'SCF failed to converge' in line:
                print 'Qchem Job did not sucessfully complete: SCF failed to converge'
                break
        # Close file when finished
        print '   Assuming', os.path.basename(
            self.path), 'is the output from a Qchem PES scan...'
        f.close()

        Vlist = numpy.array(Vlist, numpy.float64)
        # check to see if the scanlog indicates that one of your reacting species may not be the lowest energy conformer
        checkConformerEnergy(Vlist, self.path)

        # Adjust energies to be relative to minimum energy conformer
        # Also convert units from Hartree/particle to J/mol
        Vlist -= numpy.min(Vlist)
        Vlist *= constants.E_h * constants.Na
        angle = numpy.arange(0.0, 2 * math.pi + 0.00001,
                             2 * math.pi / (len(Vlist) - 1), numpy.float64)
        return Vlist, angle
Beispiel #2
0
    def loadScanEnergies(self):
        """
        Extract the optimized energies in J/mol from a Qchem log file, e.g. the 
        result of a Qchem "PES Scan" quantum chemistry calculation.
        """
        Vlist = []
        angle = []
        f = open(self.path, 'r')
        line = f.readline()
        while line != '':
            if 'Summary of potential scan:' in line:
                line = f.readline()
                print 'found a sucessfully completed Qchem Job'
                while '-----------------' not in line:
        #            print len(line.split())
        #            Vlist.append(float(line.split()[1]))
                    values = [float(item) for item in line.split()]
                    angle.append(values[0])
                    Vlist.append(values[1])
            # Read the next line in the file
                    line = f.readline()
            line = f.readline()
            if 'SCF failed to converge' in line:
                print 'Qchem Job did not sucessfully complete: SCF failed to converge'
                break
        # Close file when finished   
        print '   Assuming', os.path.basename(self.path), 'is the output from a Qchem PES scan...'
        f.close()  
                    

        Vlist = numpy.array(Vlist, numpy.float64)
        # check to see if the scanlog indicates that one of your reacting species may not be the lowest energy conformer
        checkConformerEnergy(Vlist, self.path)
        
        # Adjust energies to be relative to minimum energy conformer
        # Also convert units from Hartree/particle to J/mol
        Vlist -= numpy.min(Vlist)
        Vlist *= constants.E_h * constants.Na      
        angle = numpy.arange(0.0, 2*math.pi+0.00001, 2*math.pi/(len(Vlist)-1), numpy.float64)
        return Vlist, angle
Beispiel #3
0
    def loadScanEnergies(self):
        """
        Extract the optimized energies in J/mol from a log file, e.g. the 
        result of a Gaussian "Scan" quantum chemistry calculation.
        """

        optfreq = False
        rigidScan = False

        # The array of potentials at each scan angle
        Vlist = []

        # Parse the Gaussian log file, extracting the energies of each
        # optimized conformer in the scan
        f = open(self.path, 'r')
        line = f.readline()
        while line != '':
            # If the job contains a "freq" then we want to ignore the last energy
            if ' freq ' in line:
                optfreq = True
            #if # scan is keyword instead of # opt, then this is a rigid scan job
            #and parsing the energies is done a little differently
            if '# scan' in line:
                rigidScan = True
            # The lines containing "SCF Done" give the energy at each
            # iteration (even the intermediate ones)
            if 'SCF Done:' in line:
                E = float(line.split()[4])
                #rigid scans will only not optimize, so just append every time it finds an energy.
                if rigidScan:
                    Vlist.append(E)
            # We want to keep the values of E that come most recently before
            # the line containing "Optimization completed", since it refers
            # to the optimized geometry
            if 'Optimization completed' in line:
                Vlist.append(E)
            line = f.readline()
        # Close file when finished
        f.close()

        #give warning in case this assumption is not true
        if rigidScan == True:
            print '   Assuming', os.path.basename(
                self.path), 'is the output from a rigid scan...'

        Vlist = numpy.array(Vlist, numpy.float64)
        # check to see if the scanlog indicates that a one of your reacting species may not be the lowest energy conformer
        checkConformerEnergy(Vlist, self.path)

        # Adjust energies to be relative to minimum energy conformer
        # Also convert units from Hartree/particle to kJ/mol
        Vlist -= numpy.min(Vlist)
        Vlist *= constants.E_h * constants.Na

        if optfreq: Vlist = Vlist[:-1]

        # Determine the set of dihedral angles corresponding to the loaded energies
        # This assumes that you start at 0.0, finish at 360.0, and take
        # constant step sizes in between
        angle = numpy.arange(0.0, 2 * math.pi + 0.00001,
                             2 * math.pi / (len(Vlist) - 1), numpy.float64)

        return Vlist, angle
Beispiel #4
0
    def loadScanEnergies(self):
        """
        Extract the optimized energies in J/mol from a log file, e.g. the 
        result of a Gaussian "Scan" quantum chemistry calculation.
        """

        optfreq = False
        rigidScan=False

        # The array of potentials at each scan angle
        Vlist = []

        # Parse the Gaussian log file, extracting the energies of each
        # optimized conformer in the scan
        f = open(self.path, 'r')
        line = f.readline()
        while line != '':
            # If the job contains a "freq" then we want to ignore the last energy
            if ' freq ' in line:
                optfreq = True
            #if # scan is keyword instead of # opt, then this is a rigid scan job
            #and parsing the energies is done a little differently
            if '# scan' in line:
                rigidScan=True
            # The lines containing "SCF Done" give the energy at each
            # iteration (even the intermediate ones)
            if 'SCF Done:' in line:
                E = float(line.split()[4])
                #rigid scans will only not optimize, so just append every time it finds an energy.
                if rigidScan:
                    Vlist.append(E)
            # We want to keep the values of E that come most recently before
            # the line containing "Optimization completed", since it refers
            # to the optimized geometry
            if 'Optimization completed' in line:
                Vlist.append(E)
            line = f.readline()
        # Close file when finished
        f.close()
        
        #give warning in case this assumption is not true
        if rigidScan==True:
            print '   Assuming', os.path.basename(self.path), 'is the output from a rigid scan...'
        
        Vlist = numpy.array(Vlist, numpy.float64)
        # check to see if the scanlog indicates that a one of your reacting species may not be the lowest energy conformer
        checkConformerEnergy(Vlist, self.path)
        
        # Adjust energies to be relative to minimum energy conformer
        # Also convert units from Hartree/particle to kJ/mol
        Vlist -= numpy.min(Vlist)
        Vlist *= constants.E_h * constants.Na

        if optfreq: Vlist = Vlist[:-1]

        # Determine the set of dihedral angles corresponding to the loaded energies
        # This assumes that you start at 0.0, finish at 360.0, and take
        # constant step sizes in between
        angle = numpy.arange(0.0, 2*math.pi+0.00001, 2*math.pi/(len(Vlist)-1), numpy.float64)

        return Vlist, angle