pub struct DcdWriter {
pub path: PathBuf,
pub n_atoms: u32,
pub delta: f32,
/* private fields */
}Expand description
DCD trajectory writer — produces files in the standard CHARMM/NAMD binary
DCD format that can be read by DcdReader and common molecular dynamics
visualisation tools (VMD, NAMD, etc.).
§Usage
use oxiphysics_io::DcdWriter;
let mut w = DcdWriter::new("/tmp/traj.dcd", 10, 2.0e-3).unwrap();
// write frames …
w.finalize().unwrap(); // patches the frame count in the headerFields§
§path: PathBufOutput path.
n_atoms: u32Number of atoms per frame.
delta: f32Integration time-step (ps).
Implementations§
Source§impl DcdWriter
impl DcdWriter
Sourcepub fn new(path: impl Into<PathBuf>, n_atoms: u32, delta: f32) -> Result<Self>
pub fn new(path: impl Into<PathBuf>, n_atoms: u32, delta: f32) -> Result<Self>
Create a new DcdWriter, truncating / creating the output file and
writing an initial DCD header.
Sourcepub fn write_frame(&mut self, frame: &ParticleFrame) -> Result<()>
pub fn write_frame(&mut self, frame: &ParticleFrame) -> Result<()>
Append one coordinate frame to the DCD file.
The frame must contain at least n_atoms positions; extra positions are
silently ignored, missing ones are padded with 0.0.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DcdWriter
impl RefUnwindSafe for DcdWriter
impl Send for DcdWriter
impl Sync for DcdWriter
impl Unpin for DcdWriter
impl UnsafeUnpin for DcdWriter
impl UnwindSafe for DcdWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.