Broke out next_inner

This commit is contained in:
Josh Mitchell
2020-11-11 17:11:55 +11:00
parent 6d911fae0b
commit 53dd997129
3 changed files with 48 additions and 31 deletions

View File

@@ -216,9 +216,9 @@ impl Trajectory for XTCTrajectory {
fn read(&mut self, frame: &mut Frame) -> Result<()> {
let mut step: i32 = 0;
let num_atoms = self
.get_num_atoms()
.map_err(|e| Error::CouldNotCheckNAtoms(Box::new(e)))? as usize;
let num_atoms =
self.get_num_atoms()
.map_err(|e| Error::CheckNAtomsDuringRead(Box::new(e)))? as usize;
if num_atoms != frame.coords.len() {
Err((&*frame, num_atoms))?;
}
@@ -335,9 +335,9 @@ impl Trajectory for TRRTrajectory {
let mut step: i32 = 0;
let mut lambda: f32 = 0.0;
let num_atoms = self
.get_num_atoms()
.map_err(|e| Error::CouldNotCheckNAtoms(Box::new(e)))? as usize;
let num_atoms =
self.get_num_atoms()
.map_err(|e| Error::CheckNAtomsDuringRead(Box::new(e)))? as usize;
if num_atoms != frame.coords.len() {
Err((&*frame, num_atoms))?;
}