Merge pull request #49 from lawinslow/master

merged internal.energy and ts.internal.energy functions
First stab at #32