BitSet getAtomsConnected(float min, float max, BitSet bs) {
		if (frame == null)
			return null;
		BitSet bsResult = new BitSet();
		int atomCount = getAtomCount();
		int[] nBonded = new int[atomCount];
		int bondCount = getBondCount();
		for (int ibond = 0; ibond < bondCount; ibond++) {
			Bond bond = frame.bonds[ibond];
			if (bond.order > 0) {
				if (bs.get(bond.atom1.atomIndex))
					nBonded[bond.atom2.atomIndex]++;
				if (bs.get(bond.atom2.atomIndex))
					nBonded[bond.atom1.atomIndex]++;
			}
		}
		for (int i = atomCount; --i >= 0;)
			if (nBonded[i] >= min && nBonded[i] <= max)
				bsResult.set(i);
		return bsResult;
	}