Calculation of the Stevens factors alpha, beta and gamma in the intermediate coupling scheme for U and Np ions with f2,f3 and f4 configurations