added chgcheck code to make sure charge is conserved