Skip to content

Commit 2f4c6fc

Browse files
committed
fix io.qchem
1 parent 962e4ee commit 2f4c6fc

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

pymatgen/io/qchem/outputs.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -677,15 +677,12 @@ def _read_eigenvalues(self):
677677
if spin_unrestricted:
678678
header_pattern = r"Final Beta MO Eigenvalues"
679679
footer_pattern = r"Final Alpha MO Coefficients+\s*"
680-
beta_eigenvalues = read_matrix_pattern(
680+
self.data["beta_eigenvalues"] = read_matrix_pattern(
681681
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
682682
)
683683

684684
self.data["alpha_eigenvalues"] = alpha_eigenvalues
685685

686-
if spin_unrestricted:
687-
self.data["beta_eigenvalues"] = beta_eigenvalues
688-
689686
def _read_fock_matrix(self):
690687
"""Parses the Fock matrix. The matrix is read in whole
691688
from the output file and then transformed into the right dimensions.
@@ -705,13 +702,6 @@ def _read_fock_matrix(self):
705702
alpha_fock_matrix = read_matrix_pattern(
706703
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
707704
)
708-
# The beta Fock matrix is only present if this is a spin-unrestricted calculation.
709-
if spin_unrestricted:
710-
header_pattern = r"Final Beta Fock Matrix"
711-
footer_pattern = "SCF time:"
712-
beta_fock_matrix = read_matrix_pattern(
713-
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
714-
)
715705

716706
# Convert the matrices to the right dimension. Right now they are simply
717707
# one massive list of numbers, but we need to split them into a matrix. The
@@ -720,7 +710,14 @@ def _read_fock_matrix(self):
720710
alpha_fock_matrix = process_parsed_fock_matrix(alpha_fock_matrix)
721711
self.data["alpha_fock_matrix"] = alpha_fock_matrix
722712

713+
# The beta Fock matrix is only present if this is a spin-unrestricted calculation.
723714
if spin_unrestricted:
715+
header_pattern = r"Final Beta Fock Matrix"
716+
footer_pattern = "SCF time:"
717+
beta_fock_matrix = read_matrix_pattern(
718+
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
719+
)
720+
724721
# Perform the same transformation for the beta Fock matrix.
725722
beta_fock_matrix = process_parsed_fock_matrix(beta_fock_matrix)
726723
self.data["beta_fock_matrix"] = beta_fock_matrix
@@ -744,12 +741,6 @@ def _read_coefficient_matrix(self):
744741
alpha_coeff_matrix = read_matrix_pattern(
745742
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
746743
)
747-
if spin_unrestricted:
748-
header_pattern = r"Final Beta MO Coefficients"
749-
footer_pattern = "Final Alpha Density Matrix"
750-
beta_coeff_matrix = read_matrix_pattern(
751-
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
752-
)
753744

754745
# Convert the matrices to the right dimension. Right now they are simply
755746
# one massive list of numbers, but we need to split them into a matrix. The
@@ -759,6 +750,12 @@ def _read_coefficient_matrix(self):
759750
self.data["alpha_coeff_matrix"] = alpha_coeff_matrix
760751

761752
if spin_unrestricted:
753+
header_pattern = r"Final Beta MO Coefficients"
754+
footer_pattern = "Final Alpha Density Matrix"
755+
beta_coeff_matrix = read_matrix_pattern(
756+
header_pattern, footer_pattern, elements_pattern, self.text, postprocess=float
757+
)
758+
762759
# Perform the same transformation for the beta Fock matrix.
763760
beta_coeff_matrix = process_parsed_fock_matrix(beta_coeff_matrix)
764761
self.data["beta_coeff_matrix"] = beta_coeff_matrix

0 commit comments

Comments
 (0)