added a method to calculate the average volume and the total energy