Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle invalid selective dynamics info in POSCAR #3539

Merged
merged 50 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
dcfc3c4
Issue warning for invalid selective dynamics info in POSCAR
janosh Jan 9, 2024
a0ee8fc
Issue warning for invalid selective dynamics info in POSCAR
janosh Jan 9, 2024
0b97ceb
Merge branch 'fix-selective-dynamics' of https://github.com/DanielYan…
DanielYang59 Jan 10, 2024
4b237ec
reserve removal of BadIncarWarning
DanielYang59 Jan 11, 2024
b158c9e
add unit test
DanielYang59 Jan 12, 2024
2effe06
add bad POSCAR warnings
DanielYang59 Jan 17, 2024
faadd7d
pre-commit auto-fixes
pre-commit-ci[bot] Jan 17, 2024
48a220d
revise checking
DanielYang59 Jan 17, 2024
c5678d8
Merge branch 'fix-selective-dynamics' of https://github.com/DanielYan…
DanielYang59 Jan 17, 2024
fd80e6f
revise checking
DanielYang59 Jan 17, 2024
e7f73c8
revise checking
DanielYang59 Jan 17, 2024
2a9d2e5
improve description
DanielYang59 Jan 27, 2024
2735ecf
improve warning message
DanielYang59 Jan 30, 2024
89b501b
update INCAR tag/value reference
DanielYang59 Feb 2, 2024
01289cd
improve INCAR tag checking
DanielYang59 Feb 2, 2024
bfd2147
improve tag checking
DanielYang59 Feb 2, 2024
8d00e8f
cut long lines
DanielYang59 Feb 2, 2024
96fe98c
allow union type
DanielYang59 Feb 2, 2024
55a5784
anchor floating list comprehension
DanielYang59 Feb 2, 2024
deecf3f
tweak formats
DanielYang59 Feb 2, 2024
fab8e71
switch to pathlib for path handling
DanielYang59 Feb 2, 2024
e596051
fix dir exist error
DanielYang59 Feb 2, 2024
e2b6733
remove unused import
DanielYang59 Feb 2, 2024
9e2b77b
Revert "improving INCAR tag checking"
DanielYang59 Feb 3, 2024
6952228
Revert "fix dir exist error"
DanielYang59 Feb 3, 2024
a694bad
Revert "switch to pathlib for path handling"
DanielYang59 Feb 3, 2024
99a97a5
Revert "tweak formats"
DanielYang59 Feb 3, 2024
7981191
Revert "anchor floating list comprehension"
DanielYang59 Feb 3, 2024
302d3e6
Revert "allow union type"
DanielYang59 Feb 3, 2024
473bb5d
Revert "cut long lines"
DanielYang59 Feb 3, 2024
1d433ec
Revert "improve tag checking"
DanielYang59 Feb 3, 2024
5a66f1d
Revert "improve INCAR tag checking"
DanielYang59 Feb 3, 2024
47b028e
Revert "update INCAR tag/value reference"
DanielYang59 Feb 3, 2024
4975c7c
Revert "improve warning message"
DanielYang59 Feb 3, 2024
d36adb4
Reapply "improve warning message"
DanielYang59 Feb 3, 2024
1b6bfd5
Merge branch 'master' into fix-selective-dynamics
DanielYang59 Feb 8, 2024
00764fd
pre-commit auto-fixes
pre-commit-ci[bot] Feb 8, 2024
4f2a88f
revert removal of str()
DanielYang59 Feb 8, 2024
57fd9e0
wrap long line
DanielYang59 Feb 8, 2024
000d8ad
fix warning message
DanielYang59 Feb 8, 2024
b01c4bb
Merge branch 'materialsproject:master' into fix-selective-dynamics
DanielYang59 Feb 9, 2024
ac3ee7f
break a super long line
DanielYang59 Feb 10, 2024
0bbab02
fix type annotations errors related to this PR
DanielYang59 Feb 10, 2024
7bae2ba
fix " Incompatible types in assignment (expression has type "list[str…
DanielYang59 Feb 10, 2024
88cbdfd
initialize vars with empty instead of None to fix type annotation error
DanielYang59 Feb 10, 2024
8b437af
pre-commit auto-fixes
pre-commit-ci[bot] Feb 10, 2024
249c264
Merge branch 'master' into fix-selective-dynamics
DanielYang59 Feb 13, 2024
5ded387
revert var name from d to dct
DanielYang59 Feb 13, 2024
e901682
fix unit tests
DanielYang59 Feb 13, 2024
cf4cecf
simplify Lobsterin.get_basis()
janosh Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions pymatgen/io/vasp/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,12 @@ def from_str(cls, data, default_names=None, read_velocities=True) -> Poscar:

# Read the atomic coordinates
coords = []
selective_dynamics = [] if has_selective_dynamics else None
selective_dynamics: list[np.ndarray] | None = [] if has_selective_dynamics else None
for i in range(n_sites):
tokens = lines[ipos + 1 + i].split()
crd_scale = scale if cart else 1
coords.append([float(j) * crd_scale for j in tokens[:3]])
if has_selective_dynamics:
if selective_dynamics is not None:
# Warn when values contain suspicious entries
if any(value not in {"T", "F"} for value in tokens[3:6]):
warnings.warn("Selective dynamics values must be either 'T' or 'F'.", BadPoscarWarning)
Expand All @@ -443,7 +443,7 @@ def from_str(cls, data, default_names=None, read_velocities=True) -> Poscar:
selective_dynamics.append([value == "T" for value in tokens[3:6]])

# Warn when ALL degrees of freedom relaxed (#3539)
if has_selective_dynamics and all(all(i is True for i in in_list) for in_list in selective_dynamics):
if selective_dynamics is not None and all(all(i is True for i in in_list) for in_list in selective_dynamics):
DanielYang59 marked this conversation as resolved.
Show resolved Hide resolved
warnings.warn(
"Ignoring selective dynamics tag, as no ionic degrees of freedom were fixed.", BadPoscarWarning
)
Expand Down