code: def nelect(self):
          
          # if structure is not sorted this can cause problems, so must take
          # care to remove redundant symbols when counting electrons
          site_symbols = list(set(self.poscar.site_symbols))
          nelect = 0.
          for ps in self.potcar:
              if ps.element in site_symbols:
                  site_symbols.remove(ps.element)
                  nelect += self.structure.composition.element_composition[
                                ps.element] * ps.ZVAL
  
          if self.use_structure_charge:
              return nelect - self.structure.charge
          else:
              return nelect
docs: Gets the default number of electrons for a given structure.