pub fn try_collapse_with<E, M, M2, F>(
        &self,
        meta: Vec<M>,
        mut fold_meta: F,
    ) -> Result<Vec<M2>, E>
    where F: FnMut(OwnedMetas<'_, M>, &[[u32; 3]]) -> Result<M2, E>,
    {
        let sc_idx = image_cells(self.periods);
        let mut meta = meta;
        let mut out_meta = Vec::with_capacity(self.num_primitive_atoms());
        while !meta.is_empty() {
            // Fold all images of a single atom
            let new_len = meta.len() - self.num_cells();
            out_meta.push(fold_meta(meta.drain(new_len..), &sc_idx)?);
        }
        // Atoms were done in reverse order
        Ok(out_meta.into_iter().rev().collect())
    }
// !!! This function affects the supercell convention !!! (SUPERCELL-CONV)
// When modifying it, you must modify all functions that have this label.
//
/// `fold_meta` is called on the images of each primitive atom,
/// along with their cell indices in a parallel slice.
/// The primitive atoms are done in an arbitrary order.
///
/// Variant of `collapse_with` for fallible functions.
This function affects the supercell convention !!. (SUPERCELL-CONV)
When modifying it, you must modify all functions that have this label.

`fold_meta` is called on the images of each primitive atom,
along with their cell indices in a parallel slice.
The primitive atoms are done in an arbitrary order.

Variant of `collapse_with` for fallible functions.
This function affects the supercell convention !! . ( SUPERCELL - CONV ) When modifying it you must modify all functions that have this label . ` fold_meta ` is called on the images of each primitive atom along with their cell indices in a parallel slice . The primitive atoms are done in an arbitrary order . Variant of ` collapse_with ` for fallible functions .
pub fn try_collapse_with<E, M, M2, F>(
        &self,
        meta: Vec<M>,
        mut fold_meta: F,
    ) -> Result<Vec<M2>, E>
    where F: FnMut(OwnedMetas<'_, M>, &[[u32; 3]]) -> Result<M2, E>,
    {
        let sc_idx = image_cells(self.periods);
        let mut meta = meta;
        let mut out_meta = Vec::with_capacity(self.num_primitive_atoms());
        while !meta.is_empty() {
            // Fold all images of a single atom
            let new_len = meta.len() - self.num_cells();
            out_meta.push(fold_meta(meta.drain(new_len..), &sc_idx)?);
        }
        // Atoms were done in reverse order
        Ok(out_meta.into_iter().rev().collect())
    }
pub fn try_collapse_with < E , M , M2 , F > ( & self , meta : Vec < M > , mut fold_meta : F , ) -> Result < Vec < M2 > , E > where F : FnMut ( OwnedMetas < ' _ , M > , & [ [ u32 ; 3 ] ] ) -> Result < M2 , E > , { let sc_idx = image_cells ( self . periods ) ; let mut meta = meta ; let mut out_meta = Vec :: with_capacity ( self . num_primitive_atoms ( ) ) ; while ! meta . is_empty ( ) { // Fold all images of a single atom let new_len = meta . len ( ) - self . num_cells ( ) ; out_meta . push ( fold_meta ( meta . drain ( new_len .. ) , & sc_idx ) ? ) ; } // Atoms were done in reverse order Ok ( out_meta . into_iter ( ) . rev ( ) . collect ( ) ) }
This function affects the supercell convention !
This function affects the supercell convention !
&self
meta
Vec<M>
fold_meta
F
&self
meta
Vec<M>
fold_meta
F