code: def read_avg_core_poten(self):
          
  
          def pairwise(iterable):
              "s -> (s0,s1), (s1,s2), (s2, s3), ..."
              a = iter(iterable)
              return zip(a, a)
  
          with zopen(self.filename, "rt") as foutcar:
              line = foutcar.readline()
              aps = []
              while line != "":
                  line = foutcar.readline()
                  if "the norm of the test charge is" in line:
                      ap = []
                      while line != "":
                          line = foutcar.readline()
                          # don't know number of lines to parse without knowing
                          # specific species, so stop parsing when we reach
                          # "E-fermi" instead
                          if "E-fermi" in line:
                              aps.append(ap)
                              break
                          data = line.split()
                          # the average core potentials of up to 5 elements are
                          # given per line
                          for i, pot in pairwise(data):
                              ap.append(float(pot))
          return aps
docs: Read the core potential at each ionic step.
  
          Returns:
              A list for each ionic step containing a list of the average core
              potentials for each atom: [[avg core pot]].
  
          Example:
              The average core potential of the 2nd atom of the structure at the
              last ionic step is: [-1][1]