Although it is known that the nonlinear Schrödinger equation describes the propagation of light in selffocusing media, the quantization conditions that emerge from its corresponding semiclassical version have not been sufficiently appreciated. For the propagation of an optical pulse in a Kerr-effect microcavity, we find that the transverse energy, intensity, number of particles, and frequency detuning are not arbitrary but are interrelated by quantization conditions. We identify the binding energy of the collective bound state of particles with the energy loss of the pulse and indicate how the energy distribution of photons can be studied from the point of view of a master-equation approach to a heat reservoir interacting with the photons.