fixed energy computation
Tried parallelization. Yielded very poor results.