Sped up, NLOpt interface added

Now trying to track down a bug in energy.