Added new lib function v_energy