Use python to calculate the madelung constant