예제 #1
0
    def calculate(self,
                  atoms=None,
                  properties=['energy'],
                  system_changes=all_changes):
        """Capture the RuntimeError from FileIOCalculator.calculate
        and add a little debug information from the Siesta output.

        See base FileIocalculator for documentation.
        """

        try:
            FileIOCalculator.calculate(
                self,
                atoms=atoms,
                properties=properties,
                system_changes=system_changes)

        # Here a test to check if the potential are in the right place!!!
        except RuntimeError as e:
            try:
                with open(self.label + '.out', 'r') as f:
                    lines = f.readlines()
                debug_lines = 10
                print('##### %d last lines of the Siesta output' % debug_lines)
                for line in lines[-20:]:
                    print(line.strip())
                print('##### end of siesta output')
                raise e
            except:
                raise e
예제 #2
0
파일: base_siesta.py 프로젝트: uu1477/MyAse
    def calculate(self,
                  atoms=None,
                  properties=['energy'],
                  system_changes=all_changes):
        """Capture the RuntimeError from FileIOCalculator.calculate
        and add a little debug information from the Siesta output.

        See base FileIocalculator for documentation.
        """

        try:
            FileIOCalculator.calculate(self,
                                       atoms=atoms,
                                       properties=properties,
                                       system_changes=system_changes)

        # Here a test to check if the potential are in the right place!!!
        except RuntimeError as e:
            try:
                with open(self.label + '.out', 'r') as f:
                    lines = f.readlines()
                debug_lines = 10
                print('##### %d last lines of the Siesta output' % debug_lines)
                for line in lines[-20:]:
                    print(line.strip())
                print('##### end of siesta output')
                raise e
            except:
                raise e
예제 #3
0
파일: orca.py 프로젝트: PHOTOX/fuase
    def calculate(self, atoms=None, properties=['energy'],
                  system_changes=all_changes):

        if 'forces' in properties:
            self.parameters.task = 'gradient'

        FileIOCalculator.calculate(self, atoms, properties, system_changes)
예제 #4
0
    def calculate(self,
                  atoms=None,
                  properties=['energy'],
                  system_changes=all_changes):

        if 'forces' in properties:
            self.parameters.task = 'gradient'

        FileIOCalculator.calculate(self, atoms, properties, system_changes)
예제 #5
0
파일: __init__.py 프로젝트: jochym/qe-util
 def run_calculation(self, atoms, properties, system_changes):
     '''
     Hook for the more involved remote calculator to link into.
     Actually invokes the parent calculation routine.
     '''
     # This is restarted calculation do not write anything.
     # Nothing to do - just return.
     if self.restart : return
     
     FileIOCalculator.calculate(self, atoms, properties, system_changes)
 def calculate(self, atoms=None, properties=['energy'], system_changes=all_changes):
     # Remove, if any the previous calculation file
     if os.path.exists("%s/%s.out" % (self.directory, self.label)):
         os.remove("%s/%s.out" % (self.directory, self.label))
     if os.path.exists("%s/TM-forces-1.xyz" % self.directory):
         os.remove("%s/TM-forces-1.xyz" % self.directory)
     if os.path.exists("%s/TM-stress-1.stress_tensor" % self.directory):
         os.remove("%s/TM-stress-1.stress_tensor" % self.directory)
     
     FileIOCalculator.calculate(self, atoms, properties, system_changes)
예제 #7
0
 def calculate(self, atoms, properties=['energy'], system_changes=[]):
     """ overrides parent calculate() method for testing reason
         should not be in prod. version """
     try:
         FileIOCalculator.calculate(self, atoms, properties, system_changes)
         #~ self.read_results()           # to test
         #~ self.results['energy'] = self.residual()  # to test
     except RuntimeError:
         print('ERROR: RuntimeError')
         self.results['energy'] = 999  # big value
예제 #8
0
 def calculate(self, *args, **kwargs):
     try:
         FileIOCalculator.calculate(self, *args, **kwargs)
     except:
         print('molpro error')
         i = 0
         while Path('molerror' + str(i) + '.out').exists():
             i += 1
             copyfile(self.label + '.out', 'molerror' + str(i) + '.out')
         os.remove(self.label + ".out")
         os.remove(self.label + ".xml")
예제 #9
0
    def calculate(self, *args, **kwargs):
        gaussians = ('g16', 'g09', 'g03')
        if 'GAUSSIAN' in self.command:
            for gau in gaussians:
                if which(gau):
                    self.command = self.command.replace('GAUSSIAN', gau)
                    break
            else:
                raise EnvironmentError(
                    'Missing Gaussian executable {}'.format(gaussians))

        FileIOCalculator.calculate(self, *args, **kwargs)
예제 #10
0
    def calculate(self, *args, **kwargs):
        if self.userscr is None:
            if 'rungms' in self.command:
                self.userscr = get_userscr(self.prefix, self.command)

        if self.userscr is None:
            warnings.warn("Could not determine USERSCR! "
                          "GAMESS may refuse to run more than once for "
                          "this job. Please pass userscr to the GAMESSUS "
                          "Calculator if you run into problems!")
        else:
            clean_userscr(self.userscr, self.prefix)

        FileIOCalculator.calculate(self, *args, **kwargs)
예제 #11
0
 def calculate(self, *args, **kwargs):
     gaussians = ('g16', 'g09', 'g03')
     if 'GAUSSIAN' in self.command:
         for gau in gaussians:
             if which(gau):
                 self.command = self.command.replace('GAUSSIAN', gau)
                 break
         else:
             #raise EnvironmentError('Missing Gaussian executable {}'
             #.format(gaussians))
             pass
     try:
         FileIOCalculator.calculate(self, *args, **kwargs)
     except:
         print('Gaussian error')
         i = 0
         while Path('gauserror' + str(i) + '.log').exists():
             i += 1
         copyfile(self.label + '.log', 'gauserror' + str(i) + '.log')
예제 #12
0
    def calculate(self,
                  atoms=None,
                  properties=['energy'],
                  system_changes=all_changes):
        """Capture the RuntimeError from FileIOCalculator.calculate
        and add a little debug information from the Siesta output.

        See base FileIocalculator for documentation.
        """

        FileIOCalculator.calculate(self,
                                   atoms=atoms,
                                   properties=properties,
                                   system_changes=system_changes)

        # The below snippet would run if calculate() failed but I have
        # disabled it for now since it looks to be just for debugging.
        # --askhl
        """
예제 #13
0
파일: gamess_us.py 프로젝트: PHOTOX/fuase
    def calculate(self, atoms=None, properties=['energy'],
                  system_changes=all_changes):

        if os.path.isfile(self.label + '.dat') and self.delold:
            os.remove('%s.dat' %self.label)
        if os.path.isfile(self.label + '.trj') and self.delold:
            os.remove('%s.trj' %self.label)
        if os.path.isfile(self.label + '.rst') and self.delold:
            os.remove('%s.rst' %self.label)
        if os.path.isfile(self.label + '.efp') and self.delold:
            os.remove('%s.efp' %self.label)

        if 'forces' in properties:
            self.parameters.task = 'gradient'

        if 'polarizability' in properties:
            self.parameters.task = 'ffield'
            #FUDO| Do we want to set some default parameters like:, I'll just do it for my sake right now
            self.parameters.raw += ' $scf conv=1.0d-7 fdiff=.false. $end\n $contrl icut=20 itol=30 $end\n'

        FileIOCalculator.calculate(self, atoms, properties, system_changes)
예제 #14
0
    def calculate(self,
                  atoms=None,
                  properties=['energy'],
                  system_changes=all_changes):

        if os.path.isfile(self.label + '.dat') and self.delold:
            os.remove('%s.dat' % self.label)
        if os.path.isfile(self.label + '.trj') and self.delold:
            os.remove('%s.trj' % self.label)
        if os.path.isfile(self.label + '.rst') and self.delold:
            os.remove('%s.rst' % self.label)
        if os.path.isfile(self.label + '.efp') and self.delold:
            os.remove('%s.efp' % self.label)

        if 'forces' in properties:
            self.parameters.task = 'gradient'

        if 'polarizability' in properties:
            self.parameters.task = 'ffield'
            #FUDO| Do we want to set some default parameters like:, I'll just do it for my sake right now
            self.parameters.raw += ' $scf conv=1.0d-7 fdiff=.false. $end\n $contrl icut=20 itol=30 $end\n'

        FileIOCalculator.calculate(self, atoms, properties, system_changes)