Skip to content

Commit

Permalink
Change from equ_x to equil_x
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahbaumann committed Nov 22, 2023
1 parent c119917 commit 11ff8ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 128 deletions.
132 changes: 6 additions & 126 deletions openfe/protocols/openmm_md/plain_md_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _run_MD(simulation: openmm.app.Simulation,
mdtraj_top.subset(selection_indices),
)
traj.save_pdb(
shared_basepath / settings.simulation_settings.equ_NVT_structure
shared_basepath / settings.simulation_settings.equil_NVT_structure
)

# NPT equilibration
Expand Down Expand Up @@ -351,7 +351,7 @@ def _run_MD(simulation: openmm.app.Simulation,
mdtraj_top.subset(selection_indices),
)
traj.save_pdb(
shared_basepath / settings.simulation_settings.equ_NPT_structure
shared_basepath / settings.simulation_settings.equil_NPT_structure
)

# production
Expand Down Expand Up @@ -551,128 +551,8 @@ def run(self, *, dry=False, verbose=True,
equil_steps_nvt,
equil_steps_npt,
prod_steps,
shared_basepath=shared_basepath,
)
# simulation.context.setPositions(stateA_positions)
#
# # minimize
# if verbose:
# self.logger.info("minimizing systems")
#
# simulation.minimizeEnergy(
# maxIterations=sim_settings.minimization_steps
# )
#
# # Get the sub selection of the system to save coords for
# selection_indices = mdtraj.Topology.from_openmm(
# simulation.topology).select(sim_settings.output_indices)
#
# positions = to_openmm(from_openmm(
# simulation.context.getState(getPositions=True,
# enforcePeriodicBox=False
# ).getPositions()))
# # Store subset of atoms, specified in input, as PDB file
# mdtraj_top = mdtraj.Topology.from_openmm(simulation.topology)
#
# traj = mdtraj.Trajectory(
# positions[selection_indices, :],
# mdtraj_top.subset(selection_indices),
# )
# traj.save_pdb(
# shared_basepath / sim_settings.minimized_structure
# )
# # equilibrate
# # NVT equilibration
# if verbose:
# self.logger.info("Running NVT equilibration")
#
# # Set barostat frequency to zero for NVT
# for x in simulation.context.getSystem().getForces():
# if x.getName() == 'MonteCarloBarostat':
# x.setFrequency(0)
#
# simulation.context.setVelocitiesToTemperature(
# to_openmm(thermo_settings.temperature))
#
# t0 = time.time()
# simulation.step(equil_steps_nvt)
# t1 = time.time()
# if verbose:
# self.logger.info(f"Completed NVT equilibration in {t1 - t0} seconds")
#
# # Save last frame NVT equilibration
# positions = to_openmm(
# from_openmm(simulation.context.getState(
# getPositions=True, enforcePeriodicBox=False
# ).getPositions()))
#
# traj = mdtraj.Trajectory(
# positions[selection_indices, :],
# mdtraj_top.subset(selection_indices),
# )
# traj.save_pdb(
# shared_basepath / sim_settings.equ_NVT_structure
# )
#
# # NPT equilibration
# if verbose:
# self.logger.info("Running NPT equilibration")
# simulation.context.setVelocitiesToTemperature(
# to_openmm(thermo_settings.temperature))
#
# # Enable the barostat for NPT
# for x in simulation.context.getSystem().getForces():
# if x.getName() == 'MonteCarloBarostat':
# x.setFrequency(integrator_settings.barostat_frequency.m)
#
# t0 = time.time()
# simulation.step(equil_steps_npt)
# t1 = time.time()
# if verbose:
# self.logger.info(f"Completed NPT equilibration in {t1 - t0} seconds")
#
# # Save last frame NPT equilibration
# positions = to_openmm(
# from_openmm(simulation.context.getState(
# getPositions=True, enforcePeriodicBox=False
# ).getPositions()))
#
# traj = mdtraj.Trajectory(
# positions[selection_indices, :],
# mdtraj_top.subset(selection_indices),
# )
# traj.save_pdb(
# shared_basepath / sim_settings.equ_NPT_structure
# )
#
# # production
# if verbose:
# self.logger.info("running production phase")
#
# # Setup the reporters
# simulation.reporters.append(XTCReporter(
# file=str(shared_basepath / sim_settings.output_filename),
# reportInterval=sim_settings.trajectory_interval.m,
# atomSubset=selection_indices))
# simulation.reporters.append(openmm.app.CheckpointReporter(
# file=str(shared_basepath / sim_settings.checkpoint_storage),
# reportInterval=sim_settings.checkpoint_interval.m))
# simulation.reporters.append(openmm.app.StateDataReporter(
# str(shared_basepath / sim_settings.log_output),
# sim_settings.checkpoint_interval.m,
# step=True,
# time=True,
# potentialEnergy=True,
# kineticEnergy=True,
# totalEnergy=True,
# temperature=True,
# volume=True,
# density=True,
# ))
# t0 = time.time()
# simulation.step(prod_steps)
# t1 = time.time()
# if verbose:
# self.logger.info(f"Completed simulation in {t1 - t0} seconds")

finally:

Expand All @@ -682,9 +562,9 @@ def run(self, *, dry=False, verbose=True,
if not dry: # pragma: no-cover
return {
'system_pdb': shared_basepath / sim_settings.output_filename,
'minimizes_pdb': shared_basepath / sim_settings.minimized_structure,
'nvt_equil_pdb': shared_basepath / sim_settings.equ_NVT_structure,
'npt_equil_pdb': shared_basepath / sim_settings.equ_NPT_structure,
'minimized_pdb': shared_basepath / sim_settings.minimized_structure,
'nvt_equil_pdb': shared_basepath / sim_settings.equil_NVT_structure,
'npt_equil_pdb': shared_basepath / sim_settings.equil_NPT_structure,
'nc': shared_basepath / sim_settings.output_filename,
'last_checkpoint': shared_basepath / sim_settings.checkpoint_storage,
}
Expand Down
4 changes: 2 additions & 2 deletions openfe/protocols/openmm_utils/omm_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ class Config:
minimized_structure = 'minimized.pdb'
"""Path to the pdb file of the system after minimization.
Only the specified atom subset is saved. Default 'minimized.pdb'."""
equ_NVT_structure = 'equ_NVT.pdb'
equil_NVT_structure = 'equil_NVT.pdb'
"""Path to the pdb file of the system after NVT equilibration.
Only the specified atom subset is saved. Default 'equ_NVT.pdb'."""
equ_NPT_structure = 'equ_NPT.pdb'
equil_NPT_structure = 'equil_NPT.pdb'
"""Path to the pdb file of the system after NPT equilibration.
Only the specified atom subset is saved. Default 'equ_NPT.pdb'."""
checkpoint_storage = 'checkpoint.chk'
Expand Down

0 comments on commit 11ff8ca

Please sign in to comment.