Phase diagram of ferroelectric BaTiO3 ultrathin films under open-circuit conditions