// NOTE: This ends up getting called stupidly often, but I don't think
//       it is expensive enough to be a real cause for concern.
This ends up getting called stupidly often, but I don't think
it is expensive enough to be a real cause for concern.
This ends up getting called stupidly often but I don ' t think it is expensive enough to be a real cause for concern .
fn find_molecules(&self, coords: &Coords, meta: &CommonMeta) -> Vec<usize>
        {
            let bonds: Option<meta::FracBonds> = meta.pick();
            let bonds = match bonds {
                Some(bonds) => bonds,
                None => {
                    let elements: meta::SiteElements = meta.pick();
                    std::rc::Rc::new(rsp2_structure::bonds::FracBonds::compute_with_meta(
                        coords,
                        elements.iter().cloned(),
                        |&a, &b| match (a, b) {
                            (consts::CARBON, consts::CARBON) => Some(2.01),
                            (consts::CARBON, consts::HYDROGEN) |
                            (consts::HYDROGEN, consts::CARBON) => Some(1.51),
                            (consts::HYDROGEN, consts::HYDROGEN) => Some(1.21),
                            _ => None,
                        },
                    ).expect("couldn't get bonds"))
                },
            };
            bonds.to_periodic_graph().connected_components_by_site()
                .into_iter().map(|x| x.into_arbitrary_integer())
                .collect()
        }
fn find_molecules ( & self , coords : & Coords , meta : & CommonMeta ) -> Vec < usize > { let bonds : Option < meta :: FracBonds > = meta . pick ( ) ; let bonds = match bonds { Some ( bonds ) => bonds , None => { let elements : meta :: SiteElements = meta . pick ( ) ; std :: rc :: Rc :: new ( rsp2_structure :: bonds :: FracBonds :: compute_with_meta ( coords , elements . iter ( ) . cloned ( ) , | & a , & b | match ( a , b ) { ( consts :: CARBON , consts :: CARBON ) => Some ( 2.01 ) , ( consts :: CARBON , consts :: HYDROGEN ) | ( consts :: HYDROGEN , consts :: CARBON ) => Some ( 1.51 ) , ( consts :: HYDROGEN , consts :: HYDROGEN ) => Some ( 1.21 ) , _ => None , } , ) . expect ( " " ) ) } , } ; bonds . to_periodic_graph ( ) . connected_components_by_site ( ) . into_iter ( ) . map ( | x | x . into_arbitrary_integer ( ) ) . collect ( ) }
NOTE: This ends up getting called stupidly often, but I don't think
it is expensive enough to be a real cause for concern.
NOTE : This ends up getting called stupidly often but I don ' t think it is expensive enough to be a real cause for concern .
&self
coords
&Coords
meta
&CommonMeta