Study of molecular rotations in solids and liquids by the inelastic scattering of cold neutrons