def run(self, exe='monolithic'):
        """
        Make system call to run one or more of the stand-alone executables,
        writing a log file to the folder containing the input file.

        """

        if self.feffinp == None:
            raise Exception("no feff.inp file was specified")
        if not isfile(self.feffinp):
            raise Exception("feff.inp file '%s' could not be found" % self.feffinp)

        savefile = '.save_save_save.inp'
        here=os.getcwd()
        os.chdir(dirname(self.feffinp))
        log = 'f85e.log'

        if exe == None:
            exe = ''
        else:
            if not ((exe in ('monolithic', 'rdinp', 'pot', 'opconsat', 'xsph', 'pathfinder', 'genfmt', 'ff2x')) or exe.startswith('feff')):
                os.chdir(here)
                raise Exception("'%s' is not a valid executable name" % exe)

        ## default behavior is to step through the feff85exafs modules (but not opconsat, monolithic presumes that opconsat will not be used)
        if exe.startswith('mono'): # run modules recursively
            if isfile(log): os.unlink(log)
            for m in ('rdinp', 'pot', 'xsph', 'pathfinder', 'genfmt', 'ff2x'):
                os.chdir(here)
                self.run(m)
                if m == 'pot' and self.mpse:
                    self.run('opconsat')
            return
        elif exe.startswith('feff'):
            if isfile(log): os.unlink(log)

        ## if exe is unset or not set to something already recognized,
        ## try to figure out what executable to run
        ##
        ## the logic is:
        ##  1. if exe seems to be a feff version, try to find that Feff executable
        ##  2. if repo is None, try to find the installed feff85exafs executable
        ##  3. if repo is set, try to find the newly compiled feff85exafs executable
        ##  4. if nothing has yet been found, try to use _xafs._feff_executable
        ##  5. if nothing is found, raise an Exception
        program=None
        if exe.startswith('feff'): # step 1, exe seems to be numbered feff (e.g. feff6, feff7, ...)
            self.resolved = find_executable(exe)
            if self.resolved:
                program=self.resolved

        if exe in ('rdinp', 'pot', 'opconsat', 'xsph', 'pathfinder', 'genfmt', 'ff2x'):
            if self.repo == None: # step 2, try to find the installed feff85exafs module
                self.resolved = find_executable(exe)
                if not os.access(self.resolved, os.X_OK):
                    os.chdir(here)
                    raise Exception("'%s' is not an executable" % self.resolved)
                if self.resolved:
                    program=self.resolved
            else:                   # step 3, try to find the newly compiled feff85exafs module
                folder=exe.upper()
                if exe=='pathfinder':
                    folder='PATH'
                program=join(self.repo, 'src', folder, exe)
                self.resolved=program
                if not isfile(program):
                    os.chdir(here)
                    raise Exception("'%s' cannot be found (has it been compiled?)" % program)
                if not os.access(program, os.X_OK):
                    os.chdir(here)
                    raise Exception("'%s' is not an executable" % program)

        if program == None:  # step 4, try _xafs.feff_executable
            program = self._larch.symtable.get_symbol('_xafs._feff_executable')
            try:
                program = self._larch.symtable.get_symbol('_xafs._feff_executable')
            except __HOLE__:
                os.chdir(here)
                raise Exception("_xafs._feff_executable is not set (1)")
            except AttributeError:
                os.chdir(here)
                raise Exception("_xafs._feff_executable is not set (2)")

        if program != None:
            if not os.access(program, os.X_OK):
                program = None

        if program == None:  # step 5, give up
            os.chdir(here)
            raise Exception("'%s' executable cannot be found" % exe)

        ## preserve an existing feff.inp file if this is not called feff.inp
        if basename(self.feffinp) != 'feff.inp':
            if isfile('feff.inp'):
                copy('feff.inp', savefile)
                copy(basename(self.feffinp), 'feff.inp')

        f = open(log, 'a')
        header = "\n======= running module %s ====================================================\n" % exe
        if self.verbose: print(header)
        f.write(header)
        process=subprocess.Popen(program, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        flag = False
        thislist = []
        while True:
            line = process.stdout.readline()
            if not line:
                break
            if self.verbose: print( ':'+line.rstrip())
            ## snarf threshold energy
            pattern = re.compile('mu_(new|old)=\s+(-?\d\.\d+)')
            match = pattern.search(line)
            if match != None:
                self.threshold.append(match.group(2))
            ## snarf charge transfer
            if line.strip().startswith('Charge transfer'):
                thislist = []
                flag = True
            elif line.strip().startswith('SCF ITERATION'):
                self.chargetransfer.append(list(thislist))
                flag = False
            elif line.strip().startswith('Done with module 1'):
                self.chargetransfer.append(list(thislist))
                flag = False
            elif flag:
                this = line.split()
                thislist.append(this[1])
            f.write(line)
        f.close

        if isfile(savefile):
            move(savefile, 'feff.inp')
        os.chdir(here)
        return None

######################################################################
dataset/ETHPy150Open xraypy/xraylarch/plugins/xafs/feffrunner.py/FeffRunner.run