Electrostatic potentials for surfaces of inorganic and molecular crystals