Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of input that causes the bug
Using following definition causes the bug
This definition however works
The cause of the bug
The bug can be inspected by calling
After which you get the bug by calling
To get to the root of the error you can call
Comparing that to the working case
Solution
Based on the above, the type of calculation is always on the last element of
expr.args[1].args[3].args
.Thus using following call solves the bug and works for all the cases
I changed the index for the last argument as well. It should read
AtomsCalculators.Energy
, whereAtomsCalculators
is the first index andEnergy
or calculation type the last index (2nd in practice). This is just to be safe for the future.I also added (altered) a test to verify that all use cases are now tested.
Severity of the bug
This bug has been in AtomsCalculators from the beginning and not been encountered before, so I don't expect this having been causing issues.
The only use case where this could be an issue and where it was discovered is, when you have a wrapper calculator and you want to have specific calls for it.