The calculation of magnetic anisotropy constants is performed beyond t
he point-charge model for a continuous charge-density distribution of
screening conduction electrons. An important role of the nonuniform el
ectron density, in particular, of the Friedel oscillations, in the for
mation of crystal field is demonstrated. Such effects can modify stron
gly the effective ion (impurity) charge and even change its sign. This
enables one to justify the anion model, which is often used for discu
ssing experimental data on hydrogen-containing systems. Possible appli
cations to the pure rare-earth metals and RCo5 (R=rare earth) compound
s are discussed. The deformation of magnetic structure near the inters
titial positive muon owing to the strong local anisotropy, and the cor
responding contribution to the dipole field at the muon are considered
.