Potential and pH distribution across a membrane with a surface layer of ionizable groups