mythos.simulators.oxdna
oxDNA simulator module.
Submodules
Attributes
Classes
A sampler base on running an oxDNA simulation. |
Functions
|
Guess the location of a binary. |
Package Contents
- mythos.simulators.oxdna.CMAKE_BIN_ENV_VAR = 'CMAKE_BIN_PATH'
- mythos.simulators.oxdna.ERR_BUILD_SETUP_FAILED = 'OXDNA build setup failed wiht return code: {}'
- mythos.simulators.oxdna.ERR_INPUT_FILE_NOT_FOUND = 'Input file not found: {}'
- mythos.simulators.oxdna.ERR_MISSING_REQUIRED_KEYS = 'Missing required keys: {}'
- mythos.simulators.oxdna.MAKE_BIN_ENV_VAR = 'MAKE_BIN_PATH'
- mythos.simulators.oxdna._guess_binary_location(bin_name: str, env_var: str) pathlib.Path | None[source]
Guess the location of a binary.
- class mythos.simulators.oxdna.oxDNASimulator[source]
Bases:
mythos.simulators.base.InputDirSimulatorA sampler base on running an oxDNA simulation.
This simulator runs an oxDNA simulation in a subprocess, first compiling oxDNA from source with the provided parameters, or by using a precompiled binary (in the case parameter updates are not desired).
- Parameters:
input_dir – Path to the directory containing the oxDNA input file.
sim_type – The type of oxDNA simulation to run.
energy_fn – The energy function to use for default parameter updates.
n_build_threads – Number of threads to use when building oxDNA from source.
logger_config – Configuration for the logger.
binary_path – Path to a precompiled oxDNA binary to use. This is mutually exclusive with source_path. When provided, the binary will be called and no recompilation will be performed. In such a case, parameters cannot be updated, and if supplied to the run will result in an error unless ignore_params is set to True.
source_path – Path to the oxDNA source code to compile. Updating parameters in this simulator requires compiling oxDNA from source with the parameters built into the object code.
ignore_params – Whether to ignore provided parameters when running the simulation. This argument is required to be True if there is no source_path set and parameters are passed.
overwrite_input – Whether to overwrite the input directory or copy it. If this is False (default), the contents of the input_dir will be copied to a temporary directory for running the simulation to avoid overwriting input.
input_overrides – Key-value pairs to override in the input file. The values accept scalar values that can be converted to str. For example: {“T”: “275K”, “steps”: 10000}. WARNING: no validation is performed on the provided key-value pairs.
- sim_type: mythos.utils.types.oxDNASimulatorType
- energy_fn: mythos.energy.base.EnergyFunction
- binary_path: pathlib.Path | None = None
- source_path: pathlib.Path | None = None
- with_cached_build(binary_path: pathlib.Path) None[source]
Switch to use a precompiled binary.
This may be useful when running on a cluster with a shared file system, or running on a single machine, particularly in cases where:
N_simulators * n_build_threads > N_cpu_cores.
Caution: the user is responsible for ensuring that the binary at provided path is pre-built for the appropriate parameter set, there is no check performed at simulation run-time to verify this.
- run_simulation(input_dir: pathlib.Path, opt_params: mythos.utils.types.Params | None = None, seed: float | None = None, **_) mythos.simulators.base.SimulatorOutput[source]
Run an oxDNA simulation.
- _read_trajectory(input_dir: pathlib.Path) mythos.simulators.io.SimulatorTrajectory[source]