Added code for updateEnergy() method in ToricCode_1_q class