  This study describes computer simulations of carbonization and graphite
formation, including the effects of hydrogen, nitrogen, oxygen, and sulfur. We
introduce a novel technique to simulate carbonization, "Simulation of Thermal
Emission of Atoms and Molecules (STEAM)," designed to elucidate the removal of
volatiles and density variations in carbonization residue. The investigation
extensively analyzes the functional groups that endure through high-temperature
carbonization and examines the graphitization processes in carbon-rich
materials containing non-carbon "impurity elements". The physical, vibrational,
and electronic attributes of impure amorphous graphite are analyzed, and the
impact of nitrogen on electronic conduction is investigated, revealing its
substitutional integration into the sp$^2$ layered network.
