Photofunctional processes and materials based on molecular switches