Skip to content

Commit

Permalink
merged barostat fix into experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
qcampbel committed Jan 16, 2025
2 parents 7a65c57 + 49edf6e commit 28dbe28
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions mdagent/tools/base_tools/simulation_tools/setup_and_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,19 @@ def setup_system(self):
if self.sim_params["Ensemble"] == "NPT":
pressure = self.int_params.get("Pressure", 1.0)

if "Pressure" not in self.int_params:
print(
"Warning: 'Pressure' not provided. ",
"Using default pressure of 1.0 atm.",
)
if "Pressure" not in self.int_params:
print(
"Warning: 'Pressure' not provided. ",
"Using default pressure of 1.0 atm.",
)

self.system.addForce(
MonteCarloBarostat(
pressure,
self.int_params["Temperature"],
self.sim_params.get("barostatInterval", 25),
self.system.addForce(
MonteCarloBarostat(
pressure,
self.int_params["Temperature"],
self.sim_params.get("barostatInterval", 25),
)
)
)

def setup_integrator(self):
print("Setting up integrator...")
Expand Down Expand Up @@ -723,18 +723,22 @@ def _construct_script_content(
system.addForce(MonteCarloBarostat(pressure, temperature, barostatInterval))
"""

if integrator_type == "LangevinMiddle" and \
constraints != "None" and constraints:
if (
integrator_type == "LangevinMiddle"
and constraints != "None"
and constraints
):
print("Constraints must be set to 'None' for LangevinMiddle integrator.")
print(integrator_type, "constraints: ",constraints)
print(integrator_type, "constraints: ", constraints)
script_content += """
integrator = LangevinMiddleIntegrator(temperature, friction, dt)
integrator.setConstraintTolerance(constraintTolerance)
simulation = Simulation(modeller.topology, system, integrator, platform)
simulation.context.setPositions(modeller.positions)
"""
if integrator_type == "LangevinMiddle" and \
(constraints == "None" or constraints is None):
if integrator_type == "LangevinMiddle" and (
constraints == "None" or constraints is None
):
script_content += """
integrator = LangevinMiddleIntegrator(temperature, friction, dt)
simulation = Simulation(modeller.topology, system, integrator, platform)
Expand Down

0 comments on commit 28dbe28

Please sign in to comment.