Ab initio molecular dynamics of thiophene: the interplay of internal conversion and intersystem crossing