code: def write_file(self, molecule, inpfile):
          
  
          mol_blocks = []
          atom_block = AdfKey("Atoms", options=["cartesian"])
          for site in molecule:
              atom_block.add_subkey(AdfKey(str(site.specie), list(site.coords)))
          mol_blocks.append(atom_block)
  
          if molecule.charge != 0:
              netq = molecule.charge
              ab = molecule.spin_multiplicity - 1
              charge_block = AdfKey("Charge", [netq, ab])
              mol_blocks.append(charge_block)
              if ab != 0:
                  unres_block = AdfKey("Unrestricted")
                  mol_blocks.append(unres_block)
  
          with open(inpfile, "w+") as f:
              for block in mol_blocks:
                  f.write(str(block) + "\n")
              f.write(str(self.task) + "\n")
              f.write("END INPUT")
docs: Write an ADF input file.
  
          Parameters
          ----------
          molecule : Molecule
              The molecule for this task.
          inpfile : str
              The name where the input file will be saved.