The buildup of hydrogen ions inside the thylakoid space stores potential energy. This energy is harvested by an enzyme called ATP synthase. As hydrogen ions diffuse through the membrane, down their concentration gradient, ATP synthase uses the energy of the moving ions to make ATP. ATP and NADPH are used in the sugar-making process of the Calvin cycle.