Photon emit(Atom atom) {

		Electron e = atom.getElectron(0);
		if (e == null)
			return null;
		ElectronicStructure es = model.getElement(atom.id).getElectronicStructure();
		int m = es.indexOf(e.getEnergyLevel());
		if (m == 0)
			return null; // electron already in the ground state

		if (!e.readyToGo(model.getModelTime())) // the electron is just excited
			return null;

		// assume that the probability for the electron to transition to any lower state is equal
		float prob = 1.0f / m;
		double r1 = Math.random(); // the random number used to select a lower state
		double r2 = Math.random(); // the random number used to select a transition mechanism
		EnergyLevel level;
		float excess;

		for (int i = 0; i < m; i++) {

			if (r1 >= i * prob && r1 < (i + 1) * prob) {

				level = es.getEnergyLevel(i);
				excess = e.getEnergyLevel().getEnergy() - level.getEnergy();

				/* emit a photon */
				if (r2 > model.quantumRule.getProbability(QuantumRule.RADIATIONLESS_TRANSITION)) {
					e.setEnergyLevel(level);
					return new Photon((float) atom.rx, (float) atom.ry, excess / MDModel.PLANCK_CONSTANT);
				}

				break;

			}
		}

		return null;

	}