  Compound-tunable embedding potential (CTEP) method developed in previous
works to describe electronic structure of fragments in materials is applied to
crystals containing periodically arranged lanthanide atoms, which can have open
$4f$ shell. We consider YbF$_2$ and YbF$_3$ as examples such that $4f$ shell is
excluded from both the crystal and cluster stages of generating the CTEP.
Instead, 10 and 11 valence-electron pseudopotentials for Yb, correspondingly,
are applied and the latter treats the $4f$-hole implicitly. At the next stage
of the two-component embedded cluster studies of the YbF$_{2,3}$ crystals we
apply the 42 valence-electron relativistic pseudopotential for Yb and, thus,
$4f$ shell is treated explicitly. A remarkable agreement of the electronic
density and interatomic distances within the fragment with those of the
original periodic crystal calculation is attained.
