Understanding the molecular switching properties of octaphyrins.