We model the temperature and chemical structure of molecular clouds as a function of depth into the cloud , assuming a cloud of constant density n illuminated by an external FUV ( 6 eV < h \nu < 13.6 eV ) flux G _ { 0 } ( scaling factor in multiples of the local interstellar field ) . Extending previous photodissociation region models , we include the freezing of species , simple grain surface chemistry , and desorption ( including FUV photodesorption ) of ices . We also treat the opaque cloud interior with time-dependent chemistry . Here , under certain conditions , gas phase elemental oxygen freezes out as water ice and the elemental C/O abundance ratio can exceed unity , leading to complex carbon chemistry . Gas phase H _ { 2 } O and O _ { 2 } peak in abundance at intermediate depth into the cloud , roughly A _ { V } \sim 3 - 8 from the surface , the depth proportional to \ln ( G _ { 0 } / n ) . Closer to the surface , molecules are photodissociated . Deeper into the cloud , molecules freeze to grain surfaces . At intermediate depths photodissociation rates are attenuated by dust extinction , but photodesorption prevents total freezeout . For G _ { 0 } < 500 , abundances of H _ { 2 } O and O _ { 2 } peak at values \sim 10 ^ { -7 } , producing columns \sim 10 ^ { 15 } cm ^ { -2 } , independent of G _ { 0 } and n . The peak abundances depend primarily on the product of the photodesorption yield of water ice and the grain surface area per H nucleus . At higher values of G _ { 0 } , thermal desorption of O atoms from grains enhances the gas phase H _ { 2 } O peak abundance and column slightly , whereas the gas phase O _ { 2 } peak abundance rises to \sim 10 ^ { -5 } and the column to \sim 2 \times 10 ^ { 16 } cm ^ { -2 } . We present simple analytic equations for the abundances as a function of depth which clarify the dependence on parameters . The models are applied to observations of H _ { 2 } O , O _ { 2 } , and water ice in a number of sources , including B68 , NGC 2024 , and \rho Oph .