Towards an ab initio description of magnetism in ionic solids.