docs: def run_reduce(input_file, path=True):
      """ Runs reduce on a pdb or mmol file at the specified path.
  
      Notes
      -----
      Runs Reduce programme to add missing protons to a PDB file.
  
      Parameters
      ----------
      input_file : str
          Path to file to add protons to or structure in mmol/pdb format.
      path : bool, optional
          True if input_file is a path.
  
      Returns
      -------
      reduce_mmol : str
          Structure file with protons added.
      reduce_message : str
          Messages generated while running Reduce.
  
      Raises
      ------
      FileNotFoundError
          Raised if the executable cannot be found.
      """
      if path:
          input_path = Path(input_file)
          if not input_path.exists():
              print('No file found at', path)
              return None, None
      else:
          pathf = tempfile.NamedTemporaryFile()
          encoded_input = input_file.encode()
          pathf.write(encoded_input)
          pathf.seek(0)
          file_path = pathf.name
          input_path = Path(file_path)
      reduce_folder = Path(global_settings['reduce']['folder'])
      reduce_exe = reduce_folder / global_settings['reduce']['path']
      reduce_dict = reduce_folder / 'reduce_wwPDB_het_dict.txt'
      try:
          reduce_output = subprocess.run(
              [str(reduce_exe), '-build', '-DB',
               str(reduce_dict), str(input_path)],
              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      except FileNotFoundError as e:
          raise FileNotFoundError(
              'The Reduce executable cannot be found. Ensure the '
              'location and filename are specified in settings.')
      try:
          reduced_mmol = reduce_output.stdout.decode()
      except UnicodeDecodeError:
          print("Reduce could not detect any missing protons in the protein. "
                "Using the original structure.")
          if path:
              reduced_mmol = input_path.read_text()
          else:
              reduced_mmol = input_file
      reduce_message = reduce_output.stderr.decode()
      if 'could not open' in reduce_message:
          print('Caution: the Reduce connectivity dictionary could not be '
                'found. Some protons may be missing. See notes.')
      return reduced_mmol, reduce_message