Skip to content
Draft
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
38 changes: 34 additions & 4 deletions dimsim/compute/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def run_equilibration(
import openmm
import openmm.app
import openmm.unit
from smee.mm import TensorReporter

logging.basicConfig(
filename=f"{job_dir}/simulation.log",
Expand Down Expand Up @@ -247,6 +248,7 @@ def run_equilibration(
File(f"{job_dir}/production_system.xml"), # probably don't need to carry this through ...
File(f"{job_dir}/equilibration_integrator.xml"),
File(f"{job_dir}/equilibration_checkpoint.chk"),
File(f"{job_dir}/equilibration_trajectory.msgpack"),
]

simulation.reporters.append(
Expand All @@ -264,10 +266,23 @@ def run_equilibration(
)
)

simulation.reporters.append(openmm.app.DCDReporter(simulation_files[1].filepath, 1000))
dcd_reporter = openmm.app.DCDReporter(
file=simulation_files[1].filepath,
reportInterval=1000,
)

smee_reporter = TensorReporter(
output_file=open(simulation_files[6].filepath, "wb"),
report_interval=1000,
beta=1.0 / openmm.unit.kilocalories_per_mole,
pressure=compute_config["pressure"] * openmm.unit.kilopascal,
)

simulation.reporters.append(dcd_reporter)
simulation.reporters.append(smee_reporter)

logging.info("Running 10,000 steps of MD")
# simulation.step(equilibration_config["steps_per_iteration"])

simulation.step(10_000)

with open(simulation_files[0].filepath, "w") as f:
Expand Down Expand Up @@ -298,9 +313,10 @@ def run_production(
equilibration_future: dict[str, tuple[File, ...]],
job_dir: str,
) -> dict[str, tuple[File, ...]]:

import logging

from smee.mm import TensorReporter

logging.basicConfig(
filename=f"{job_dir}/simulation.log",
level=logging.INFO,
Expand Down Expand Up @@ -332,6 +348,7 @@ def run_production(
File(f"{job_dir}/production_system.xml"),
File(f"{job_dir}/production_integrator.xml"),
File(f"{job_dir}/production_checkpoint.chk"),
File(f"{job_dir}/production_trajectory.msgpack"),
]

simulation.reporters.append(
Expand All @@ -349,7 +366,20 @@ def run_production(
)
)

simulation.reporters.append(openmm.app.DCDReporter(simulation_files[1].filepath, 1000))
dcd_reporter = openmm.app.DCDReporter(
file=simulation_files[1].filepath,
reportInterval=1000,
)

smee_reporter = TensorReporter(
output_file=open(simulation_files[6].filepath, "wb"),
report_interval=1000,
beta=1.0 / openmm.unit.kilocalories_per_mole,
pressure=compute_config["pressure"] * openmm.unit.kilopascal,
)

simulation.reporters.append(dcd_reporter)
simulation.reporters.append(smee_reporter)

logging.info("Running 100,000 steps of MD")
# simulation.step(equilibration_config["steps_per_iteration"])
Expand Down
Loading