Assertion for "force_consistent=True"
We should add an assertion or exception if the user loads trained amp files, where the force_consistent=True keyword has been used, but does not explicitly give the keyword when restarting and viceversa.
This could be done in two ways:
- Add an assertion somewhere in AMP
- Change the call from ase.results so it creates an error when the keyword is given (or not) and the respective energy is not available.
Comments (5)
-
repo owner -
force_consistent
is no where inside the Amp code, and I am not sure if it is accessible. I wonder if we should add a new method likedef get_potential_energy(self, atoms, force_consistent=False): self.update(atoms) if force_consistent: .... else: raise RuntimeError('set force_consistent=True')
from https://github.com/qsnake/ase/blob/master/ase/calculators/general.py.
-
repo owner It's been a while since we discussed this, but I think the idea is that users could choose to train with force-consistent or 0-Kelvin energy. That is, we might add a
force_consistent
keyword toAmp.train
. Then we need to have theforce_consistent
keyword in energy and force call methods, and raise an error if it doesn't match what was chosen during training. Does that make sense? -
The first part seems simple, we just add a
force_consistent
keyword toAmp.train
and propagate it to themodel/__init__.py
and add it toimage.get_potential_energy
.However, what I am confused about is the second part where we need to access
force_consistent
keyword fed by the user when callingcalc = Amp(...) image.set_calculator(calc) image.get_potential_energy(force_consistent=True)
(and then compare it with the value saved in
calc.amp
). Let's discuss it more in person, if what I said is not clear. -
repo owner The force consistent keyword is already there through the ASE calculator. See this link.
So we just need to work within this framework, I would think.
Note I have a patch in progress for ASE that will make that force_consistent keyword work better. Perhaps we just want to put this issue on hold until after v0.5 since we're not using it at the moment.
- Log in to comment
Or more specifically, the error would be raised at the point when the user calls
calc.get_potential_energy(force_consistent=False)
.