Compound-tunable embedding potential (CTEP) method developed in [1,2] 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 YbF2 and YbF3 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 4fhole implicitly. At the next stage of the two-component embedded cluster studies of the YbF2,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.