Phase transitions in BaTiO3 from first principles.