@@ -250,6 +250,9 @@ def __init__(self, element_list):
250250 self .bias_pot_params_grad_list = None
251251 self .bias_pot_params_grad_name_list = None
252252 self .symmetry = None
253+ # Full dict returned by MolecularVibrations.calculate_thermochemistry().
254+ # Remains None when vibrational analysis has not been performed.
255+ self .thermochemistry_results = None
253256
254257 # Flags
255258 self .exit_flag = False
@@ -1487,6 +1490,13 @@ def __init__(self, args):
14871490 self .traj_file = None
14881491 self .bias_pot_params_grad_list = None
14891492 self .bias_pot_params_grad_name_list = None
1493+ # Full dict from MolecularVibrations.calculate_thermochemistry() for the
1494+ # most-recently completed job. None when vibrational analysis has not
1495+ # been performed. Preserved for single-job backward compatibility.
1496+ self .thermochemistry_results = None
1497+ # One entry per job executed via run(). Each entry is the snapshot dict
1498+ # built by _build_job_snapshot(). Empty until run() is called.
1499+ self .all_results = []
14901500
14911501 # Managers
14921502 self .constraints = ConstraintManager (self .config )
@@ -1845,13 +1855,11 @@ def _run_single_job(self, file):
18451855
18461856 # Koopman
18471857 if self .config .koopman_analysis :
1848- # FIX: Use self.state.element_list
18491858 KA = KoopmanAnalyzer (len (self .state .element_list ), file_directory = self .BPA_FOLDER_DIRECTORY )
18501859 else :
18511860 KA = None
18521861
18531862 # Initial files
1854- # FIX: Use self.state.element_list
18551863 self .file_io .print_geometry_list (
18561864 self .state .geometry * self .config .bohr2angstroms ,
18571865 self .state .element_list ,
@@ -1908,7 +1916,6 @@ def _run_single_job(self, file):
19081916
19091917 # Initial geometry save
19101918 if iter_idx == 0 :
1911- # FIX: Use self.state.element_list
19121919 initial_geom_num_list , pre_geom = self ._save_init_geometry (
19131920 self .state .geometry , self .state .element_list , allactive_flag
19141921 )
@@ -2199,6 +2206,11 @@ def _run_single_job(self, file):
21992206 self .irc_terminal_struct_paths = []
22002207
22012208 print (f"Trial of geometry optimization ({ file } ) was completed." )
2209+
2210+ # Append a snapshot of this job's results to all_results so that batch
2211+ # runs retain every job's output. Single-job callers can continue to
2212+ # use the flat attributes (self.final_energy, etc.) unchanged.
2213+ self .all_results .append (self ._build_job_snapshot (file ))
22022214
22032215 # ------------------------------------------------------------------
22042216 # Secondary helpers reused from legacy
@@ -2300,11 +2312,14 @@ def _perform_vibrational_analysis(
23002312 MV = MolecularVibrations (
23012313 atoms = element_list , coordinates = geom_num_list , hessian = tmp_hess
23022314 )
2303- MV .calculate_thermochemistry (
2315+ thermo_results = MV .calculate_thermochemistry (
23042316 e_tot = B_e ,
23052317 temperature = self .config .thermo_temperature ,
23062318 pressure = self .config .thermo_pressure ,
23072319 )
2320+ # Store the full thermochemistry dict on the state so it can be
2321+ # propagated to Optimize and collected in all_results.
2322+ self .state .thermochemistry_results = thermo_results
23082323 MV .print_thermochemistry (
23092324 output_file = self .BPA_FOLDER_DIRECTORY + "/thermochemistry.txt"
23102325 )
@@ -2414,6 +2429,45 @@ def _copy_final_results_from_state(self):
24142429 self .bias_pot_params_grad_list = self .state .bias_pot_params_grad_list
24152430 self .bias_pot_params_grad_name_list = self .state .bias_pot_params_grad_name_list
24162431 self .optimized_flag = self .state .optimized_flag
2432+ # Propagate thermochemistry dict (None when vib analysis was skipped)
2433+ self .thermochemistry_results = getattr (self .state , "thermochemistry_results" , None )
2434+
2435+ def _build_job_snapshot (self , input_file ):
2436+ """Return a plain dict summarising the completed job.
2437+
2438+ This snapshot is appended to ``self.all_results`` after every job so
2439+ that batch runs retain results for all input files. The dict mirrors
2440+ the flat attributes on ``Optimize`` for straightforward access::
2441+
2442+ opt.all_results[0]["thermochemistry_results"] # first job
2443+ opt.all_results[-1]["final_energy"] # last job
2444+
2445+ Parameters
2446+ ----------
2447+ input_file : str
2448+ Path to the input file that was just optimised.
2449+
2450+ Returns
2451+ -------
2452+ dict
2453+ Snapshot of all final-result attributes for the completed job.
2454+ """
2455+ return {
2456+ "input_file" : input_file ,
2457+ "folder_directory" : self .BPA_FOLDER_DIRECTORY ,
2458+ "final_file_directory" : self .final_file_directory ,
2459+ "final_geometry" : self .final_geometry ,
2460+ "final_energy" : self .final_energy ,
2461+ "final_bias_energy" : self .final_bias_energy ,
2462+ "symmetry" : self .symmetry ,
2463+ "optimized_flag" : getattr (self , "optimized_flag" , None ),
2464+ "irc_terminal_struct_paths" : list (self .irc_terminal_struct_paths ),
2465+ "bias_pot_params_grad_list" : self .bias_pot_params_grad_list ,
2466+ "bias_pot_params_grad_name_list" : self .bias_pot_params_grad_name_list ,
2467+ # Full dict from MolecularVibrations.calculate_thermochemistry().
2468+ # None when vibrational analysis was not performed for this job.
2469+ "thermochemistry_results" : self .thermochemistry_results ,
2470+ }
24172471
24182472 def geom_info_extract (self , force_data , file_directory , B_g , g ):
24192473 # kept for backward compatibility; delegate to logger
0 commit comments