bool Skeleton_basic::operator() ( clipper::Xmap<int>& xskl, const clipper::Xmap<float>& xmap ) const { std::vector<int> index; clipper::Xmap<float>::Map_reference_index ix; /* now get the map in sorted order. We only sort those points which are to be considered, i.e. non-zero */ for ( ix = xmap.first(); !ix.last(); ix.next() ) if ( xskl[ix] > 0 ) index.push_back( ix.index() ); Map_index_sort::sort_increasing( xmap, index ); /* make neighbours The neighbours of a point are the other grid points which are 'near' it. The exact choice depends on the grid geometry. The cutoff is chosen to give 18-20 neighbours. For a cubic grid, these are a 3x3x3 cube without the vertices, for a hex grid they are a hexagonal cylinder. */ Skeleton_basic::Neighbours neigh( xmap ); /* make the skeleton map. This will contain: 0 for non-skeleton grids (inter ridge spaces) 1 for untested grids 1 for skeleton grids (ridges) (The untested and skeleton grids can have the same value, because the untested ones are still in the index). We loop through point in order, starting with the lowest and decide whether each one is part of the skeleton. */ for ( int i = 0; i < index.size(); i++ ) if ( !isInSkel( xskl, xskl.coord_of(index[i]), neigh, box_ ) ) xskl.set_data( index[ i ], 0 ); return true; }
void SSfind::prep_search( const clipper::Xmap<float>& xmap ) { // make list of results typedef clipper::Xmap<float>::Map_reference_index MRI; srctrn.clear(); for ( MRI ix = xmap.first(); !ix.last(); ix.next() ) srctrn.push_back( grid.index( ix.coord() ) ); }
void SSfind::prep_search( const clipper::Xmap<float>& xmap, const double rhocut, const double radcut, const clipper::Coord_orth centre ) { // make list of results typedef clipper::Xmap<float>::Map_reference_index MRI; srctrn.clear(); double r2cut = ( radcut > 0.0 ) ? radcut*radcut : 1.0e20; clipper::Coord_frac cf = centre.coord_frac( xmap.cell() ); for ( MRI ix = xmap.first(); !ix.last(); ix.next() ) if ( xmap[ix] > rhocut ) { clipper::Coord_frac df = ix.coord().coord_frac( xmap.grid_sampling() ); df = df.symmetry_copy_near( xmap.spacegroup(), xmap.cell(), cf ) - cf; double r2 = df.lengthsq( xmap.cell() ); if ( r2 < r2cut ) srctrn.push_back( grid.index( ix.coord() ) ); } }