code: def _write_input(self, input_dir="."):
          
          with open(os.path.join(input_dir, self.input_file), 'wt', encoding="utf-8") as inp:
              for k, v in self.control_params.items():
                  inp.write('{} {}\n'.format(k, self._format_param_val(v)))
              # write the structures of the constituent molecules to file and set
              # the molecule id and the corresponding filename in the packmol
              # input file.
              for idx, mol in enumerate(self.mols):
                  filename = os.path.join(
                      input_dir, '{}.{}'.format(
                          idx, self.control_params["filetype"])).encode("ascii")
                  # pdb
                  if self.control_params["filetype"] == "pdb":
                      self.write_pdb(mol, filename, num=idx+1)
                  # all other filetypes
                  else:
                      a = BabelMolAdaptor(mol)
                      pm = pb.Molecule(a.openbabel_mol)
                      pm.write(self.control_params["filetype"], filename=filename,
                               overwrite=True)
  
                  inp.write("\n")
                  inp.write(
                      "structure {}.{}\n".format(
                          os.path.join(input_dir, str(idx)),
                          self.control_params["filetype"]))
                  for k, v in self.param_list[idx].items():
                      inp.write('  {} {}\n'.format(k, self._format_param_val(v)))
                  inp.write('end structure\n')
docs: Write the packmol input file to the input directory.
  
          Args:
              input_dir (string): path to the input directory