Effect of vibration on the linear and nonlinear optical properties of HF and (HF)2