Calculate Madelung matrix (interactions of pt charges in 3-D periodic supercell). It is possible to choose between redoing the whole calculation and summing over those periodic images that had significant contributions last time by setting the logical variable redo_lattice.
number of atoms (input)
periodic supercell vectors (input)
periodic supercell vectors (input)
periodic supercell vectors (input)
atomic positions (input)
Madelung matrix (output)
if true, redo whole calculation, rather than just summing over periodic images that had significant contributions last time (input)