String getState() {
		StringBuffer commands = new StringBuffer("# connections;\n");
		String cmd;
		if (reportFormalCharges) {
			Hashtable ht = new Hashtable();
			for (int i = 0; i < atomCount; i++)
				StateManager.setStateInfo(ht, i, i, "set formalCharge " + atoms[i].getFormalCharge());
			commands.append(StateManager.getCommands(ht));
		}

		// connections

		Vector fs = stateScripts;
		int len = fs.size();
		for (int i = 0; i < len; i++)
			commands.append(fs.get(i) + "\n");

		viewer.loadShape(JmolConstants.SHAPE_LABELS);
		((Labels) shapes[JmolConstants.SHAPE_LABELS]).getShapeState(commands);

		commands.append("\n# model state;\n");
		// shape construction

		for (int i = 0; i < JmolConstants.SHAPE_MAX; ++i) {
			Shape shape = shapes[i];
			if (shape != null && (cmd = shape.getShapeState()) != null && cmd.length() > 1)
				commands.append(cmd);
		}
		commands.append("\n");
		return commands.toString();
	}