Interaction between photosynthesis and respiration in facultative phototrophs