A suite of one, two and three-dimensional models of the thermosphere and upper mesosphere have been used to make a theoretical and numerical study of the distribution of atomic oxygen and nitric oxide (NO), and their responses to varying solar and geomagnetic activity at equinox and solstice. The primary source of nitric oxide is from the reaction of excited atomic nitrogen, N( 2D), with molecular oxygen. The atomic nitrogen is created by a number of ion-neutral reactions and by direct dissociation of molecular nitrogen by photons, photo-electrons and auroral electrons. At mid and low latitudes, peak nitric oxide density occurs at 115 km as a direct consequence of ionisation and dissociation of molecular nitrogen by photoelectrons produced by the solar flux at wavelengths below 30.0 nm (XUV). Peak Nitric oxide densities at low latitudes near 115 km altitude are shown to vary by a factor of seven over the solar cycle, due to the estimated change in the solar XUV flux. This is in good agreement with the Solar Mesosphere Explorer (SME) satellite observations. The diurnal variation at the peak height is relatively small, since the production by solar XUV and loss by solar dissociation both have similar zenith angle dependencies. At higher altitudes, above 150 km, NO density varies by more than an order of magnitude during the day. The modelled latitudinal distributions of NO at equinox predicts an equatorial peak, which is contrary to the observations by SME. The geomagnetic source dominates at high latitudes, due to the ionisation and dissociation by auroral particles. For all but extremely quiet geomagnetic conditions, peak NO concentrations occur at high latitudes, where the density of NO often exceeds the low latitude values by more than an order of magnitude. At solstice, peak NO concentrations occur within both the summer and winter polar regions. At solstice, within the summer polar region, solar and auroral production adds constructively, while in the winter polar region, the peak in NO density is due to auroral production, in the absence of solar photo-dissociation of NO. Atomic oxygen is created by the dissociation of molecular oxygen, by the solar flux from a broad UV and EUV spectral range, and also by several neutral-neutral and ion-neutral chemical reactions. A strong seasonal/latitude variation in atomic oxygen density is created by transport of the species by the global circulation due to its long life-time in the thermosphere. Upwelling throughout the summer hemisphere depletes atomic oxygen densities, while the compensating downwelling in the winter hemisphere, particularly at middle and high latitudes, enhances the atomic oxygen concentration. Geomagnetic energy sources further modify the distribution of atomic oxygen by causing additional upwelling of the atmosphere in the polar regions, with associated horizontal advection of the species by the enhanced global circulation. Concentrations of atomic oxygen vary by more than a factor of five in the upper and lower thermosphere as viewed on a constant pressure surface. Significant seasonal and latitudinal changes occur as low as 90 km altitude.