code: def automatic_gamma_density(structure, kppa):
          
  
          latt = structure.lattice
          lengths = latt.abc
          ngrid = kppa / structure.num_sites
  
          mult = (ngrid * lengths[0] * lengths[1] * lengths[2]) ** (1 / 3)
          num_div = [int(round(mult / l)) for l in lengths]
  
          # ensure that numDiv[i] > 0
          num_div = [i if i > 0 else 1 for i in num_div]
  
          # VASP documentation recommends to use even grids for n <= 8 and odd
          # grids for n > 8.
          num_div = [i + i % 2 if i <= 8 else i - i % 2 + 1 for i in num_div]
  
          style = Kpoints.supported_modes.Gamma
  
          comment = "pymatgen 4.7.6+ generated KPOINTS with grid density = " + \
                    "{} / atom".format(kppa)
          num_kpts = 0
          return Kpoints(comment, num_kpts, style, [num_div], [0, 0, 0])
docs: Returns an automatic Kpoint object based on a structure and a kpoint
          density. Uses Gamma centered meshes always. For GW.
  
          Algorithm:
              Uses a simple approach scaling the number of divisions along each
              reciprocal lattice vector proportional to its length.
  
          Args:
              structure:
                  Input structure
              kppa:
                  Grid density