Infrared spectroscopy in the gas and liquid phase from first principle molecular dynamics simulations: application to small peptides