WriteTrajectory
This type represents a trajectory on disk for writing.
It is used to write snapshots of the molecular system (MDFrame objects) to files on disk.
MolecularDynamicsFiles.WriteTrajectory — Typemutable struct WriteTrajectoryRepresents a molecular dynamics trajectory being written to disk.
A trajectory consists of a set of states of a molecular simulation. This structure allows for writing frames into a trajectory sequentially.
Fields
format: trajectory file formatexported_particle_properties: particle properties written into trajectoryfilepath: path to trajectory (filename may contain mask '*')io: current output file streamisopen: trajectory is open flag
MolecularDynamicsFiles.WriteTrajectory — MethodWriteTrajectory(
filepath::String,
format::MolecularDynamicsFiles.Format.T,
exported_particle_properties::Vector{Symbol}
) -> WriteTrajectory
Create a WriteTrajectory with trajectory files specified by filepath, of format format, writing exported_particle_properties.
All the snapshots (MDFrame objects) may be written to a single file, in this case snapshot data will be written one after another in the file.
Alternatively, every frame may be written in a separate file: if the filename of filepath contains a single wildcard symbol "*", representing a mask. In this case, every frame is written in a separate file with the timestep of the frame in place of the mask.
If filename of filepath ends with ".gz", files are written in GZip format.
exported_particle_properties may contain properties defined in the frame, and also properties: :x, :y, :z, :xs, :ys, :zs, :xu, :yu, :zu, :xsu, :ysu, :zsu, :ix, :iy, :iz if they can be computed from the frame data. For example, if a frame has unwrapped positions, all of those properties can be computed.
Base.write — MethodBase.write(t::WriteTrajectory, frame::MDFrame)Write a frame to a trajectory.
Base.close — MethodBase.close(t::WriteTrajectory)Close the trajectory.
Must be called after finishing writing the trajectory to ensure that all data has been written.