private void dragAtom(Atom a, char direction, int x, int y, boolean releasing) {
		if (a == null)
			return;
		int k = model.getAtomIndex(a);
		if (k == -1)
			return;
		float c = 0;
		switch (direction) {
		case 'x':
			c = a.getRx();
			break;
		case 'y':
			c = a.getRy();
			break;
		case 'z':
			c = a.getRz();
			break;
		}
		Point3f p = viewer.findPointOnPlane(direction, x, y, c);
		if (!model.contains(p))
			return;
		if (releasing) {
			int n = model.getAtomCount();
			boolean tooClose = false;
			for (int i = 0; i < n; i++) {
				if (i == k)
					continue;
				if (model.getAtom(i).isTooClose(p)) {
					tooClose = true;
					break;
				}
			}
			n = model.getObstacleCount();
			if (n > 0) {
				for (int i = 0; i < n; i++) {
					if (model.getObstacle(i).contains(a)) {
						tooClose = true;
						break;
					}
				}
			}
			if (tooClose) {
				errorReminder.show(ErrorReminder.OBJECT_OVERLAP);
				a.setLocation(clickedAtomPosition);
				viewer.setAtomCoordinates(k, clickedAtomPosition);
				repaint();
				return;
			}
		}
		switch (direction) {
		case 'x':
			a.setRy(p.y);
			a.setRz(p.z);
			viewer.setAtomCoordinates(k, c, p.y, p.z);
			break;
		case 'y':
			a.setRx(p.x);
			a.setRz(p.z);
			viewer.setAtomCoordinates(k, p.x, c, p.z);
			break;
		case 'z':
			a.setRx(p.x);
			a.setRy(p.y);
			viewer.setAtomCoordinates(k, p.x, p.y, c);
			break;
		}
		refresh();
		repaint();
		if (releasing)
			model.notifyChange();
	}