mythos.simulators.oxdna.utils ============================= .. py:module:: mythos.simulators.oxdna.utils .. autoapi-nested-parse:: Utilities for the oxDNA simulator. Attributes ---------- .. autoapisummary:: mythos.simulators.oxdna.utils.ERR_CANNOT_PROCESS_SRC_H mythos.simulators.oxdna.utils.ERR_INVALID_HEADER_TYPE mythos.simulators.oxdna.utils.SYMPY_EVAL_N mythos.simulators.oxdna.utils.DEFAULT_OXDNA_VARIABLE_MAPPER mythos.simulators.oxdna.utils.MIN_VALID_HEADER_TOKEN_COUNT Functions --------- .. autoapisummary:: mythos.simulators.oxdna.utils._parse_value_in mythos.simulators.oxdna.utils._parse_value_out mythos.simulators.oxdna.utils.read_src_h mythos.simulators.oxdna.utils.write_src_h mythos.simulators.oxdna.utils.update_params mythos.simulators.oxdna.utils._get_order_parameter_names mythos.simulators.oxdna.utils.read_energy mythos.simulators.oxdna.utils.read_output_trajectory mythos.simulators.oxdna.utils.read_last_hist Module Contents --------------- .. py:data:: ERR_CANNOT_PROCESS_SRC_H :value: 'Cannot process src/model.h file. Failed parsing: {}' .. py:data:: ERR_INVALID_HEADER_TYPE :value: 'Invalid header value variable {} with value {}' .. py:data:: SYMPY_EVAL_N :type: int :value: 32 .. py:data:: DEFAULT_OXDNA_VARIABLE_MAPPER .. py:data:: MIN_VALID_HEADER_TOKEN_COUNT :value: 3 .. py:function:: _parse_value_in(value: str) -> int | float | str .. py:function:: _parse_value_out(value: int | float | str) -> str .. py:function:: read_src_h(src_h: pathlib.Path) -> dict[str, int | float | str] Parse the src/model.h file to get the parameters. .. py:function:: write_src_h(src_h: pathlib.Path, params: dict[str, tuple[mythos.utils.types.oxDNAModelHType, int | float | str]]) -> None Write the src/model.h file with the new parameters. .. py:function:: update_params(src_h: pathlib.Path, new_params: mythos.utils.types.Params | list[mythos.utils.types.Params]) -> None Update the src/model.h file with the new parameters. .. py:function:: _get_order_parameter_names(op_file: pathlib.Path) -> list[str] .. py:function:: read_energy(simulation_dir: pathlib.Path) -> pandas.DataFrame Read the energy.dat file from an oxDNA simulation. :param 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". .. py:function:: read_output_trajectory(input_file: mythos.utils.types.PathOrStr) -> mythos.input.trajectory.Trajectory 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. :param input_file: path to the oxDNA input file. :type input_file: PathOrStr .. py:function:: read_last_hist(simulation_dir: pathlib.Path) -> pandas.DataFrame Read the last histogram from an oxDNA simulation with umbrella sampling. :param 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.