Energy in a Molecular Dynamics simulation

I want to do a molecular dynamics simulation for 1000 water molecules. I wish to calculate the total energy of the system at each timestep. What is the best method to do this?