Calculation of the magnetic anisotropy energy in small clusters