Check for NaN in factor function evalEnergy return value