mythos.input.oxdna_input

oxDNA input file parser.

Attributes

INVALID_DICT_LINE

Classes

oxDNAInputData

Data loaded from an oxDNA input directory.

Functions

_parse_numeric(→ tuple[float | int, bool])

_parse_boolean(→ tuple[bool, bool])

_parse_value(→ str | float | int | bool)

_parse_dict(→ tuple[dict[str, ...)

read(→ dict[str, str | float | int | bool])

Read an oxDNA input file.

write_to(→ None)

Write an oxDNA input file.

read_box_size(→ jax.numpy.ndarray)

Read the box size from an oxDNA configuration file.

read_input_dir(→ oxDNAInputData)

Load topology, temperature and box size from an oxDNA input directory.

write(→ None)

Write an oxDNA input file.

Module Contents

mythos.input.oxdna_input.INVALID_DICT_LINE = 'Invalid dictionary line: {}'
mythos.input.oxdna_input._parse_numeric(value: str) tuple[float | int, bool][source]
mythos.input.oxdna_input._parse_boolean(value: str) tuple[bool, bool][source]
mythos.input.oxdna_input._parse_value(value: str) str | float | int | bool[source]
mythos.input.oxdna_input._parse_dict(in_line: str, lines: Iterable[str]) tuple[dict[str, str | float | int | bool], Iterable[str]][source]
mythos.input.oxdna_input.read(input_file: pathlib.Path) dict[str, str | float | int | bool][source]

Read an oxDNA input file.

mythos.input.oxdna_input.write_to(input_config: dict, f: io.TextIOWrapper) None[source]

Write an oxDNA input file.

mythos.input.oxdna_input.read_box_size(conf_file: pathlib.Path) jax.numpy.ndarray[source]

Read the box size from an oxDNA configuration file.

Parses the b = ... line from the configuration file header.

Parameters:

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.

class mythos.input.oxdna_input.oxDNAInputData[source]

Data loaded from an oxDNA input directory.

topology

The parsed topology.

kT

The simulation temperature in oxDNA energy units.

box_size

Box dimensions as a JAX array of shape (3,).

config

The full parsed input-file dictionary.

topology: mythos.input.topology.Topology
kT: float
box_size: jax.numpy.ndarray
config: dict[str, Any]
mythos.input.oxdna_input.read_input_dir(input_dir: pathlib.Path, input_file: str = 'input') oxDNAInputData[source]

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.

Parameters:
  • input_dir – Directory containing the oxDNA input files.

  • input_file – Name of the input file inside input_dir.

Returns:

An oxDNAInputData with the parsed values.

mythos.input.oxdna_input.write(input_config: dict, input_file: pathlib.Path) None[source]

Write an oxDNA input file.