Physicochemical study of spiropyran-terthiophene derivatives: photochemistry and thermodynamics.