Thermodynamic description of graphitizable carbons and the irreversible graphitization process