Skip to content

Commit f2c7784

Browse files
committed
Fixed the error message in the free energy hessian
with empty ensemble. This should fix #362
1 parent 0e9e17a commit f2c7784

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Modules/Ensemble.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3655,6 +3655,15 @@ def get_free_energy_hessian(self, include_v4 = False, get_full_hessian = True, v
36553655
# """
36563656
# raise NotImplementedError(ERROR_MSG)
36573657

3658+
# Check if the ensemble has been initialized
3659+
if len(self.forces) == 0:
3660+
n_forces = len(self.forces)
3661+
raise ValueError(
3662+
f"Cannot evaluate free-energy Hessian: 'self.forces' is empty (len={n_forces}). "
3663+
"Initialize or load the ensemble and compute energies and forces first."
3664+
)
3665+
3666+
36583667
# Convert anything into the Ha units
36593668
# This is needed for the Fortran subroutines
36603669
self.convert_units(UNITS_HARTREE)

0 commit comments

Comments
 (0)