An Algorithm Predicting the Optimal Mechanical Response of Electronic Energy Difference