// Monomorphic to ensure that all the yaml parsing code is generated inside this crate
Monomorphic to ensure that all the yaml parsing code is generated inside this crate
Monomorphic to ensure that all the yaml parsing code is generated inside this crate
pub fn _read(r: &mut dyn Read) -> FailResult<DispYaml>
    {
        use rsp2_structure::{CoordsKind, Lattice};
        use self::cereal::{Point, Displacement, DispYaml as RawDispYaml};
        let RawDispYaml { displacements, lattice, points } = serde_yaml::from_reader(r)?;
        let (mut fracs, mut elements, mut masses) = (vec![], vec![], vec![]);
        for Point { symbol, coordinates, mass } in points {
            fracs.push(coordinates);
            elements.push(Element::from_symbol(&symbol)?);
            masses.push(mass);
        };
        let coords = Coords::new(Lattice::new(&lattice), CoordsKind::Fracs(fracs));
        let displacements =
            displacements.into_iter()
                // phonopy numbers from 1
                .map(|Displacement { atom, displacement, .. }| ((atom - 1) as usize, displacement))
                .collect();
        Ok(DispYaml { coords, elements, masses, displacements })
    }
pub fn _read ( r : & mut dyn Read ) -> FailResult < DispYaml > { use rsp2_structure :: { CoordsKind , Lattice } ; use self :: cereal :: { Point , Displacement , DispYaml as RawDispYaml } ; let RawDispYaml { displacements , lattice , points } = serde_yaml :: from_reader ( r ) ? ; let ( mut fracs , mut elements , mut masses ) = ( vec ! [ ] , vec ! [ ] , vec ! [ ] ) ; for Point { symbol , coordinates , mass } in points { fracs . push ( coordinates ) ; elements . push ( Element :: from_symbol ( & symbol ) ? ) ; masses . push ( mass ) ; } ; let coords = Coords :: new ( Lattice :: new ( & lattice ) , CoordsKind :: Fracs ( fracs ) ) ; let displacements = displacements . into_iter ( ) // phonopy numbers from 1 . map ( | Displacement { atom , displacement , .. } | ( ( atom - 1 ) as usize , displacement ) ) . collect ( ) ; Ok ( DispYaml { coords , elements , masses , displacements } ) }
Monomorphic to ensure that all the yaml parsing code is generated inside this crate
Monomorphic to ensure that all the yaml parsing code is generated inside this crate
r
&mut dyn Read