Added thermal ensemble code