public static List < Group > getLigandsByProximity ( Collection < Group > target , Atom [ ] query , double cutoff ) { // Geometric hashing of the reduced structure Grid grid = new Grid ( cutoff ) ; grid . addAtoms ( query ) ; List < Group > ligands = new ArrayList <> ( ) ; for ( Group g : target ) { // don't worry about waters if ( g . isWater ( ) ) { continue ; } if ( g . isPolymeric ( ) ) { // Polymers aren't ligands continue ; } // It is a ligand! // Check that it's within cutoff of something in reduced List < Atom > groupAtoms = g . getAtoms ( ) ; if ( ! grid . hasAnyContact ( Calc . atomsToPoints ( groupAtoms ) ) ) { continue ; } ligands . add ( g ) ; } return ligands ; }
Finds all ligand groups from the target which fall within the cutoff distance of some atom from the query set .