Skip to content

Commit 216677a

Browse files
committed
Merge branch 'master' of github.com:materialsproject/pymatgen
Former-commit-id: dfacb43c24648c4eb1ef4f7b1f4b8aa38066194f [formerly ca4af68] Former-commit-id: fcd5a869e5e023b1badab969f5233d35f434959f
2 parents 389cb1d + 9e109d0 commit 216677a

File tree

3 files changed

+437
-3
lines changed

3 files changed

+437
-3
lines changed

pymatgen/io/qchemio.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def _parse_job(cls, output):
12071207
thermal_corr_pattern = re.compile("(?P<name>\S.*\S):\s+"
12081208
"(?P<correction>\d+\.\d+)\s+"
12091209
"k?cal/mol")
1210-
detailed_charge_pattern = re.compile("Ground-State (?P<method>\w+) Net"
1210+
detailed_charge_pattern = re.compile("(Ground-State )?(?P<method>\w+)( Net)?"
12111211
" Atomic Charges")
12121212
nbo_charge_pattern = re.compile("(?P<element>[A-Z][a-z]{0,2})\s+(?P<no>\d+)\s+(?P<charge>\-?\d\.\d+)"
12131213
"\s+(?P<core>\-?\d+\.\d+)\s+(?P<valence>\-?\d+\.\d+)"
@@ -1278,6 +1278,7 @@ def _parse_job(cls, output):
12781278
current_beta_homo = None
12791279
homo_lumo = []
12801280
bsse = None
1281+
hiershfiled_pop = False
12811282
for line in output.split("\n"):
12821283
for ep, message in error_defs:
12831284
if ep.search(line):
@@ -1517,8 +1518,13 @@ def _parse_job(cls, output):
15171518
parse_input = True
15181519
elif "Standard Nuclear Orientation (Angstroms)" in line:
15191520
parse_coords = True
1520-
elif "Cycle Energy DIIS Error" in line\
1521-
or "Cycle Energy RMS Gradient" in line:
1521+
elif "Performing Hirshfeld population analysis" in line:
1522+
hiershfiled_pop = True
1523+
elif "Hirshfeld: atomic densities completed" in line:
1524+
hiershfiled_pop = False
1525+
elif ("Cycle Energy DIIS Error" in line\
1526+
or "Cycle Energy RMS Gradient" in line)\
1527+
and not hiershfiled_pop:
15221528
parse_scf_iter = True
15231529
scf_iters.append([])
15241530
scf_successful = False

pymatgen/io/tests/test_qchemio.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,13 @@ def test_bsse(self):
17421742
self.assertAlmostEqual(qcout.data[0]["bsse"], -0.164210762949, 5)
17431743
self.assertEqual(qcout.data[0]["jobtype"], "bsse")
17441744

1745+
def test_hirshfeld_charge(self):
1746+
filename = os.path.join(test_dir, "hirshfeld_population.qcout")
1747+
qcout = QcOutput(filename)
1748+
self.assertEqual(qcout.data[0]["charges"]["hirshfeld"],
1749+
[-0.286309, 0.143134, 0.143176])
1750+
self.assertFalse(qcout.data[0]["has_error"])
1751+
17451752

17461753
if __name__ == "__main__":
17471754
unittest.main()

0 commit comments

Comments
 (0)