isayevlab / AIMNet2

MIT License
96 stars 25 forks source link

ASE calculator using cached energy even after atomic positions change #30

Closed joshkamm closed 2 months ago

joshkamm commented 3 months ago

We have a workflow that uses an ASE calculator to explore a potential energy surface. When we swapped out the xTB ASE calculator that we were using to try the AIMNet2ASE calculator, we noticed that the calculator seemed to compute the energy correctly in the first invocation but then continue returning the same energy repeatedly even after updating the atomic positions. We dug around and it looks like AIMNet2ASE.set_atoms() is changing the atom positions but the cache doesn't get cleared so the next time the energy is requested it uses the value from the cache instead of recalculating at the new positions. We added a self.reset() call at the end of the AIMNet2ASE.do_reset() function. This at least superficially seems to resolve the issue such that the energy seems to be recalculated when the atomic positions change but use the cached value when called on the same atomic positions. Our workflow also seems to be operating as expected again. I'm not sure if this is a correct or general solution though.

zubatyuk commented 3 months ago

Hi Joshua. Thanks for reporting. Please can you provide two reproducible examples of different behavior for XTB and AIMNet2ASE calculators.

zubatyuk commented 3 months ago

Fixed.