Skip to content

Commit 8247c99

Browse files
authored
Merge pull request #105 from OpenBioSim/fix_crash_report
Expose missing save_crash_report dynamics option
2 parents fe6c450 + 01c78ab commit 8247c99

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/somd2/config/_config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def __init__(
152152
overwrite=False,
153153
somd1_compatibility=False,
154154
pert_file=None,
155+
save_crash_report=False,
155156
save_energy_components=False,
156157
page_size=None,
157158
timeout="300 s",
@@ -451,6 +452,9 @@ def __init__(
451452
The path to a SOMD1 perturbation file to apply to the reference system.
452453
When set, this will automatically set 'somd1_compatibility' to True.
453454
455+
save_crash_report: bool
456+
Whether to save a crash report if the simulation crashes.
457+
454458
save_energy_components: bool
455459
Whether to save the energy contribution for each force when checkpointing.
456460
This is useful when debugging crashes.
@@ -544,6 +548,7 @@ def __init__(
544548
self.use_backup = use_backup
545549
self.somd1_compatibility = somd1_compatibility
546550
self.pert_file = pert_file
551+
self.save_crash_report = save_crash_report
547552
self.save_energy_components = save_energy_components
548553
self.timeout = timeout
549554
self.num_energy_neighbours = num_energy_neighbours
@@ -1876,6 +1881,16 @@ def pert_file(self, pert_file):
18761881

18771882
self._pert_file = pert_file
18781883

1884+
@property
1885+
def save_crash_report(self):
1886+
return self._save_crash_report
1887+
1888+
@save_crash_report.setter
1889+
def save_crash_report(self, save_crash_report):
1890+
if not isinstance(save_crash_report, bool):
1891+
raise ValueError("'save_crash_report' must be of type 'bool'")
1892+
self._save_crash_report = save_crash_report
1893+
18791894
@property
18801895
def save_energy_components(self):
18811896
return self._save_energy_components

src/somd2/runner/_repex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ def _run_block(
11441144
auto_fix_minimise=True,
11451145
num_energy_neighbours=self._config.num_energy_neighbours,
11461146
null_energy=self._config.null_energy,
1147+
save_crash_report=self._config.save_crash_report,
11471148
# GCMC specific options.
11481149
excess_chemical_potential=(
11491150
self._mu_ex if gcmc_sampler is not None else None
@@ -1381,6 +1382,7 @@ def _equilibrate(self, index):
13811382
frame_frequency=0,
13821383
save_velocities=False,
13831384
auto_fix_minimise=True,
1385+
save_crash_report=self._config.save_crash_report,
13841386
)
13851387

13861388
# Commit the system.

src/somd2/runner/_runner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
519519
frame_frequency=0,
520520
save_velocities=False,
521521
auto_fix_minimise=True,
522+
save_crash_report=self._config.save_crash_report,
522523
)
523524

524525
# Commit the system.
@@ -686,6 +687,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
686687
auto_fix_minimise=True,
687688
num_energy_neighbours=num_energy_neighbours,
688689
null_energy=self._config.null_energy,
690+
save_crash_report=self._config.save_crash_report,
689691
# GCMC specific options.
690692
excess_chemical_potential=(
691693
self._mu_ex if gcmc_sampler is not None else None
@@ -723,6 +725,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
723725
auto_fix_minimise=True,
724726
num_energy_neighbours=num_energy_neighbours,
725727
null_energy=self._config.null_energy,
728+
save_crash_report=self._config.save_crash_report,
726729
)
727730
except Exception as e:
728731
try:
@@ -820,6 +823,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
820823
auto_fix_minimise=True,
821824
num_energy_neighbours=num_energy_neighbours,
822825
null_energy=self._config.null_energy,
826+
save_crash_report=self._config.save_crash_report,
823827
)
824828

825829
# Save the energy contribution for each force.
@@ -895,6 +899,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
895899
auto_fix_minimise=True,
896900
num_energy_neighbours=num_energy_neighbours,
897901
null_energy=self._config.null_energy,
902+
save_crash_report=self._config.save_crash_report,
898903
)
899904

900905
# Perform a GCMC move.
@@ -922,6 +927,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
922927
auto_fix_minimise=True,
923928
num_energy_neighbours=num_energy_neighbours,
924929
null_energy=self._config.null_energy,
930+
save_crash_report=self._config.save_crash_report,
925931
)
926932
except Exception as e:
927933
try:

0 commit comments

Comments
 (0)