private boolean evaluateSetClause(String str) {

		// action
		Matcher matcher = ACTION.matcher(str);
		if (matcher.find()) {
			str = str.substring(matcher.end()).trim().toUpperCase();
			matcher = ACTION_ID.matcher(str);
			if (matcher.find()) {
				if (actionIDMap == null)
					fillActionIDMap();
				if (!actionIDMap.containsKey(str)) {
					out(ScriptEvent.FAILED, "Unrecognized parameter: " + str);
					return false;
				}
				view.setActionID(actionIDMap.get(str));
				return true;
			}
		}

		String[] s = null;

		// element field
		matcher = ELEMENT_FIELD.matcher(str);
		if (matcher.find()) {
			int end = matcher.end();
			s = str.substring(end).trim().split(REGEX_WHITESPACE + "+");
			if (s.length != 2) {
				out(ScriptEvent.FAILED, "Argument error: " + str);
				return false;
			}
			double x = parseMathExpression(s[1]);
			if (Double.isNaN(x))
				return false;
			setElementField(str.substring(0, end - 1), s[0], (float) x);
			return true;
		}

		// atom field
		matcher = ATOM_FIELD.matcher(str);
		if (matcher.find()) {
			int end = matcher.end();
			String s2 = str.substring(end).trim();
			int i = s2.indexOf(" ");
			if (i < 0) {
				out(ScriptEvent.FAILED, "Argument error: " + str);
				return false;
			}
			s = new String[] { s2.substring(0, i).trim(), s2.substring(i + 1).trim() };
			s2 = str.substring(0, end - 1);
			if (s2.startsWith("%")) {
				s2 = s2.substring(1);
			}
			if ("on".equalsIgnoreCase(s[1]) || "off".equalsIgnoreCase(s[1])) {
				if ("visible".equalsIgnoreCase(s[0])) {
					setAtomField(s2, s[0], "on".equalsIgnoreCase(s[1]));
				}
				else if ("movable".equalsIgnoreCase(s[0])) {
					setAtomField(s2, s[0], "on".equalsIgnoreCase(s[1]));
				}
			}
			else {
				double x = parseMathExpression(s[1]);
				if (Double.isNaN(x))
					return false;
				setAtomField(s2, s[0], (float) x);
			}
			return true;
		}

		if (str.trim().startsWith("%")) { // change the value of a defined variable
			int whitespace = str.indexOf(" ");
			String var = str.substring(0, whitespace).trim().toLowerCase();
			String exp = str.substring(whitespace).trim().toLowerCase();
			boolean isStatic = false;
			if (!sharedDefinition.isEmpty()) {
				Map<String, String> map = sharedDefinition.get(model.getClass());
				if (map != null && !map.isEmpty()) {
					if (map.containsKey(var)) {
						isStatic = true;
					}
				}
			}
			if (exp.startsWith("temperature(")) {
				// exp = evaluateTemperatureFunction(exp);
				// if (exp != null)
				// storeDefinition(isStatic, var, exp);
			}
			else {
				evaluateDefineMathexClause(isStatic, var, exp);
			}
			return true;
		}

		s = str.trim().split(REGEX_SEPARATOR + "+");

		if (s.length == 2) {

			String s0 = s[0].trim().toLowerCase().intern();
			if ("on".equalsIgnoreCase(s[1].trim()) || "off".equalsIgnoreCase(s[1].trim())) {
				if (s0 == "navigation") {
					boolean b = "on".equalsIgnoreCase(s[1].trim());
					view.getViewer().setNavigationMode(b);
					view.repaint();
					model.notifyChange();
					return true;
				}
				else if (s0 == "movable") {
					boolean b = "on".equalsIgnoreCase(s[1].trim());
					int n = model.getAtomCount();
					for (int i = 0; i < n; i++) {
						Atom a = model.getAtom(i);
						if (a.isSelected())
							a.setMovable(b);
					}
					model.notifyChange();
					return true;
				}
				else if (s0 == "visible") {
					boolean b = "on".equalsIgnoreCase(s[1].trim());
					int n = model.getAtomCount();
					for (int i = 0; i < n; i++) {
						Atom a = model.getAtom(i);
						if (a.isSelected()) {
							a.setVisible(b);
							view.setVisible(a, b);
						}
					}
					n = model.getRBondCount();
					for (int i = 0; i < n; i++) {
						RBond rb = model.getRBond(i);
						if (rb.isSelected()) {
							rb.setVisible(b);
							view.setVisible(rb, b);
						}
					}
					model.notifyChange();
					return true;
				}
				else if (s0 == "translucent") {
					boolean b = "on".equalsIgnoreCase(s[1].trim());
					int n = model.getAtomCount();
					for (int i = 0; i < n; i++) {
						Atom a = model.getAtom(i);
						if (a.isSelected()) {
							view.setTranslucent(a, b);
						}
					}
					n = model.getRBondCount();
					for (int i = 0; i < n; i++) {
						RBond rb = model.getRBond(i);
						if (rb.isSelected()) {
						}
					}
					model.notifyChange();
					return true;
				}
			}
			double x = parseMathExpression(s[1]);
			if (Double.isNaN(x))
				return false;
			if (s0 == "camera") {
				view.setCameraAtom((int) Math.round(x));
				view.repaint();
				model.notifyChange();
				return true;
			}
			else if (s0 == "gfield") {
				if (x < 0) {
					out(ScriptEvent.FAILED, "Illegal parameter: gravitational acceleration cannot be negative: " + x);
					return false;
				}
				model.setGField((float) x, null);
				model.setRotationMatrix(view.getViewer().getRotationMatrix());
				return true;
			}
			else if (s0 == "vx") {
				int n = model.getAtomCount();
				for (int i = 0; i < n; i++) {
					Atom a = model.getAtom(i);
					if (a.isSelected())
						a.setVx((float) x * IV_CONVERTER);
				}
				model.notifyChange();
				return true;
			}
			else if (s0 == "vy") {
				int n = model.getAtomCount();
				for (int i = 0; i < n; i++) {
					Atom a = model.getAtom(i);
					if (a.isSelected())
						a.setVy((float) x * IV_CONVERTER);
				}
				model.notifyChange();
				return true;
			}
			else if (s0 == "vz") {
				int n = model.getAtomCount();
				for (int i = 0; i < n; i++) {
					Atom a = model.getAtom(i);
					if (a.isSelected())
						a.setVz((float) x * IV_CONVERTER);
				}
				model.notifyChange();
				return true;
			}
			else if (s0 == "charge") {
				int n = model.getAtomCount();
				for (int i = 0; i < n; i++) {
					Atom a = model.getAtom(i);
					if (a.isSelected())
						a.setCharge((float) x);
				}
				model.notifyChange();
				return true;
			}
			else if (s0 == "strength") {
				if (!model.rBonds.isEmpty()) {
					RBond rb;
					synchronized (model.rBonds) {
						for (Iterator it = model.rBonds.iterator(); it.hasNext();) {
							rb = (RBond) it.next();
							if (rb.isSelected()) {
								if (x > ZERO) {
									rb.setStrength((float) x);
								}
								else {
									it.remove();
								}
							}
						}
					}
				}
				if (!model.aBonds.isEmpty()) {
					ABond ab;
					synchronized (model.aBonds) {
						for (Iterator it = model.aBonds.iterator(); it.hasNext();) {
							ab = (ABond) it.next();
							if (ab.isSelected()) {
								if (x > ZERO) {
									ab.setStrength((float) x);
								}
								else {
									it.remove();
								}
							}
						}
					}
				}
				model.removeGhostABonds();
				model.removeGhostTBonds();
				model.notifyChange();
				return true;
			}
			else if (s0 == "bondlength") {
				if (!model.rBonds.isEmpty()) {
					RBond rb;
					synchronized (model.rBonds) {
						for (Iterator it = model.rBonds.iterator(); it.hasNext();) {
							rb = (RBond) it.next();
							if (rb.isSelected())
								rb.setLength((float) x);
						}
					}
					model.notifyChange();
				}
				return true;
			}
			else if (s0 == "bondangle") {
				if (!model.aBonds.isEmpty()) {
					ABond ab;
					synchronized (model.aBonds) {
						for (Iterator it = model.aBonds.iterator(); it.hasNext();) {
							ab = (ABond) it.next();
							if (ab.isSelected())
								ab.setAngle((float) Math.toRadians(x));
						}
					}
					model.notifyChange();
				}
				return true;
			}
			else if (s0 == "timestep") {
				model.setTimeStep((float) x);
				model.notifyChange();
				return true;
			}
			else if (s0 == "heatbath") {
				model.activateHeatBath(x > 0);
				if (model.heatBathActivated())
					model.getHeatBath().setExpectedTemperature((float) x);
				model.notifyChange();
				return true;
			}
			else if (s0 == "model_time") {
				model.setModelTime((float) x);
				model.notifyChange();
				return true;
			}
			else if (s0 == "temperature") {
				model.setTemperature((float) x);
				model.notifyChange();
				return true;
			}
			else if (s0 == "cell_length") {
				model.setLength((float) x);
				view.setSimulationBox();
				model.notifyChange();
				return true;
			}
			else if (s0 == "cell_width") {
				model.setWidth((float) x);
				view.setSimulationBox();
				model.notifyChange();
				return true;
			}
			else if (s0 == "cell_height") {
				model.setHeight((float) x);
				view.setSimulationBox();
				model.notifyChange();
				return true;
			}
		}

		else if (s.length == 4) {

			String s0 = s[0].trim().toLowerCase().intern();

			if (s0 == "gfield") {
				s[1] = s[1].trim();
				if (s[1].startsWith("("))
					s[1] = s[1].substring(1);
				double x = parseMathExpression(s[1]);
				if (Double.isNaN(x))
					return false;
				double y = parseMathExpression(s[2]);
				if (Double.isNaN(y))
					return false;
				s[3] = s[3].trim();
				if (s[3].endsWith(")"))
					s[3] = s[3].substring(0, s[3].length() - 1);
				double z = parseMathExpression(s[3]);
				if (Double.isNaN(z))
					return false;
				float r = (float) Math.sqrt(x * x + y * y + z * z);
				if (r < ZERO) {
					model.setGField(0, null);
				}
				else {
					model.setGField(r, new Vector3f((float) x / r, (float) y / r, (float) z / r));
				}
				return true;
			}

			if (s0 == "efield") {
				s[1] = s[1].trim();
				if (s[1].startsWith("("))
					s[1] = s[1].substring(1);
				double x = parseMathExpression(s[1]);
				if (Double.isNaN(x))
					return false;
				double y = parseMathExpression(s[2]);
				if (Double.isNaN(y))
					return false;
				s[3] = s[3].trim();
				if (s[3].endsWith(")"))
					s[3] = s[3].substring(0, s[3].length() - 1);
				double z = parseMathExpression(s[3]);
				if (Double.isNaN(z))
					return false;
				float r = (float) Math.sqrt(x * x + y * y + z * z);
				if (r < ZERO) {
					model.setEField(0, null);
				}
				else {
					model.setEField(r, new Vector3f((float) x / r, (float) y / r, (float) z / r));
				}
				return true;
			}

			if (s0 == "bfield") {
				s[1] = s[1].trim();
				if (s[1].startsWith("("))
					s[1] = s[1].substring(1);
				double x = parseMathExpression(s[1]);
				if (Double.isNaN(x))
					return false;
				double y = parseMathExpression(s[2]);
				if (Double.isNaN(y))
					return false;
				s[3] = s[3].trim();
				if (s[3].endsWith(")"))
					s[3] = s[3].substring(0, s[3].length() - 1);
				double z = parseMathExpression(s[3]);
				if (Double.isNaN(z))
					return false;
				float r = (float) Math.sqrt(x * x + y * y + z * z);
				if (r < ZERO) {
					model.setBField(0, null);
				}
				else {
					model.setBField(r, new Vector3f((float) x / r, (float) y / r, (float) z / r));
				}
				return true;
			}

		}

		out(ScriptEvent.FAILED, "Unrecognized type of parameter to set: " + str);
		return false;

	}