mythos.simulators.oxdna.utils

Utilities for the oxDNA simulator.

Attributes

ERR_CANNOT_PROCESS_SRC_H

ERR_INVALID_HEADER_TYPE

SYMPY_EVAL_N

DEFAULT_OXDNA_VARIABLE_MAPPER

MIN_VALID_HEADER_TOKEN_COUNT

Functions

_parse_value_in(→ int | float | str)

_parse_value_out(→ str)

read_src_h(→ dict[str, int | float | str])

Parse the src/model.h file to get the parameters.

write_src_h(→ None)

Write the src/model.h file with the new parameters.

update_params(→ None)

Update the src/model.h file with the new parameters.

_get_order_parameter_names(→ list[str])

read_energy(→ pandas.DataFrame)

Read the energy.dat file from an oxDNA simulation.

read_output_trajectory(...)

Read trajectory from an oxDNA input directory.

read_last_hist(→ pandas.DataFrame)

Read the last histogram from an oxDNA simulation with umbrella sampling.

Module Contents

mythos.simulators.oxdna.utils.ERR_CANNOT_PROCESS_SRC_H = 'Cannot process src/model.h file. Failed parsing: {}'
mythos.simulators.oxdna.utils.ERR_INVALID_HEADER_TYPE = 'Invalid header value variable {} with value {}'
mythos.simulators.oxdna.utils.SYMPY_EVAL_N: int = 32
mythos.simulators.oxdna.utils.DEFAULT_OXDNA_VARIABLE_MAPPER
mythos.simulators.oxdna.utils.MIN_VALID_HEADER_TOKEN_COUNT = 3
mythos.simulators.oxdna.utils._parse_value_in(value: str) int | float | str[source]
mythos.simulators.oxdna.utils._parse_value_out(value: int | float | str) str[source]
mythos.simulators.oxdna.utils.read_src_h(src_h: pathlib.Path) dict[str, int | float | str][source]

Parse the src/model.h file to get the parameters.

mythos.simulators.oxdna.utils.write_src_h(src_h: pathlib.Path, params: dict[str, tuple[mythos.utils.types.oxDNAModelHType, int | float | str]]) None[source]

Write the src/model.h file with the new parameters.

mythos.simulators.oxdna.utils.update_params(src_h: pathlib.Path, new_params: mythos.utils.types.Params | list[mythos.utils.types.Params]) None[source]

Update the src/model.h file with the new parameters.

mythos.simulators.oxdna.utils._get_order_parameter_names(op_file: pathlib.Path) list[str][source]
mythos.simulators.oxdna.utils.read_energy(simulation_dir: pathlib.Path) pandas.DataFrame[source]

Read the energy.dat file from an oxDNA simulation.

Parameters:

simulation_dir – Path to the simulation directory containing the energy.dat and other simulation files. this directory must also contain the input file, which is read to determine the shape of the energy file.

Returns:

A pandas DataFrame containing the energy data. When umbrella sampling is enabled, the order parameter columns and weight column are also included, where the order parameter name comes from the “order_parameter” specification in the “op_file”.

mythos.simulators.oxdna.utils.read_output_trajectory(input_file: mythos.utils.types.PathOrStr) mythos.input.trajectory.Trajectory[source]

Read trajectory from an oxDNA input directory.

This is a convenience function that reads the topology and trajectory files from an oxDNA input directory to determine the correct read format.

Parameters:

input_file (PathOrStr) – path to the oxDNA input file.

mythos.simulators.oxdna.utils.read_last_hist(simulation_dir: pathlib.Path) pandas.DataFrame[source]

Read the last histogram from an oxDNA simulation with umbrella sampling.

Parameters:

simulation_dir – Path to the simulation directory containing the histograms and other simulation files. this directory must also contain the input file, which is read to determine the shape of the histogram file.

Returns:

A pandas DataFrame containing the last histogram data. The columns correspond to the order parameters specified in the “op_file”, as well as the counts and unbiased counts, and any extrapolation temperatures specified in the input file’s extrapolate_hist parameter.