Ab initio studies on heterocyclic conjugated polymers: structure and vibrational spectra of thiophene, oligothiophenes and polythiophene