pub fn read_molecule<P: AsRef<Path>>(path: P) -> Result<Molecule, chemfiles::Error> {
    let mut trajectory = chemfiles::Trajectory::open(&path, 'r')?;
    let mut frame = chemfiles::Frame::new();
    trajectory.read(&mut frame)?;

    // Only guess the topology when we have no bond information
    if frame.topology().bonds_count() == 0 {
        frame.guess_bonds()?;
    }

    let system: System = frame.into();
    assert!(!system.is_empty(), "No molecule in the file at {}", path.as_ref().display());

    return Ok(system.molecule(0).to_owned());
}
/// Read a the first molecule from the file at `path`. If no bond information
/// exists in the file, bonds are guessed.
Read a the first molecule from the file at `path`. If no bond information
exists in the file, bonds are guessed.
Read a the first molecule from the file at ` path ` . If no bond information exists in the file bonds are guessed .
pub fn read_molecule<P: AsRef<Path>>(path: P) -> Result<Molecule, chemfiles::Error> {
    let mut trajectory = chemfiles::Trajectory::open(&path, 'r')?;
    let mut frame = chemfiles::Frame::new();
    trajectory.read(&mut frame)?;
    // Only guess the topology when we have no bond information
    if frame.topology().bonds_count() == 0 {
        frame.guess_bonds()?;
    }
    let system: System = frame.into();
    assert!(!system.is_empty(), "No molecule in the file at {}", path.as_ref().display());
    return Ok(system.molecule(0).to_owned());
}
pub fn read_molecule < P : AsRef < Path > > ( path : P ) -> Result < Molecule , chemfiles :: Error > { let mut trajectory = chemfiles :: Trajectory :: open ( & path , 'r' ) ? ; let mut frame = chemfiles :: Frame :: new ( ) ; trajectory . read ( & mut frame ) ? ; // Only guess the topology when we have no bond information if frame . topology ( ) . bonds_count ( ) == 0 { frame . guess_bonds ( ) ? ; } let system : System = frame . into ( ) ; assert ! ( system is_empty ( ) " " path as_ref ( ) display ( ) ) ; return Ok ( system . molecule ( 0 ) . to_owned ( ) ) ; }
Read a the first molecule from the file at `path`.
Read a the first molecule from the file at ` path ` .
path
P