Atomic model for grain boundary and surface diffusion