HDF5Writer¶
-
class
narupatools.frame.hdf5.writer.HDF5Writer(filename: str, *, title: Optional[str] = None, author: Optional[str] = None, overwrite_existing: bool = False)¶ Writer for HDF5 trajectory containing interactive forces.
Inheritance

Methods
Initialize self.
Close the file being written to.
Save an IMD interaction to the trajectory.
Mark an interaction as having finished.
Reopen a writer for a different file, discarding the old state.
Save a trajectory frame.
Save an IMD interaction to the trajectory.
Save the topology of the given frame to the file.
-
__init__(filename: str, *, title: Optional[str] = None, author: Optional[str] = None, overwrite_existing: bool = False)¶ Initialize self. See help(type(self)) for accurate signature.
-
create_interaction(*, key: str, interaction: narupa.imd.particle_interaction.ParticleInteraction, frame_index: int, potential_energy: Optional[float] = None, forces: Optional[numpy.ndarray] = None) → None¶ Save an IMD interaction to the trajectory.
- Parameters
frame_index – Index of the frame in the main trajectory this interaction corresponds to.
key – Unique key of interaction.
interaction – Interaction to save.
potential_energy – Potential energy of interaction in kilojoules per mole.
forces – Forces on affected atoms in kilojoules per mole per nanometer.
-
end_interaction(*, key: str, frame_index: int) → None¶ Mark an interaction as having finished.
- Parameters
key – Key of the interaction.
frame_index – Current frame of the simulation.
-
reopen(filename: str, *, title: Optional[str] = None, author: Optional[str] = None) → None¶ Reopen a writer for a different file, discarding the old state.
This closes the previous file.
- Parameters
filename – Name of the file to write to.
title – Title to add to the trajectory.
author – Name of the author.
-
save_frame(*, coordinates: numpy.ndarray, time: float, potential_energy: float, kinetic_energy: float, velocities: Optional[numpy.ndarray] = None, forces: Optional[numpy.ndarray] = None) → None¶ Save a trajectory frame.
- Parameters
coordinates – Atomic coordinates in nanometers.
velocities – Atomic velocities in nanometers per picoseconds.
time – Time in picoseconds.
potential_energy – Potential energy in kilojoules per mole.
kinetic_energy – Kinetic energy in kilojoules per mole.
forces – Atomic forces in kilojoules per mole per nanometer.
-
save_interaction(*, key: str, interaction: narupa.imd.particle_interaction.ParticleInteraction, frame_index: int, potential_energy: Optional[float] = None, forces: Optional[numpy.ndarray] = None) → None¶ Save an IMD interaction to the trajectory.
- Parameters
frame_index – Index of the frame in the main trajectory this interaction corresponds to.
key – Unique key of interaction.
interaction – Interaction to save.
potential_energy – Potential energy of interaction in kilojoules per mole.
forces – Forces on affected atoms in kilojoules per mole per nanometer.
-
save_topology(frame: narupa.trajectory.frame_data.FrameData) → None¶ Save the topology of the given frame to the file.
- Parameters
frame – Frame to get topology from.
Attributes
Array of atom coordinates in nanometers.
Array of forces in kilojoules per mole per nanometer.
Group containing interactions.
Array of kinetic energies in kilojoules per mole.
Array of potential energies in kilojoules per mole.
Array of real times in seconds since the first frame.
Array of frame times in picoseconds.
Array of atom velocities in nanometers per picoseconds.
-
coordinates¶ Array of atom coordinates in nanometers.
-
forces¶ Array of forces in kilojoules per mole per nanometer.
-
interactions¶ Group containing interactions.
-
kinetic_energy¶ Array of kinetic energies in kilojoules per mole.
-
potential_energy¶ Array of potential energies in kilojoules per mole.
-
realtime¶ Array of real times in seconds since the first frame.
-
time¶ Array of frame times in picoseconds.
-
velocities¶ Array of atom velocities in nanometers per picoseconds.
-