ulissigroup/finetuna

energy calculated by mlp vs quantum espresso has a huge difference

Closed this issue · 2 comments

tshrkg commented

Hello,

I run the quantum espresso example from 'examples/quantum_espresso/qe_gpu_online_al_example.py' (I have not changed anything from the example except the path to QE and psedopotential). After the calculation was complete when i plotted the energies from the predicted trajectory ('online_learner_trajectory.traj') i see that energies predicted by mlp is around -1 eV while energies predicted by QE is around -140000 eV. Is there something i am missing?. How do i get the correct energy values?

i have attached the predicted energy plot.

image

Hi,

By default the model doesn't train on the energy values, it only trains to improve its prediction on the forces since that is all that is needed for the second order optimizer to complete its relaxation.

We did this because we assume that people would only be interested in the starting and ending quantum espresso energies (which will always be queried by the parent calculator: quantum espresso). So the best way to plot this data is to plot only the parent energies. You can construct a trajectory of only the parent energies using the oal_queried_images.db file that gets generated, and selecting all the rows where check = True.

However, if you are interested in having the ML model also try to predict the energies accurately throughout the relaxation, you can turn on energy training in that example by setting the dictionary flag:
mlp_params={"tuner": {"energy_training": True}}

If you are keen on doing this, it would probably also help to subtract off the initial energy so that it is only plotting the difference That will help make this plot swing less wildly while it is still learning). You can do this by setting a reference energy to the starting point using this helper function, before you start the relaxation with the online learner.

Let me know if this makes sense.

tshrkg commented

Thanks a lot! That makes sense.