mythos.input.oxdna_input ======================== .. py:module:: mythos.input.oxdna_input .. autoapi-nested-parse:: oxDNA input file parser. Attributes ---------- .. autoapisummary:: mythos.input.oxdna_input.INVALID_DICT_LINE Classes ------- .. autoapisummary:: mythos.input.oxdna_input.oxDNAInputData Functions --------- .. autoapisummary:: mythos.input.oxdna_input._parse_numeric mythos.input.oxdna_input._parse_boolean mythos.input.oxdna_input._parse_value mythos.input.oxdna_input._parse_dict mythos.input.oxdna_input.read mythos.input.oxdna_input.write_to mythos.input.oxdna_input.read_box_size mythos.input.oxdna_input.read_input_dir mythos.input.oxdna_input.write Module Contents --------------- .. py:data:: INVALID_DICT_LINE :value: 'Invalid dictionary line: {}' .. py:function:: _parse_numeric(value: str) -> tuple[float | int, bool] .. py:function:: _parse_boolean(value: str) -> tuple[bool, bool] .. py:function:: _parse_value(value: str) -> str | float | int | bool .. py:function:: _parse_dict(in_line: str, lines: Iterable[str]) -> tuple[dict[str, str | float | int | bool], Iterable[str]] .. py:function:: read(input_file: pathlib.Path) -> dict[str, str | float | int | bool] Read an oxDNA input file. .. py:function:: write_to(input_config: dict, f: io.TextIOWrapper) -> None Write an oxDNA input file. .. py:function:: read_box_size(conf_file: pathlib.Path) -> jax.numpy.ndarray Read the box size from an oxDNA configuration file. Parses the ``b = ...`` line from the configuration file header. :param conf_file: Path to the oxDNA configuration (``.conf`` / ``.dat``) file. :returns: A JAX array of shape ``(3,)`` with the box dimensions. :raises ValueError: If no ``b = ...`` line is found in the file. .. py:class:: oxDNAInputData Data loaded from an oxDNA input directory. .. attribute:: topology The parsed topology. .. attribute:: kT The simulation temperature in oxDNA energy units. .. attribute:: box_size Box dimensions as a JAX array of shape ``(3,)``. .. attribute:: config The full parsed input-file dictionary. .. py:attribute:: topology :type: mythos.input.topology.Topology .. py:attribute:: kT :type: float .. py:attribute:: box_size :type: jax.numpy.ndarray .. py:attribute:: config :type: dict[str, Any] .. py:function:: read_input_dir(input_dir: pathlib.Path, input_file: str = 'input') -> oxDNAInputData Load topology, temperature and box size from an oxDNA input directory. Reads the oxDNA ``input`` file (or the name given by *input_file*), extracts the topology, simulation temperature (``kT``), and box dimensions from the configuration files referenced therein. :param input_dir: Directory containing the oxDNA input files. :param input_file: Name of the input file inside *input_dir*. :returns: An :class:`oxDNAInputData` with the parsed values. .. py:function:: write(input_config: dict, input_file: pathlib.Path) -> None Write an oxDNA input file.