Ab Initio approach for atomic relaxation in supported magnetic clusters