code: def from_outcars_and_structures(cls, outcars, structures,
                                      calc_ionic_from_zval=False):
          
          p_elecs = []
          p_ions = []
  
          for i, o in enumerate(outcars):
              p_elecs.append(o.p_elec)
              if calc_ionic_from_zval:
                  p_ions.append(
                      get_total_ionic_dipole(structures[i], o.zval_dict))
              else:
                  p_ions.append(o.p_ion)
          return cls(p_elecs, p_ions, structures)
docs: Create Polarization object from list of Outcars and Structures in order
          of nonpolar to polar.
  
          Note, we recommend calculating the ionic dipole moment using calc_ionic
          than using the values in Outcar (see module comments). To do this set
          calc_ionic_from_zval = True