Constraints on the composition of the Earth's core from ab initio calculations