Gold advances, energy declines on Iran deal hopes