Fix structure field shadowing sort_structure in VaspInputGenerator - #1530
Open
ThomasWarford wants to merge 3 commits into
Open
Fix structure field shadowing sort_structure in VaspInputGenerator#1530ThomasWarford wants to merge 3 commits into
structure field shadowing sort_structure in VaspInputGenerator#1530ThomasWarford wants to merge 3 commits into
Conversation
Member
|
@esoteric-ephemera do you have time to look into this? I don't have much experience with the MD workflow |
Comment on lines
+176
to
+177
| # Do not redeclare `structure` here: VaspInputSet so setting structure | ||
| # uses pymatgen.io.vasp.sets setter which sorts the structure |
Collaborator
There was a problem hiding this comment.
remove the ai-generated comment please
Collaborator
|
Thanks @ThomasWarford. I'm not sure the analysis is quite right, since That being said, it is redundant to redeclare the field here so I'm fine with this change Guessing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
VaspInputGeneratorredeclaredstructureas a plain dataclass field, overriding thestructureproperty (with itssort_structure/reduce_structure/validate_magmomsetter) inherited from pymatgen'sVaspInputSet. As a result,sort_structuresilently never ran for any atomate2 VASP input-set generator.MDSetGenerator'snptensemble:LANGEVIN_GAMMAis sized to the number of distinct elements, while VASP counts POSCAR "types" as contiguous same-element runs. With an unsorted structure the two counts diverge and VASP aborts withError reading item LANGEVIN_GAMMA from file INCAR.tests/vasp/test_sets.py) and a standalone repro (example.py).Alternatively, we modify MDSetGenerator something like:
for a more targeted fix.
Additional dependencies introduced (if any)
TODO (if any)
Checklist
Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruffandruff formaton your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.
Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit installand a check will be run prior to allowing commits.Issue
Closes #1529. See this issue for bug reproduction instructions.