mythos.simulators.io ==================== .. py:module:: mythos.simulators.io .. autoapi-nested-parse:: Common data structures for simulator I/O. Classes ------- .. autoapisummary:: mythos.simulators.io.SimulatorTrajectory Module Contents --------------- .. py:class:: SimulatorTrajectory A trajectory of a simulation run. .. py:attribute:: rigid_body :type: jax_md.rigid_body.RigidBody .. py:attribute:: metadata :type: jax.numpy.ndarray | None :value: None .. py:method:: __post_init__() -> None .. py:method:: with_state_metadata(metadata: Any) -> SimulatorTrajectory Set the same metadata for all states in the trajectory. .. py:method:: filter(filter_fn: collections.abc.Callable[[Any], bool]) -> SimulatorTrajectory Filter the trajectory based on metadata. :param filter_fn: A function that takes in metadata and returns a boolean indicating whether to keep the state. :returns: A new SimulatorTrajectory with only the states that pass the filter. .. py:method:: slice(key: int | slice | jax.numpy.ndarray | list) -> SimulatorTrajectory Slice the trajectory. .. py:method:: length() -> int Return the length of the trajectory. Note, that this may have been more natural to implement as the built-in __len__ method. However, the chex.dataclass decorator overrides that method to be compatabile with the abc.Mapping interface See here: https://github.com/google-deepmind/chex/blob/8af2c9e8a19f3a57d9bd283c2a34148aef952f60/chex/_src/dataclass.py#L50 .. py:method:: __add__(other: SimulatorTrajectory) -> SimulatorTrajectory Concatenate two trajectories. .. py:method:: to_file(filepath: pathlib.Path, box_size: mythos.utils.types.Vector3D = (0, 0, 0)) -> None Write the trajectory to an oxDNA file. Note that the SimulatorTrajectory does not store several of the fields necessary to fully reconstruct an oxDNA trajectory file (e.g. times, box size, velocities, angular momenta, and energies). Thus, times are filled with a monotonic sequence, while the rest of these fields are filled with 0's. The resultant file can be used for inspection and visualization of non-time-dependent state-by-state spatial information only. :param filepath: The path to write the trajectory file to. :param box_size: The box size in 3 dimensions to write to the file. defaults to (0,0,0).