Skip to content

Commit

Permalink
revert str.split to tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Dec 5, 2023
1 parent ce51866 commit 93078ff
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions pymatgen/io/qchem/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def _read_charges_and_dipoles(self):
)
temp_quadrupole_moment = read_pattern(self.text, {"key": quad_mom_pat}).get("key")
if temp_quadrupole_moment is not None:
keys = "XX XY YY XZ YZ ZZ".split()
keys = ("XX", "XY", "YY", "XZ", "YZ", "ZZ")
if len(temp_quadrupole_moment) == 1:
self.data["multipoles"]["quadrupole"] = {
key: float(temp_quadrupole_moment[0][idx]) for idx, key in enumerate(keys)
Expand All @@ -1004,7 +1004,7 @@ def _read_charges_and_dipoles(self):
)
temp_octopole_moment = read_pattern(self.text, {"key": octo_mom_pat}).get("key")
if temp_octopole_moment is not None:
keys = "XXX XXY XYY YYY XXZ XYZ YYZ XZZ YZZ ZZZ".split()
keys = ("XXX", "XXY", "XYY", "YYY", "XXZ", "XYZ", "YYZ", "XZZ", "YZZ", "ZZZ")
if len(temp_octopole_moment) == 1:
self.data["multipoles"]["octopole"] = {
key: float(temp_octopole_moment[0][idx]) for idx, key in enumerate(keys)
Expand All @@ -1023,7 +1023,23 @@ def _read_charges_and_dipoles(self):
)
temp_hexadecapole_moment = read_pattern(self.text, {"key": hexadeca_mom_pat}).get("key")
if temp_hexadecapole_moment is not None:
keys = "XXXX XXXY XXYY XYYY YYYY XXXZ XXYZ XYYZ YYYZ XXZZ XYZZ YYZZ XZZZ YZZZ ZZZZ".split()
keys = (
"XXXX",
"XXXY",
"XXYY",
"XYYY",
"YYYY",
"XXXZ",
"XXYZ",
"XYYZ",
"YYYZ",
"XXZZ",
"XYZZ",
"YYZZ",
"XZZZ",
"YZZZ",
"ZZZZ",
)

if len(temp_hexadecapole_moment) == 1:
self.data["multipoles"]["hexadecapole"] = {
Expand Down

0 comments on commit 93078ff

Please sign in to comment.