Atomistic QM/MM simulations have been carried out on the complete photocycle of Photoactive Yellow Protein, a bacterial photoreceptor, in which blue light triggers isomerization of a covalently bound chromophore. The "chemical role" of the protein cavity in the control of the photoisomerization step has been elucidated. Isomerization is facilitated due to preferential electrostatic stabilization of the chromophore's excited state by the guanidium group of Arg52, located just above the negatively charged chromophore ring. In vacuo isomerization does not occur. Isomerization of the double bond is enhanced relative to isomerization of a single bond due to the steric interactions between the phenyl ring of the chromophore and the side chains of Arg52 and Phe62. In the isomerized configuration (ground-state cis), a proton transfer from Glu46 to the chromophore is far more probable than in the initial configuration (ground-state trans). It is this proton transfer that initiates the conformational changes within the protein, which are believed to lead to signaling.