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

Bugfix: io.pwscf.PWInput.from_str() #3931

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Additional fix in regexp
- Must only have one of either + or - in oxidation states, not one of both
  • Loading branch information
jsukpark committed Jul 17, 2024
commit a44a0100ec5c0729961fa5dc9ac9a1d9a3b76db9
4 changes: 2 additions & 2 deletions src/pymatgen/io/pwscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def input_mode(line):
sections[section][key] = PWInput.proc_val(key, val)

elif mode[0] == "pseudo":
if match := re.match(r"(\w+\d*\+?-?)\s+(\d*.\d*)\s+(.*)", line):
if match := re.match(r"(\w+\d*[\+-]?)\s+(\d*.\d*)\s+(.*)", line):
pseudo[match[1].strip()] = match[3].strip()

elif mode[0] == "kpoints":
Expand All @@ -317,7 +317,7 @@ def input_mode(line):

elif mode[0] == "structure":
m_l = re.match(r"(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)", line)
m_p = re.match(r"(\w+\d*\+?-?)\s+(-?\d+\.\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)", line)
m_p = re.match(r"(\w+\d*[\+-]?)\s+(-?\d+\.\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)", line)
if m_l:
lattice += [
float(m_l[1]),
Expand Down