public void setModel(MDModel mod) {

		if (mod == null) {
			model = null;
			return;
		}
		if (!(mod instanceof MolecularModel))
			throw new IllegalArgumentException("Can't accept non-molecular model");
		model = (MolecularModel) mod;
		super.setModel(mod);
		model.addBondChangeListener(this);

		atom = model.getAtoms();
		obstacles = model.getObstacles();
		bonds = model.getBonds();
		bends = model.getBends();
		molecules = model.getMolecules();
		initEditFieldActions();

		if (elementEditor == null)
			elementEditor = new ElementEditor(model);
		editElementAction = new ModelAction(model, new Executable() {
			public void execute() {
				elementEditor.setModel(model);
				elementEditor.createDialog(AtomisticView.this, true).setVisible(true);
				resetAddObjectIndicator();
			}
		}) {
			public String toString() {
				return (String) getValue(Action.SHORT_DESCRIPTION);
			}
		};
		editElementAction.putValue(Action.NAME, "Change");
		editElementAction.putValue(Action.SHORT_DESCRIPTION, "Change the van der Waals parameters");
		model.getActions().put(editElementAction.toString(), editElementAction);

		EngineAction ea = new EngineAction(model);
		getActionMap().put(ea.toString(), ea);

		Action a = new ModelAction(model, new Executable() {
			public void execute() {
				final LightSource light = model.getLightSource();
				if (light == null)
					return;
				if (lightSourceEditor == null)
					lightSourceEditor = new LightSourceEditor();
				lightSourceEditor.createDialog(JOptionPane.getFrameForComponent(AtomisticView.this), model).setVisible(true);
			}
		}) {
			public String toString() {
				return (String) getValue(Action.SHORT_DESCRIPTION);
			}
		};
		a.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
		a.putValue(Action.NAME, "Light Source");
		a.putValue(Action.SHORT_DESCRIPTION, "Edit the light source");
		model.getActions().put(a.toString(), a);

		a = new ModelAction(model, new Executable() {
			public void execute() {
				if (quantumDynamicsRuleEditor == null)
					quantumDynamicsRuleEditor = new QuantumDynamicsRuleEditor();
				quantumDynamicsRuleEditor.createDialog(JOptionPane.getFrameForComponent(AtomisticView.this), model).setVisible(true);
			}
		}) {
			public String toString() {
				return (String) getValue(Action.SHORT_DESCRIPTION);
			}
		};
		a.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_D);
		a.putValue(Action.NAME, "Quantum Dynamics Rules");
		a.putValue(Action.SHORT_DESCRIPTION, "Edit quantum dynamics rules");
		model.getActions().put(a.toString(), a);

		if (!layerBasket.isEmpty()) {
			synchronized (layerBasket) {
				for (Iterator i = layerBasket.iterator(); i.hasNext();) {
					((ModelComponent) i.next()).setModel(model);
				}
			}
		}

		defaultPopupMenu = new DefaultPopupMenu(this);

	}