Large anomalies due to insufficiency of Madelung embedding in ab initio calculations of 4f-5d and 4f-6s excitations of lanthanides in ionic crystals: the BaF2:Ce3+ crystal