private void selectMoleculeOrNot(int x, int y) {
		Object copy = selectedComponent;
		int i = viewer.findNearestAtomIndex(x, y);
		if (i >= 0) {
			selectRBond(-1);
			selectABond(-1);
			selectTBond(-1);
			Atom at = model.getAtom(i);
			Molecule mol = model.getMolecule(at);
			if (mol != null) {
				multiselectionBitSet.clear();
				int n = mol.getAtomCount();
				for (int k = 0; k < n; k++) {
					multiselectionBitSet.set(mol.getAtom(k).getIndex());
				}
				viewer.setSelectionSet(multiselectionBitSet);
			}
			selectedComponent = mol;
			setRotationEnabled(false);
		}
		else {
			selectAtom(-1);
			selectedComponent = null;
			setRotationEnabled(true);
		}
		// in the case no molecule is selected, keep the atomic selection
		if (selectedComponent == null && copy instanceof Atom)
			selectedComponent = copy;
	}