Setting `dispersion=True` in the MACE-MP-0 foundation model omits data from `calc.results`
Andrew-S-Rosen opened this issue · comments
Describe the bug
When dispersion=True
is set in the mace_mp
calculator, important properties in the calculator results dictionary are omitted when called via atoms.get_potential_energy()
.
To Reproduce
First, let's see what happens when dispersion=False
(i.e. the default).
from mace.calculators.foundations_models import mace_mp
atoms = bulk("Cu")
atoms.calc = mace_mp()
atoms.get_potential_energy()
print(atoms.calc.results.keys())
This outputs:
dict_keys(['energy', 'free_energy', 'node_energy', 'forces', 'stress'])
Now let's see what happens when dispersion=True
:
from mace.calculators.foundations_models import mace_mp
atoms = bulk("Cu")
atoms.calc = mace_mp(dispersion=True)
atoms.get_potential_energy()
print(atoms.calc.results.keys())
This outputs:
dict_keys(['energy_contributions', 'energy'])
Sadly, several properties are omitted, most crucially the forces but also other properties as well. Is there a reason for this inconsistent behavior? At the very least, I would expect the same behavior regardless of whether dispersion
is set or not. I understand the user can do atoms.get_forces()
, but that is a separate calculation and does not resolve the aforementioned inconsistency. Since the data is available, it should be reported with atoms.get_potential_energy()
as well, as this is the canonical way to generically run a calculation right now.
Expected behavior
The missing properties should be present when dispersion=True
is set.
Screenshots
If applicable, add screenshots to help explain your problem.
Eh, looks like this is due to how TorchDFTD3Calculator
is handling things, which is different than the default behavior of the MACE calculator without D3. Arguably not a bug, so feel free to do what you like with the report.