code: def max_cation_removal(self):
          
  
          # how much 'spare charge' is left in the redox metals for oxidation?
          oxid_pot = sum(
              [(Element(spec.symbol).max_oxidation_state - spec.oxi_state) * self.comp[spec] for spec
               in self.comp if is_redox_active_intercalation(Element(spec.symbol))])
  
          oxid_limit = oxid_pot / self.cation_charge
  
          #the number of A that exist in the structure for removal
          num_cation = self.comp[Specie(self.cation.symbol, self.cation_charge)]
  
          return min(oxid_limit, num_cation)
docs: Maximum number of cation A that can be removed while maintaining charge-balance.
  
          Returns:
              integer amount of cation. Depends on cell size (this is an 'extrinsic' function!)