Exemplo n.º 1
0
    def calculate(self, quantities=['energy'], keep_files=False):
        """ Run calculation """
        Calculator.write_input(self, self.qmconf)
        
        # set enviroment.
        os.environ['GAUSS_SCRDIR'] = os.path.abspath(self.calc_dir)
        #os.environ['GAUSS_EXEDIR'] = self.program_path # needed for g09.
        
        # Run calculation.
        self.write_input() # write input

        command = self.program_path + "/g16 " + self.label + '.com'
        
        os.chdir(self.calc_dir) # move to working dir
        output = os.popen(command).read() # run calculation
        os.chdir('..') # get out of working dir
        
        # extract results from quantities.  
        results = Calculator.read_results(self, self.qmconf, output, quantities)

        # write output if keep_files = True
        if keep_files:
            with open(self.label + ".out", 'w') as f:
                f.write(output)

        self.clean(keep_files)

        return results
Exemplo n.º 2
0
    def calculate(self, quantities=['energy'], keep_files=False):
        """Run xTB calculation and return dict of results"""
        Calculator.write_input(self, self.qmconf)

        self.write_input() # write input file

        command = self.input_cmd() # command to run xTB
        
        os.chdir(self.calc_dir) # move into working dir.
        output = os.popen(command).read() # run calculation.
        os.chdir('..') # get out of working dir.
        
        # extract results from quantities.
        results = Calculator.read_results(self, self.qmconf, output, quantities)

        if keep_files:
            with open(self.label + ".out", 'w') as f:
                f.write(output)

        self.clean(keep_files)

        return results
Exemplo n.º 3
0
    def calculate(self, quantities=['energy'], keep_files=False):
        """ Run calculation """
        Calculator.write_input(self, self.qmconf)

        self.write_input()  # write input

        command = self.program_path + " " + self.label + '.inp' + ' 2>' + self.scr_dir + '/' + self.label + '.log'

        os.chdir(self.calc_dir)  # create working dir
        output = os.popen(command).read()  # run calculation
        os.chdir('..')  # get out of working dir

        # extract results from quantities.
        results = Calculator.read_results(self, self.qmconf, output,
                                          quantities)

        if keep_files:
            with open(self.label + ".out", 'w') as f:
                f.write(output)

        self.clean(keep_files)

        return results