We present a technique to treat systems with very many levels, such as mole
cules, in non-LTE. This method is based on a superlevel formalism coupled w
ith rate operator splitting. Superlevels consist of many individual levels
that are assumed to be in LTE relative to each other. The usage of superlev
els reduces the dimensionality of the rate equations dramatically and, ther
eby, makes the problem computationally more easily treatable. Our superleve
l formalism retains maximum accuracy by using direct opacity sampling (dOS)
when calculating the radiative transitions and the opacities. We developed
this method in order to treat molecules in cool dwarf model calculations i
n non-LTE. Cool dwarfs have low electron densities and radiation fields tha
t are far from blackbody radiation fields; both properties may disqualify t
hem from the common LTE approximation. Therefore, the most important opacit
y sources, the molecules, need to be treated in non-LTE. As a case study we
applied our method to carbon monoxide. We find that our method gives accur
ate results since the conditions for the superlevel method are very well me
t for molecules. Because of very high collisional cross sections with hydro
gen and the high densities of H-2, the population of CO itself shows no sig
nificant deviation from LTE.