def restart(self):
        """
        BSE calculations with Haydock can be restarted only if we have the
        excitonic Hamiltonian and the HAYDR_SAVE file.
        """
        # TODO: This version seems to work but the main output file is truncated
        # TODO: Handle restart if CG method is used
        # TODO: restart should receive a list of critical events
        # the log file is complete though.
        irdvars = {}

        # Move the BSE blocks to indata.
        # This is done only once at the end of the first run.
        # Successive restarts will use the BSR|BSC files in the indir directory
        # to initialize the excitonic Hamiltonian
        count = 0
        for ext in ("BSR", "BSC"):
            ofile = self.outdir.has_abiext(ext)
            if ofile:
                count += 1
                irdvars.update(irdvars_for_ext(ext))
                self.out_to_in(ofile)

        if not count:
            # outdir does not contain the BSR|BSC file.
            # This means that num_restart > 1 and the files should be in task.indir
            count = 0
            for ext in ("BSR", "BSC"):
                ifile = self.indir.has_abiext(ext)
                if ifile:
                    count += 1

            if not count:
                raise self.RestartError("%s: Cannot find BSR|BSC files in %s" % (self, self.indir))

        # Rename HAYDR_SAVE files
        count = 0
        for ext in ("HAYDR_SAVE", "HAYDC_SAVE"):
            ofile = self.outdir.has_abiext(ext)
            if ofile:
                count += 1
                irdvars.update(irdvars_for_ext(ext))
                self.out_to_in(ofile)

        if not count:
            raise self.RestartError("%s: Cannot find the HAYDR_SAVE file to restart from." % self)

        # Add the appropriate variable for restarting.
        self.set_vars(irdvars)

        # Now we can resubmit the job.
        #self.history.info("Will restart from %s", restart_file)
        return self._restart()
def restart ( self ) : irdvars = { } count = 0 for ext in ( "BSR" , "BSC" ) : ofile = self . outdir . has_abiext ( ext ) if ofile : count += 1 irdvars . update ( irdvars_for_ext ( ext ) ) self . out_to_in ( ofile ) if not count : count = 0 for ext in ( "BSR" , "BSC" ) : ifile = self . indir . has_abiext ( ext ) if ifile : count += 1 if not count : raise self . RestartError ( "%s: Cannot find BSR|BSC files in %s" % ( self , self . indir ) ) count = 0 for ext in ( "HAYDR_SAVE" , "HAYDC_SAVE" ) : ofile = self . outdir . has_abiext ( ext ) if ofile : count += 1 irdvars . update ( irdvars_for_ext ( ext ) ) self . out_to_in ( ofile ) if not count : raise self . RestartError ( "%s: Cannot find the HAYDR_SAVE file to restart from." % self ) self . set_vars ( irdvars ) return self . _restart ( )
BSE calculations with Haydock can be restarted only if we have the
        excitonic Hamiltonian and the HAYDR_SAVE file.