nrg.

nrg function (not yet adapted for extra mass due to weight)
Merge branch 'upstream/master'