mythos.simulators.gromacs

GROMACS simulator module.

Submodules

Classes

GromacsSimulator

A simulator based on running a GROMACS simulation.

Package Contents

class mythos.simulators.gromacs.GromacsSimulator[source]

Bases: mythos.simulators.base.InputDirSimulator

A simulator based on running a GROMACS simulation.

This simulator runs a GROMACS simulation from an input directory containing the necessary configuration files and outputs a trajectory in SimulatorTrajectory format. All _file parameters refer to filenames within the input directory.

Parameters:
  • input_dir – Path to the directory containing the GROMACS input files.

  • energy_fn – The energy function to use for parameter updates. Parameters from this energy function will be used to update the topology file.

  • mdp_file – Name of the .mdp (molecular dynamics parameter) file.

  • topology_file – Name of the topology file (e.g., .top). Parameters from the energy function will be written to this file.

  • trajectory_file – Name of the output trajectory file (e.g., .xtc, .trr).

  • structure_file – Name of the structure/coordinate file (e.g., .gro, .pdb).

  • binary_path – Path to the GROMACS binary. If not provided, will search for ‘gmx’ in PATH.

  • input_overrides – Key-value pairs to override in the .mdp input file.

  • overwrite_input – Whether to overwrite the input directory or copy it.

energy_fn: mythos.energy.base.EnergyFunction
mdp_file: str = 'md.mdp'
topology_file: str = 'topol.top'
structure_file: str = 'membrane.gro'
index_file: str = 'index.ndx'
equilibration_steps: int = 0
simulation_steps: int | None = None
binary_path: pathlib.Path | None = None
input_overrides: dict[str, Any]
__post_init__(*args, **kwds) None[source]

Check the validity of the configuration.

run_simulation(input_dir: pathlib.Path, opt_params: dict[str, Any] | None = None, seed: int | None = None, **_) mythos.simulators.base.SimulatorOutput[source]

Run a GROMACS simulation.

Parameters:
  • input_dir – Path to the working directory for the simulation.

  • opt_params – Optional parameters to update. These will be used to update the energy function and subsequently the topology file.

  • seed – Optional random seed for the simulation. By default, a random seed is generated.

Returns:

SimulatorOutput containing the trajectory.

_run_simulation_step(structure_file: str, overrides: dict[str, Any], input_dir: pathlib.Path, step: str) None[source]
_run_gromacs(cmd: list[str], cwd: pathlib.Path, log_prefix: str) None[source]
_read_trajectory(input_dir: pathlib.Path) mythos.simulators.io.SimulatorTrajectory[source]
_update_topology_params(input_dir: pathlib.Path, params: dict[str, Any]) None[source]