Energy is released from ATP when