Calculation of charge and potential difference