Skip to content

Commit

Permalink
Minimization convergence tests (#20)
Browse files Browse the repository at this point in the history
* be more explicit with source of molecular topology
* minimization test
* adding drugbank
* Add ContinuousProgressReporter class for reporting simulation progress
* Skip molecules containing phosphores during minimum test detection
* Fix exception handling in run_detect_minimum_test function
* Refactor stability protocol and molecule generation functions
* Add simulation parameters classes and initialize_ml_system function
* Fix code formatting and update file paths

---------

Co-authored-by: wiederm <[email protected]>
  • Loading branch information
wiederm and wiederm authored Mar 22, 2024
1 parent a853b93 commit 1026bd2
Show file tree
Hide file tree
Showing 24 changed files with 1,587 additions and 686 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ ENV/

# In-tree generated files
*/_version.py
scripts/test_stability_protocol/
*pdb
*dcd
*pt
test_stability_protocol/
guardowl/data/drugbank/
2 changes: 1 addition & 1 deletion guardowl/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def run(self) -> None:
print(f"{self.implementation=} {self.platform=}")
potential = MLPotential(self.nnp)

system = self.system_factory.initialize_pure_ml_system(
system = self.system_factory.initialize_ml_system(
potential,
self.testsystem.topology,
self.remove_constraints,
Expand Down
Binary file added guardowl/data/drugbank.tar.gz
Binary file not shown.
78 changes: 60 additions & 18 deletions guardowl/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@

@dataclass
class BaseParameters:
"""
Base class for simulation parameters.
Attributes
----------
system : System
The OpenMM System object to be used for the simulation.
platform : Platform
The OpenMM Platform object specifying the computation platform.
testsystem : TestSystem
The test system object containing the molecular system setup.
output_folder : str
Directory path where output files will be saved.
log_file_name : str
Filename for the log file.
"""

system: System
platform: Platform
testsystem: TestSystem
Expand All @@ -16,7 +34,36 @@ class BaseParameters:

@dataclass
class MinimizationTestParameters(BaseParameters):
convergence_criteria: unit.Quantity = field(default_factory=1.0 * unit.kilojoule_per_mole / unit.nanometer)
"""
Parameters specific to minimization tests.
Attributes
----------
convergence_criteria : unit.Quantity
The energy convergence criteria for the minimization process.
env : str
The environment of the simulation (e.g., 'vacuum', 'solution').
device_index : int
Index of the GPU device to use for the simulation.
temperature : unit.Quantity
The temperature at which the simulation is performed.
ensemble : str
The statistical ensemble for the simulation (e.g., 'NVT').
"""

convergence_criteria: unit.Quantity = field(
default_factory=lambda: unit.Quantity(
0.5, unit.kilojoule_per_mole / unit.angstrom
)
)
env: str = "vacuum"
device_index: int = 0
temperature: unit.Quantity = field(
default_factory=lambda: unit.Quantity(300, unit.kelvin)
)

ensemble: str = "NVT"


@dataclass
Expand All @@ -28,29 +75,24 @@ class StabilityTestParameters(BaseParameters):
Attributes
----------
protocol_length : int
Length of the protocol in time units.
The duration of the test protocol.
temperature : unit.Quantity
Temperature of the simulation.
ensemble : str
Ensemble type ('NVT', 'NPT', etc.).
The temperature at which the test is conducted.
env : str
The environment for the simulation (e.g., 'vacuum', 'solution').
simulated_annealing : bool
Whether simulated annealing is to be used.
system : System
The OpenMM System object.
platform : Platform
The OpenMM Platform object.
testsystem : TestSystem
The test system for the simulation.
output_folder : str
Path to the output folder.
log_file_name : str
Name of the log file.
Flag to indicate if simulated annealing is used.
state_data_reporter : StateDataReporter
The OpenMM StateDataReporter object.
The OpenMM StateDataReporter object for logging.
device_index : int
Index of the GPU device to use for the simulation.
ensemble : Optional[str]
The statistical ensemble for the simulation (e.g., 'NVT', 'NPT'). None if not applicable.
"""

protocol_length: int
temperature: Union[int, List[int]]
temperature: unit.Quantity
env: str
simulated_annealing: bool
state_data_reporter: StateDataReporter
Expand Down
Loading

0 comments on commit 1026bd2

Please sign in to comment.