[]Struct lumol::sys::Trajectory

pub struct Trajectory(_);

A Trajectory is a file containing one or more successive simulation steps.

One should use the TrajectoryBuilder to create a new trajectory.

Examples

let mut trajectory = TrajectoryBuilder::new()
    .open("file.xyz")
    .unwrap();

let system = trajectory.read().unwrap();

Methods

impl Trajectory

pub fn read(&mut self) -> Result<System, Error>

Read the next step of the trajectory

Examples

let mut trajectory = TrajectoryBuilder::new()
    .open("file.nc")
    .unwrap();

let system = trajectory.read().unwrap();

pub fn read_guess_bonds(&mut self) -> Result<System, Error>

Read the next step of the trajectory, and guess the bonds of the resulting [System][struct.System.html].

Examples

let mut trajectory = TrajectoryBuilder::new()
    .open("file.nc")
    .unwrap();

let system = trajectory.read_guess_bonds().unwrap();

pub fn write(&mut self, system: &System) -> Result<(), Error>

Write the system to the trajectory.

Examples

let mut trajectory = TrajectoryBuilder::new()
    .mode(OpenMode::Write)
    .open("file.xyz")
    .unwrap();

trajectory.write(&system).unwrap();

pub fn set_cell(&mut self, cell: &UnitCell)

Set the unit cell associated with a trajectory. This cell will be used when reading and writing the files, replacing any unit cell in the frames or files.

Examples

let mut trajectory = TrajectoryBuilder::new()
    .open("file.xyz")
    .unwrap();

trajectory.set_cell(&UnitCell::cubic(10.0));
let system = trajectory.read().unwrap();

assert_eq!(system.cell, UnitCell::cubic(10.0));

pub fn set_topology_file(&mut self, path: &str) -> Result<(), Error>

Set the topology associated with this trajectory by reading the first frame of the file at the given path and extracting the topology of this frame. This topology will be used to replace any existing topology when reading or writing with this trajectory.

Examples

let mut trajectory = TrajectoryBuilder::new()
    .open("file.xyz")
    .unwrap();

trajectory.set_topology_file("topology.pdb").unwrap();
// The system will contain the topology from topology.pdb
let system = trajectory.read().unwrap();

Auto Trait Implementations

impl !Send for Trajectory

impl !Sync for Trajectory

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]