Atom atom = transformed.get(r2)[c]; if (atom != null) { nonNullSqDist += Calc.getDistanceFast(refAtom, atom); nonNullLength++;
Atom atom = transformed.get(r)[c]; if (atom != null) { nonNullSqDist += Calc.getDistanceFast(refAtom, atom); nonNullLength++;
double dist = Calc.getDistanceFast(centroid, testAtom);
public static Set<Group> getGroupsWithinShell(Structure structure, Atom atom, Set<ResidueNumber> excludeResidues, double distance, boolean includeWater) { // square the distance to use as a comparison against getDistanceFast // which returns the square of a distance. distance = distance * distance; Set<Group> returnSet = new LinkedHashSet<Group>(); for (Chain chain : structure.getChains()) { groupLoop: for (Group chainGroup : chain.getAtomGroups()) { if (!includeWater && chainGroup.isWater()) continue; for (ResidueNumber rn : excludeResidues) { if (rn.equals(chainGroup.getResidueNumber())) continue groupLoop; } for (Atom atomB : chainGroup.getAtoms()) { // use getDistanceFast as we are doing a lot of comparisons double dist = Calc.getDistanceFast(atom, atomB); if (dist <= distance) { returnSet.add(chainGroup); break; } } } } return returnSet; }