public boolean rotateSelectedParticles(double angleInDegrees) {
		double xc = 0, yc = 0;
		int n = 0;
		for (int i = 0; i < numberOfAtoms; i++) {
			if (atom[i].isSelected()) {
				xc += atom[i].rx;
				yc += atom[i].ry;
				n++;
			}
		}
		if (n == 0)
			return true;
		xc /= n;
		yc /= n;
		boolean b = true;
		double costheta = Math.cos(Math.toRadians(angleInDegrees));
		double sintheta = Math.sin(Math.toRadians(angleInDegrees));
		n = 0;
		double xi, yi;
		for (int i = 0; i < numberOfAtoms; i++) {
			if (!atom[i].isSelected())
				continue;
			atom[i].storeCurrentState();
			xi = atom[i].rx;
			yi = atom[i].ry;
			atom[i].rx = xc + (xi - xc) * costheta - (yi - yc) * sintheta;
			atom[i].ry = yc + (xi - xc) * sintheta + (yi - yc) * costheta;
			if (!boundary.contains(atom[i].rx, atom[i].ry)) {
				b = false;
				n = i;
				break;
			}
		}
		if (b) {
			for (int i = 0; i < numberOfAtoms; i++) {
				if (!atom[i].isSelected())
					continue;
				PointRestraint pr = atom[i].getRestraint();
				if (pr != null) {
					xi = pr.getX0();
					yi = pr.getY0();
					pr.setX0(xc + (xi - xc) * costheta - (yi - yc) * sintheta);
					pr.setY0(yc + (xi - xc) * sintheta + (yi - yc) * costheta);
				}
			}
			if (view.getUseJmol())
				view.refreshJmol();
			view.repaint();
			return true;
		}
		for (int i = 0; i <= n; i++) {
			if (atom[i].isSelected())
				atom[i].restoreState();
		}
		return false;
	}