code: def _write_pair_information(gsd_file, structure):
      
      pair_types = []
      pair_typeid = []
      pairs = []
      for ai in structure.atoms:
          for aj in ai.dihedral_partners:
              #make sure we don't double add
              if ai.idx > aj.idx:
                  ps = '-'.join(sorted([ai.type, aj.type], key=natural_sort))
                  if ps not in pair_types:
                      pair_types.append(ps)
                  pair_typeid.append(pair_types.index(ps))
                  pairs.append((ai.idx, aj.idx))
      gsd_file.pairs.types = pair_types
      gsd_file.pairs.typeid = pair_typeid
      gsd_file.pairs.group = pairs
      gsd_file.pairs.N = len(pairs)
docs: Write the special pairs in the system.
  
          Parameters
      ----------
      gsd_file :
          The file object of the GSD file being written
      structure : parmed.Structure
          Parmed structure object holding system information