Modeling CO adsorption on Pt and Au monatomic chains and nanocontacts