code: def setup(self):
          
          def rename_file(afile):
              """Helper function to rename :class:`File` objects. Return string for logging purpose."""
              # Find the index of the last file (if any).
              # TODO: Maybe it's better to use run.abo --> run(1).abo
              fnames = [f for f in os.listdir(self.workdir) if f.startswith(afile.basename)]
              nums = [int(f) for f in [f.split("_")[-1] for f in fnames] if f.isdigit()]
              last = max(nums) if nums else 0
              new_path = afile.path + "_" + str(last+1)
  
              os.rename(afile.path, new_path)
              return "Will rename %s to %s" % (afile.path, new_path)
  
          logs = []
          if self.output_file.exists: logs.append(rename_file(self.output_file))
          if self.log_file.exists: logs.append(rename_file(self.log_file))
  
          if logs:
              self.history.info("\n".join(logs))
docs: Abinit has the very *bad* habit of changing the file extension by appending the characters in [A,B ..., Z]
          to the output file, and this breaks a lot of code that relies of the use of a unique file extension.
          Here we fix this issue by renaming run.abo to run.abo_[number] if the output file "run.abo" already
          exists. A few lines of code in python, a lot of problems if you try to implement this trick in Fortran90.