pub fn minimum_image(&self) -> (Self, bool) {
        // if we hit the requisite length and we can properly "connect" back to ourselves
        // across the periodic boundary
        let width = self.width().unwrap();
        let mut temp = self.spec.clone();
        let mut minimum_image = self.spec.clone();
        let mut has_symmetry = false;

        // get the "minimum" spec out of all possible images of the GNR
        for &x_mirror in &[false, true] {
            for &y_mirror in &[false, true] {
                for shift in 0..temp.len() {
                    // check + add symmetries
                    if (x_mirror || y_mirror || shift != 0) && temp == self.spec {
                        has_symmetry = true;
                    }

                    // check for minimum
                    if temp < minimum_image {
                        minimum_image.copy_from_slice(&temp);
                    }

                    // translations
                    temp.rotate_right(1);
                }
                // y mirror plane
                temp.reverse();
            }
            // x mirror plane
            for v in &mut temp {
                *v = (width - v.1, width - v.0);
            }
        }

        (Self::new(minimum_image), has_symmetry)
    }
/// Get the "minimum" spec after applying all possible transformations.
/// Returns the minimum and whether or not the structure has any symmetries.
Get the "minimum" spec after applying all possible transformations.
Returns the minimum and whether or not the structure has any symmetries.
Get the " minimum " spec after applying all possible transformations . Returns the minimum and whether or not the structure has any symmetries .
pub fn minimum_image(&self) -> (Self, bool) {
        // if we hit the requisite length and we can properly "connect" back to ourselves
        // across the periodic boundary
        let width = self.width().unwrap();
        let mut temp = self.spec.clone();
        let mut minimum_image = self.spec.clone();
        let mut has_symmetry = false;
        // get the "minimum" spec out of all possible images of the GNR
        for &x_mirror in &[false, true] {
            for &y_mirror in &[false, true] {
                for shift in 0..temp.len() {
                    // check + add symmetries
                    if (x_mirror || y_mirror || shift != 0) && temp == self.spec {
                        has_symmetry = true;
                    }
                    // check for minimum
                    if temp < minimum_image {
                        minimum_image.copy_from_slice(&temp);
                    }
                    // translations
                    temp.rotate_right(1);
                }
                // y mirror plane
                temp.reverse();
            }
            // x mirror plane
            for v in &mut temp {
                *v = (width - v.1, width - v.0);
            }
        }
        (Self::new(minimum_image), has_symmetry)
    }
pub fn minimum_image ( & self ) -> ( Self , bool ) { // if we hit the requisite length and we can properly "connect" back to ourselves // across the periodic boundary let width = self . width ( ) . unwrap ( ) ; let mut temp = self . spec . clone ( ) ; let mut minimum_image = self . spec . clone ( ) ; let mut has_symmetry = false ; // get the "minimum" spec out of all possible images of the GNR for & x_mirror in & [ false , true ] { for & y_mirror in & [ false , true ] { for shift in 0 .. temp . len ( ) { // check + add symmetries if ( x_mirror || y_mirror || shift != 0 ) && temp == self . spec { has_symmetry = true ; } // check for minimum if temp < minimum_image { minimum_image . copy_from_slice ( & temp ) ; } // translations temp . rotate_right ( 1 ) ; } // y mirror plane temp . reverse ( ) ; } // x mirror plane for v in & mut temp { * v = ( width - v . 1 , width - v . 0 ) ; } } ( Self :: new ( minimum_image ) , has_symmetry ) }
Get the "minimum" spec after applying all possible transformations.
Get the " minimum " spec after applying all possible transformations .
&self
&self