diff --git a/src/somd2/_utils/_somd1.py b/src/somd2/_utils/_somd1.py index 760bb75..64144b0 100644 --- a/src/somd2/_utils/_somd1.py +++ b/src/somd2/_utils/_somd1.py @@ -660,7 +660,7 @@ def reconstruct_system(system): # Loop over all perturbable molecules. for mol in pert_mols: - # Delete an AmberParams properties. + # Delete any AmberParams properties. try: cursor = mol.cursor() del cursor["parameters0"] diff --git a/src/somd2/config/_config.py b/src/somd2/config/_config.py index e75f1ef..d6eb358 100644 --- a/src/somd2/config/_config.py +++ b/src/somd2/config/_config.py @@ -152,6 +152,7 @@ def __init__( overwrite=False, somd1_compatibility=False, pert_file=None, + save_crash_report=False, save_energy_components=False, page_size=None, timeout="300 s", @@ -451,6 +452,9 @@ def __init__( The path to a SOMD1 perturbation file to apply to the reference system. When set, this will automatically set 'somd1_compatibility' to True. + save_crash_report: bool + Whether to save a crash report if the simulation crashes. + save_energy_components: bool Whether to save the energy contribution for each force when checkpointing. This is useful when debugging crashes. @@ -544,6 +548,7 @@ def __init__( self.use_backup = use_backup self.somd1_compatibility = somd1_compatibility self.pert_file = pert_file + self.save_crash_report = save_crash_report self.save_energy_components = save_energy_components self.timeout = timeout self.num_energy_neighbours = num_energy_neighbours @@ -1876,6 +1881,16 @@ def pert_file(self, pert_file): self._pert_file = pert_file + @property + def save_crash_report(self): + return self._save_crash_report + + @save_crash_report.setter + def save_crash_report(self, save_crash_report): + if not isinstance(save_crash_report, bool): + raise ValueError("'save_crash_report' must be of type 'bool'") + self._save_crash_report = save_crash_report + @property def save_energy_components(self): return self._save_energy_components diff --git a/src/somd2/runner/_repex.py b/src/somd2/runner/_repex.py index 0a0711d..b459676 100644 --- a/src/somd2/runner/_repex.py +++ b/src/somd2/runner/_repex.py @@ -1144,6 +1144,7 @@ def _run_block( auto_fix_minimise=True, num_energy_neighbours=self._config.num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, # GCMC specific options. excess_chemical_potential=( self._mu_ex if gcmc_sampler is not None else None @@ -1381,6 +1382,7 @@ def _equilibrate(self, index): frame_frequency=0, save_velocities=False, auto_fix_minimise=True, + save_crash_report=self._config.save_crash_report, ) # Commit the system. diff --git a/src/somd2/runner/_runner.py b/src/somd2/runner/_runner.py index 0e0e448..da7f3fa 100644 --- a/src/somd2/runner/_runner.py +++ b/src/somd2/runner/_runner.py @@ -519,6 +519,7 @@ def generate_lam_vals(lambda_base, increment=0.001): frame_frequency=0, save_velocities=False, auto_fix_minimise=True, + save_crash_report=self._config.save_crash_report, ) # Commit the system. @@ -686,6 +687,7 @@ def generate_lam_vals(lambda_base, increment=0.001): auto_fix_minimise=True, num_energy_neighbours=num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, # GCMC specific options. excess_chemical_potential=( self._mu_ex if gcmc_sampler is not None else None @@ -723,6 +725,7 @@ def generate_lam_vals(lambda_base, increment=0.001): auto_fix_minimise=True, num_energy_neighbours=num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, ) except Exception as e: try: @@ -820,6 +823,7 @@ def generate_lam_vals(lambda_base, increment=0.001): auto_fix_minimise=True, num_energy_neighbours=num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, ) # Save the energy contribution for each force. @@ -895,6 +899,7 @@ def generate_lam_vals(lambda_base, increment=0.001): auto_fix_minimise=True, num_energy_neighbours=num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, ) # Perform a GCMC move. @@ -922,6 +927,7 @@ def generate_lam_vals(lambda_base, increment=0.001): auto_fix_minimise=True, num_energy_neighbours=num_energy_neighbours, null_energy=self._config.null_energy, + save_crash_report=self._config.save_crash_report, ) except Exception as e: try: