mythos.simulators.oxdna ======================= .. py:module:: mythos.simulators.oxdna .. autoapi-nested-parse:: oxDNA simulator module. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/mythos/simulators/oxdna/oxdna/index /autoapi/mythos/simulators/oxdna/utils/index Attributes ---------- .. autoapisummary:: mythos.simulators.oxdna.CMAKE_BIN_ENV_VAR mythos.simulators.oxdna.ERR_BUILD_SETUP_FAILED mythos.simulators.oxdna.ERR_INPUT_FILE_NOT_FOUND mythos.simulators.oxdna.ERR_MISSING_REQUIRED_KEYS mythos.simulators.oxdna.MAKE_BIN_ENV_VAR Classes ------- .. autoapisummary:: mythos.simulators.oxdna.UmbrellaEnergyInfo mythos.simulators.oxdna.oxDNASimulator mythos.simulators.oxdna.oxDNAUmbrellaSampler Functions --------- .. autoapisummary:: mythos.simulators.oxdna._guess_binary_location Package Contents ---------------- .. py:data:: CMAKE_BIN_ENV_VAR :value: 'CMAKE_BIN_PATH' .. py:data:: ERR_BUILD_SETUP_FAILED :value: 'OXDNA build setup failed wiht return code: {}' .. py:data:: ERR_INPUT_FILE_NOT_FOUND :value: 'Input file not found: {}' .. py:data:: ERR_MISSING_REQUIRED_KEYS :value: 'Missing required keys: {}' .. py:data:: MAKE_BIN_ENV_VAR :value: 'MAKE_BIN_PATH' .. py:class:: UmbrellaEnergyInfo(data=None, index: pandas._typing.Axes | None = None, columns: pandas._typing.Axes | None = None, dtype: pandas._typing.Dtype | None = None, copy: bool | None = None) Bases: :py:obj:`pandas.DataFrame` Wraps a DataFrame of energy values to enable filtering by type. .. py:function:: _guess_binary_location(bin_name: str, env_var: str) -> pathlib.Path | None Guess the location of a binary. .. py:class:: oxDNASimulator Bases: :py:obj:`mythos.simulators.base.InputDirSimulator` A 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). :param input_dir: Path to the directory containing the oxDNA input file. :param energy_fn: The energy function to use for default parameter updates. :param n_build_threads: Number of threads to use when building oxDNA from source. :param logger_config: Configuration for the logger. :param 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. :param 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. :param 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. :param 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. :param 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. .. py:attribute:: energy_fn :type: mythos.energy.base.EnergyFunction .. py:attribute:: n_build_threads :type: int :value: 4 .. py:attribute:: logger_config :type: dict[str, Any] | None :value: None .. py:attribute:: binary_path :type: pathlib.Path | None :value: None .. py:attribute:: source_path :type: pathlib.Path | None :value: None .. py:attribute:: ignore_params :type: bool :value: False .. py:attribute:: input_overrides :type: dict[str, Any] .. py:method:: __post_init__(*args, **kwds) -> None Check the validity of the configuration. .. py:method:: with_cached_build(binary_path: pathlib.Path) -> None 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. .. py:method:: run_simulation(input_dir: pathlib.Path, opt_params: mythos.utils.types.Params | None = None, seed: float | None = None, **_) -> mythos.simulators.base.SimulatorOutput Run the simulation in the given input directory. .. py:method:: _read_trajectory(input_dir: pathlib.Path) -> mythos.simulators.io.SimulatorTrajectory .. py:method:: build(*, input_dir: pathlib.Path, new_params: mythos.utils.types.Params, input_config: dict | None = None) -> None Update the simulation. This function will recompile the oxDNA binary with the new parameters. .. py:class:: oxDNAUmbrellaSampler Bases: :py:obj:`oxDNASimulator` An oxDNA sampler for umbrella sampling simulations. This simulator extends the oxDNASimulator to handle extra data related to umbrella sampling. The input directory must be setup for umbrella sampling with the appropriate configurations, including order parameters and weights file, among other relevant settings. Based on the last histogram written by oxDNA, the simulator will compute a reweighted set of weights in the "weight" key of the output state, which can be passed back in on subsequent runs. The run method takes optional weights DataFrame to use for reweighting. If provided, this will overwrite the weights file in the input directory before running the simulation. The dataframe will be written space-separated without a header, but otherwise unmodified. Ensure it has the appropriate fields and order. .. py:attribute:: exposed_observables :type: ClassVar[list[str]] :value: ['trajectory', 'energy_info'] .. py:method:: __post_init__(*args, **kwds) -> None Check the validity of the configuration. .. py:method:: run_simulation(input_dir: pathlib.Path, opt_params: mythos.utils.types.Params | None = None, weights: pandas.DataFrame | None = None, **kwargs) -> mythos.simulators.base.SimulatorOutput Run the simulation in the given input directory.