mythos.input.trajectory ======================= .. py:module:: mythos.input.trajectory .. autoapi-nested-parse:: Trajectory information for RNA/DNA strands. Attributes ---------- .. autoapisummary:: mythos.input.trajectory.TRAJECTORY_TIMES_DIMS mythos.input.trajectory.TRAJECTORY_ENERGIES_SHAPE mythos.input.trajectory.NUCLEOTIDE_STATE_SHAPE mythos.input.trajectory.ERR_TRAJECTORY_FILE_NOT_FOUND mythos.input.trajectory.ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS mythos.input.trajectory.ERR_TRAJECTORY_TIMES_TYPE mythos.input.trajectory.ERR_TRAJECTORY_ENERGIES_TYPE mythos.input.trajectory.ERR_TRAJECTORY_T_E_S_LENGTHS mythos.input.trajectory.ERR_TRAJECTORY_TIMES_DIMS mythos.input.trajectory.ERR_TRAJECTORY_ENERGIES_SHAPE mythos.input.trajectory.ERR_NUCLEOTIDE_STATE_TYPE mythos.input.trajectory.ERR_NUCLEOTIDE_STATE_SHAPE mythos.input.trajectory.ERR_FIXED_BOX_SIZE mythos.input.trajectory.RawTrajectory Classes ------- .. autoapisummary:: mythos.input.trajectory.Trajectory mythos.input.trajectory.NucleotideState Functions --------- .. autoapisummary:: mythos.input.trajectory.validate_box_size mythos.input.trajectory.from_file mythos.input.trajectory._read_parallel mythos.input.trajectory._read_file_process_wrapper mythos.input.trajectory._read_file mythos.input.trajectory._write_state Module Contents --------------- .. py:data:: TRAJECTORY_TIMES_DIMS :value: 1 .. py:data:: TRAJECTORY_ENERGIES_SHAPE :value: (None, 3) .. py:data:: NUCLEOTIDE_STATE_SHAPE :value: (None, 15) .. py:data:: ERR_TRAJECTORY_FILE_NOT_FOUND :value: 'Trajectory file not found: {}' .. py:data:: ERR_TRAJECTORY_N_NUCLEOTIDE_STRAND_LEGNTHS :value: 'n_nucleotides and sum(strand_lengths) do not match' .. py:data:: ERR_TRAJECTORY_TIMES_TYPE :value: 'times must be a numpy array' .. py:data:: ERR_TRAJECTORY_ENERGIES_TYPE :value: 'energies must be a numpy array' .. py:data:: ERR_TRAJECTORY_T_E_S_LENGTHS :value: 'times, energies, and states do not have the same length' .. py:data:: ERR_TRAJECTORY_TIMES_DIMS :value: 'times must be a 1D array' .. py:data:: ERR_TRAJECTORY_ENERGIES_SHAPE :value: 'energies must be a 2D array with shape (n_states, 3)' .. py:data:: ERR_NUCLEOTIDE_STATE_TYPE :value: 'Invalid type for nucleotide states:' .. py:data:: ERR_NUCLEOTIDE_STATE_SHAPE :value: 'Invalid shape for nucleotide states:' .. py:data:: ERR_FIXED_BOX_SIZE :value: 'Only trajecories in a fixed box size are supported' .. py:type:: RawTrajectory :canonical: tuple[list[typ.Scalar], list[typ.Vector3D], list[typ.Vector3D], list[typ.Arr_Nucleotide_15]] .. py:class:: Trajectory Trajectory information for a RNA/DNA strand. .. py:attribute:: n_nucleotides :type: int .. py:attribute:: strand_lengths :type: list[int] .. py:attribute:: times :type: mythos.utils.types.Arr_States .. py:attribute:: energies :type: mythos.utils.types.Arr_States_3 .. py:attribute:: states :type: list[NucleotideState] .. py:attribute:: box_size :type: mythos.utils.types.Vector3D | None :value: None .. py:method:: __post_init__() -> None Validate the input. .. py:property:: state_rigid_bodies :type: list[jax_md.rigid_body.RigidBody] Convert the states to a list of rigid bodies. .. py:property:: state_rigid_body :type: jax_md.rigid_body.RigidBody Convert the states to a single rigid body. .. py:method:: slice(key: int | slice) -> Trajectory Get a subset of the trajectory. .. py:method:: __repr__() -> str Return a string representation of the trajectory. .. py:method:: to_file(filepath: pathlib.Path) -> None 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". .. py:class:: NucleotideState State information for the nucleotides in a single state. .. py:attribute:: array :type: mythos.utils.types.Arr_Nucleotide_15 .. py:method:: __post_init__() -> None Validate the input array. .. py:property:: com :type: mythos.utils.types.Arr_Nucleotide_3 Center of mass of the nucleotides. .. py:property:: back_base_vector :type: mythos.utils.types.Arr_Nucleotide_3 Backbone base vector. .. py:property:: base_normal :type: mythos.utils.types.Arr_Nucleotide_3 Base normal to the base plane. .. py:property:: velocity :type: mythos.utils.types.Arr_Nucleotide_3 Velocity of the nucleotides. .. py:property:: angular_velocity :type: mythos.utils.types.Arr_Nucleotide_3 Angular velocity of the nucleotides. .. py:property:: euler_angles :type: tuple[mythos.utils.types.Arr_Nucleotide, mythos.utils.types.Arr_Nucleotide, mythos.utils.types.Arr_Nucleotide] Convert principal axes to Tait-Bryan Euler angles. .. py:property:: quaternions :type: mythos.utils.types.Arr_Nucleotide_4 Convert Euler angles to quaternions. .. py:method:: to_rigid_body() -> jax_md.rigid_body.RigidBody Convert the nucleotide state to jax-md rigid bodies. .. py:function:: validate_box_size(state_box_sizes: list[mythos.utils.types.Vector3D]) -> None Validate the volume for a simulation is fixed. .. py:function:: from_file(path: mythos.utils.types.PathOrStr, strand_lengths: list[int], *, is_5p_3p: bool = True, n_processes: int = 1) -> Trajectory 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. :param path: path to the trajectory file :type path: PathOrStr :param strand_lengths: if this is an oxDNA trajectory, the lengths of each strand, so that they can be flipped to 5'->3' order :type strand_lengths: list[int] :param is_5p_3p: whether the trajectory is in 5'->3' format (for example if the topology file used in oxdna standalone is in the new oxdna format) :type is_5p_3p: bool :param n_processes: number of processors to use for reading the file :type n_processes: int :returns: trajectory information :rtype: Trajectory .. py:function:: _read_parallel(path: pathlib.Path, strand_lengths: list[int], *, is_5p_3p: bool, n_processes: int) -> RawTrajectory .. py:function:: _read_file_process_wrapper(args: tuple[pathlib.Path, int, int, list[int], bool]) -> RawTrajectory Wrapper for reading a trajectory file. .. py:function:: _read_file(file_path: pathlib.Path, start: int, end: int, strand_lengths: list[int], *, is_5p_3p: bool) -> RawTrajectory Read a trajectory file object. .. py:function:: _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