  The inclusion of molecular physics is an important piece that tends to be
missing from the puzzle when modeling the spectra of supernovae (SNe).
Molecules have both a direct impact on the spectra, particularly in the
infrared, and an indirect one as a result of their influence on certain
physical conditions, such as temperature. In this paper, we aim to investigate
molecular formation and non-local thermodynamic equilibrium (NLTE) cooling,
with a particular focus on CO, the most commonly detected molecule in
supernovae. We also aim to determine the dependency of supernova chemistry on
physical parameters and the relative sensitivity to rate uncertainties. We
implemented a chemical kinetic description of the destruction and formation of
molecules into the SN spectral synthesis code SUMO. In addition, selected
molecules were coupled into the full NLTE level population framework and, thus,
we incorporated molecular NLTE cooling into the temperature equation. We
produced a test model of the CO formation in SN 1987A between 150 and 600 days
and investigated the sensitivity of the resulting molecular masses to the input
parameters. We find that there is a close inter-dependency between the thermal
evolution and the amount of CO formed, mainly through an important
temperature-sensitive CO destruction process with O+. After a few hundred days,
CO completely dominates the cooling of the oxygen-carbon zone of the supernova
which, therefore, contributes little optical emission. The uncertainty of the
calculated CO mass scales approximately linearly with the typical uncertainty
factor for individual rates. We demonstrate how molecular masses can
potentially be used to constrain various physical parameters of the supernova.
