Wavefunctions derived from experiment. IV. Investigation of the crystal environment of ammonia.