Hi Chandra,
I apologise for any confusion.
I mean that the parameter "my_energy" continues changing at each step in the displayed *DO loop. However, it retains the value of the last step of the SENE energy. I need the parameter "my_energy" to hold the maximum value over *DO loop steps.
In other words, assuming the values of "my_energy" at the five steps you provided are 1.1, 1.2, 1.3, 1.1, and 0.9, respectively, the final value of "my_energy" in the supplied code should be 0.9. I require the maximum value, which is "1.3" I hope that makes sense.