Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/somd2/config/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/somd2/runner/_repex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions src/somd2/runner/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Loading