The Gibbs free energy (or Gibbs energy) is an equation of state and represents spontaneity of reaction at constant pressure and temperature. 
The change of the Gibbs free energy by temperature is about kBT per degree of freedom (DOF), and it is approximately 25 meV at room temperature. However, the energy of a chemical reaction is hundreds of meV to several eV, so the internal energy is dominated for the change of the Gibbs free energy by chemical reaction. In DFT, we can get the internal energy of the ground state, which can consider 0 K as the system’s temperature. Therefore, we can calculate the change of the Gibbs free energy using the difference of the internal energy for the solid system in DFT. 
Given this, the formation energy can use as a scale for thermodynamical stability because the formation energy can describe the amount of energy that comes in or out when a chemical reaction occurs. In this weekly tip, we will find out the thermodynamical stability of several solid materials by calculating the formation energy.
1. Calculation of Formation Energy
Formation Energy can get using the following equation.
In this example, we will determine the direction of the reaction by obtaining the formation energy for Silicon dioxide (quartz), Zinc oxide, Silicon carbide, and Diamond. The formation reaction for SiO2 is as follows.
In the standard state, Si is solid-state, while Oxygen exists as O2 molecule. The two chemical species react and create a solid SiO2 product. Given this, we should model the Si unit cell and O2 molecule according to the state, thus acquiring their energy. The formation energy can also calculate this way for other materials.
For SiO2, ZnO, and SiC, Diamond, their formation energies are calculated as follows.
Results show that the formation energy has a negative value, and the product has more stable energy than the reactant. Given this, the reaction will progress in the direction of the forward reaction. Therefore, in this case, solid Si or Zn and oxygen gas will react spontaneously and produce SiO2 or ZnO solid in the standard state.
For the case of the Diamond, however, which has a positive formation energy value, the reaction in which graphite converts into a Diamond will not occur spontaneously in the standard state and will interpret, requiring external factors such as pressure and temperature.
2. Error of Formation Energy for Oxides
In this example, SiO2 and ZnO contain some errors compared to the experimental results. In most cases, this formation energy error of oxidant occurs because of the bond energy error of O2.  The GGA type pseudopotential, which is used in this example, tends to describe the double-bond more strongly, thus calculating the energy of O2 too low. However, the results above did not consider the factor, thus causing some errors.
There are several methods to avoid this issue. The simplest way is to obtain the energy of the O2 molecule using the experimental result.
When using the Bond Energy as 5.23 eV , the formation energy of the oxidants is as follows.
The formation enthalpy of SiO2 was computed around -9.11 eV ; the formation energy, 9.82 eV ; the formation enthalpy of SiO2, around -3.50 ± 0.27 eV ; and the formation energy, 3.59 eV . The error was successfully corrected by comparing it with the results above.
In this weekly tip, we have discovered the thermodynamical stability of the product using the formation energy by calculating the change of the energy. Through its sign and size, formation energy can determine the reactions occurring in which direction, or how the product is stable thermodynamically. Therefore, the formation energy is used importantly to predict the progress of the chemical reaction.
Predict the direction of the chemical reaction using Materials Square!
 Brown, T. L. (2009). Chemistry: the central science. Pearson Education.
 Hautier, G., Ong, S. P., Jain, A., Moore, C. J., & Ceder, G. (2012). Accuracy of density functional theory in predicting formation energies of ternary oxides from binary oxides and its implication on phase stability. Physical Review B, 85(15), 155208.
 Jain, A., Hautier, G., Ong, S. P., Moore, C. J., Fischer, C. C., Persson, K. A., & Ceder, G. (2011). Formation enthalpies by mixing GGA and GGA+ U calculations. Physical Review B, 84(4), 045115.
 Pople, J. A., Head‐Gordon, M., Fox, D. J., Raghavachari, K., & Curtiss, L. A. (1989). Gaussian‐1 theory: A general procedure for prediction of molecular energies. The Journal of Chemical Physics, 90(10), 5622-5629.
 Chase, M. W., Davies, C. A., Downey, J. R., Frurip, D. J., & McDonald, R. A. (1998). J. Phys. Chem. Ref. Data. JANAF Thermochemical Tables, 4.; https://webbook.nist.gov/cgi/cbook.cgi?ID=C14808607&Units=SI&Mask=2#Thermo-Condensed
 Cox, J. D., Wagman, D. D., & Medvedev, V. A. (1984). CODATA Key Values for Thermodynamics, 1 New York.; https://webbook.nist.gov/cgi/cbook.cgi?ID=C1314132&Units=SI&Mask=2#Thermo-Condensed