A quantum mechanical study of the phase stability and phase transition mechanisms in CaCO3 at finite temperature and pressure