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

Change get default from empty list ([]) to False when used as bool or condition check for Outcar parsing methods #4196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
12 changes: 6 additions & 6 deletions src/pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ def __init__(self, filename: PathLike) -> None:
self.final_energy = e0
self.final_energy_wo_entrp = e_wo_entrp
self.final_fr_energy = e_fr_energy
self.data: dict = {}
self.data: dict[str, Any] = {}

# Read "total number of plane waves", NPLWV:
self.read_pattern(
Expand Down Expand Up @@ -2177,11 +2177,11 @@ def __init__(self, filename: PathLike) -> None:

# Check if calculation is spin polarized
self.read_pattern({"spin": r"ISPIN\s*=\s*2"})
self.spin = bool(self.data.get("spin", []))
self.spin = bool(self.data.get("spin", False))

# Check if calculation is non-collinear
self.read_pattern({"noncollinear": r"LNONCOLLINEAR\s*=\s*T"})
self.noncollinear = bool(self.data.get("noncollinear", []))
self.noncollinear = bool(self.data.get("noncollinear", False))

# Check if the calculation type is DFPT
self.read_pattern(
Expand All @@ -2197,7 +2197,7 @@ def __init__(self, filename: PathLike) -> None:

# Check if LEPSILON is True and read piezo data if so
self.read_pattern({"epsilon": r"LEPSILON\s*=\s*T"})
if self.data.get("epsilon", []):
if self.data.get("epsilon", False):
self.lepsilon = True
self.read_lepsilon()
# Only read ionic contribution if DFPT is turned on
Expand All @@ -2208,7 +2208,7 @@ def __init__(self, filename: PathLike) -> None:

# Check if LCALCPOL is True and read polarization data if so
self.read_pattern({"calcpol": r"LCALCPOL\s*=\s*T"})
if self.data.get("calcpol", []):
if self.data.get("calcpol", False):
self.lcalcpol = True
self.read_lcalcpol()
self.read_pseudo_zval()
Expand All @@ -2220,7 +2220,7 @@ def __init__(self, filename: PathLike) -> None:
self.ngf = None
self.sampling_radii: list[float] | None = None
self.read_pattern({"electrostatic": r"average \(electrostatic\) potential at core"})
if self.data.get("electrostatic", []):
if self.data.get("electrostatic", False):
self.read_electrostatic_potential()

self.read_pattern({"nmr_cs": r"LCHIMAG\s*=\s*(T)"})
Expand Down
Loading