Controllable multiple-step configuration transformations in a thermal/photoinduced reaction