mythos.input.trajectory

Trajectory information for RNA/DNA strands.

Attributes

TRAJECTORY_TIMES_DIMS

TRAJECTORY_ENERGIES_SHAPE

NUCLEOTIDE_STATE_SHAPE

ERR_TRAJECTORY_FILE_NOT_FOUND

ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS

ERR_TRAJECTORY_TIMES_TYPE

ERR_TRAJECTORY_ENERGIES_TYPE

ERR_TRAJECTORY_T_E_S_LENGTHS

ERR_TRAJECTORY_TIMES_DIMS

ERR_TRAJECTORY_ENERGIES_SHAPE

ERR_NUCLEOTIDE_STATE_TYPE

ERR_NUCLEOTIDE_STATE_SHAPE

ERR_FIXED_BOX_SIZE

RawTrajectory

Classes

Trajectory

Trajectory information for a RNA/DNA strand.

NucleotideState

State information for the nucleotides in a single state.

Functions

validate_box_size(→ None)

Validate the volume for a simulation is fixed.

from_file(→ Trajectory)

Parse a trajectory file.

_read_parallel(→ RawTrajectory)

_read_file_process_wrapper(→ RawTrajectory)

Wrapper for reading a trajectory file.

_read_file(→ RawTrajectory)

Read a trajectory file object.

_write_state() → None)

Module Contents

mythos.input.trajectory.TRAJECTORY_TIMES_DIMS = 1
mythos.input.trajectory.TRAJECTORY_ENERGIES_SHAPE = (None, 3)
mythos.input.trajectory.NUCLEOTIDE_STATE_SHAPE = (None, 15)
mythos.input.trajectory.ERR_TRAJECTORY_FILE_NOT_FOUND = 'Trajectory file not found: {}'
mythos.input.trajectory.ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS = 'n_nucleotides and sum(strand_lengths) do not match'
mythos.input.trajectory.ERR_TRAJECTORY_TIMES_TYPE = 'times must be a numpy array'
mythos.input.trajectory.ERR_TRAJECTORY_ENERGIES_TYPE = 'energies must be a numpy array'
mythos.input.trajectory.ERR_TRAJECTORY_T_E_S_LENGTHS = 'times, energies, and states do not have the same length'
mythos.input.trajectory.ERR_TRAJECTORY_TIMES_DIMS = 'times must be a 1D array'
mythos.input.trajectory.ERR_TRAJECTORY_ENERGIES_SHAPE = 'energies must be a 2D array with shape (n_states, 3)'
mythos.input.trajectory.ERR_NUCLEOTIDE_STATE_TYPE = 'Invalid type for nucleotide states:'
mythos.input.trajectory.ERR_NUCLEOTIDE_STATE_SHAPE = 'Invalid shape for nucleotide states:'
mythos.input.trajectory.ERR_FIXED_BOX_SIZE = 'Only trajecories in a fixed box size are supported'
type mythos.input.trajectory.RawTrajectory = tuple[list[typ.Scalar], list[typ.Vector3D], list[typ.Vector3D], list[typ.Arr_Nucleotide_15]]
class mythos.input.trajectory.Trajectory[source]

Trajectory information for a RNA/DNA strand.

n_nucleotides: int
strand_lengths: list[int]
times: mythos.utils.types.Arr_States
energies: mythos.utils.types.Arr_States_3
states: list[NucleotideState]
box_size: mythos.utils.types.Vector3D | None = None
__post_init__() None[source]

Validate the input.

property state_rigid_bodies: list[jax_md.rigid_body.RigidBody]

Convert the states to a list of rigid bodies.

property state_rigid_body: jax_md.rigid_body.RigidBody

Convert the states to a single rigid body.

slice(key: int | slice) Trajectory[source]

Get a subset of the trajectory.

__repr__() str[source]

Return a string representation of the trajectory.

to_file(filepath: pathlib.Path) None[source]

Write a jaxDNA simulation trajectory to oxDNA file format.

In cases where the box_size is not specified, it will be written as “0 0 0”.

class mythos.input.trajectory.NucleotideState[source]

State information for the nucleotides in a single state.

array: mythos.utils.types.Arr_Nucleotide_15
__post_init__() None[source]

Validate the input array.

property com: mythos.utils.types.Arr_Nucleotide_3

Center of mass of the nucleotides.

property back_base_vector: mythos.utils.types.Arr_Nucleotide_3

Backbone base vector.

property base_normal: mythos.utils.types.Arr_Nucleotide_3

Base normal to the base plane.

property velocity: mythos.utils.types.Arr_Nucleotide_3

Velocity of the nucleotides.

property angular_velocity: mythos.utils.types.Arr_Nucleotide_3

Angular velocity of the nucleotides.

property euler_angles: tuple[mythos.utils.types.Arr_Nucleotide, mythos.utils.types.Arr_Nucleotide, mythos.utils.types.Arr_Nucleotide]

Convert principal axes to Tait-Bryan Euler angles.

property quaternions: mythos.utils.types.Arr_Nucleotide_4

Convert Euler angles to quaternions.

to_rigid_body() jax_md.rigid_body.RigidBody[source]

Convert the nucleotide state to jax-md rigid bodies.

mythos.input.trajectory.validate_box_size(state_box_sizes: list[mythos.utils.types.Vector3D]) None[source]

Validate the volume for a simulation is fixed.

mythos.input.trajectory.from_file(path: mythos.utils.types.PathOrStr, strand_lengths: list[int], *, is_5p_3p: bool = True, n_processes: int = 1) Trajectory[source]

Parse a trajectory file.

Trajectory files are in the following format: t = number b = number number number E = number number number com_x com_y com_z a1_x a1_y a1_z a3_x a3_y a3_z v_x v_y v_z L_x L_y L_z …repeated n_nucleotides times in total com_x com_y com_z a1_x a1_y a1_z a3_x a3_y a3_z v_x v_y v_z L_x L_y L_z

where the com_x, …, L_z are all floating point numbers.

This can be repeated a total of “timestep” number of times.

In oxDNA the states are stored in 3’->5’ in the original format. We use that format for the internal memory layout. When the new oxdna topology format is used, it will write in 5’->3’ order, and thus we must reverse the order per strand.

Parameters:
  • path (PathOrStr) – path to the trajectory file

  • strand_lengths (list[int]) – if this is an oxDNA trajectory, the lengths of each strand, so that they can be flipped to 5’->3’ order

  • is_5p_3p (bool) – whether the trajectory is in 5’->3’ format (for example if the topology file used in oxdna standalone is in the new oxdna format)

  • n_processes (int) – number of processors to use for reading the file

Returns:

trajectory information

Return type:

Trajectory

mythos.input.trajectory._read_parallel(path: pathlib.Path, strand_lengths: list[int], *, is_5p_3p: bool, n_processes: int) RawTrajectory[source]
mythos.input.trajectory._read_file_process_wrapper(args: tuple[pathlib.Path, int, int, list[int], bool]) RawTrajectory[source]

Wrapper for reading a trajectory file.

mythos.input.trajectory._read_file(file_path: pathlib.Path, start: int, end: int, strand_lengths: list[int], *, is_5p_3p: bool) RawTrajectory[source]

Read a trajectory file object.

mythos.input.trajectory._write_state(file: TextIO, time: float, energies: mythos.utils.types.Vector3D, state: mythos.utils.types.Arr_Nucleotide_15, box_size: mythos.utils.types.Vector3D = (0, 0, 0)) None[source]