Skip to content

Commit

Permalink
qchem.outputs.py change for FFOpt with Q-chem 6.1.1+ (#4087)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaebeom-P authored Oct 2, 2024
1 parent fa62ff4 commit d81568b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/pymatgen/io/qchem/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,10 @@ def _read_SCF(self):

temp_SCF_energy = read_pattern(self.text, {"key": r"SCF energy in the final basis set =\s*([\d\-\.]+)"}).get(
"key"
)
) or read_pattern( # support Q-Chem 6.1.1+
self.text, {"key": r"SCF energy =\s*([\d\-\.]+)"}
).get("key")

if temp_SCF_energy is not None:
if len(temp_SCF_energy) == 1:
self.data["SCF_energy_in_the_final_basis_set"] = float(temp_SCF_energy[0][0])
Expand All @@ -934,7 +937,10 @@ def _read_SCF(self):

temp_Total_energy = read_pattern(
self.text, {"key": r"Total energy in the final basis set =\s*([\d\-\.]+)"}
).get("key") or read_pattern( # support Q-Chem 6.1.1+
self.text, {"key": r"Total energy =\s*([\d\-\.]+)"}
).get("key")

if temp_Total_energy is not None:
if len(temp_Total_energy) == 1:
self.data["Total_energy_in_the_final_basis_set"] = float(temp_Total_energy[0][0])
Expand Down
Binary file added tests/files/io/qchem/6.1.1.freq.out.gz
Binary file not shown.
Binary file added tests/files/io/qchem/6.1.1.opt.out.gz
Binary file not shown.
12 changes: 11 additions & 1 deletion tests/io/qchem/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,17 @@ def test_qchem_6_1_1(self):
qc_out = QCOutput(f"{TEST_DIR}/6.1.1.wb97xv.out.gz")
assert qc_out.data["final_energy"] == -76.43205015
n_vals = sum(1 for val in qc_out.data.values() if val is not None)
assert n_vals == 21
assert n_vals == 23

qc_out_read_optimization = QCOutput(f"{TEST_DIR}/6.1.1.opt.out.gz")
qc_out_read_optimization._read_optimization_data()
assert qc_out_read_optimization.data["SCF_energy_in_the_final_basis_set"][-1] == -76.36097614
assert qc_out_read_optimization.data["Total_energy_in_the_final_basis_set"][-1] == -76.36097614

qc_out_read_frequency = QCOutput(f"{TEST_DIR}/6.1.1.freq.out.gz")
qc_out_read_frequency._read_frequency_data()
assert qc_out_read_frequency.data["SCF_energy_in_the_final_basis_set"] == -76.36097614
assert qc_out_read_frequency.data["Total_energy_in_the_final_basis_set"] == -76.36097614


def test_gradient(tmp_path):
Expand Down

0 comments on commit d81568b

Please sign in to comment.