*/

	public synchronized double getKE() {
		double x = 0.0;
		for (int i = 0; i < numberOfAtoms; i++) {
			Atom a = atom[i];
			x += (a.vx * a.vx + a.vy * a.vy) * a.mass;
		}
		if (obstacles != null && !obstacles.isEmpty()) {
			RectangularObstacle obs = null;
			synchronized (obstacles.getSynchronizationLock()) {
				for (int jobs = 0, nobs = obstacles.size(); jobs < nobs; jobs++) {
					obs = obstacles.get(jobs);
					if (obs.isPartOfSystem() && obs.isMovable())
						x += (obs.vx * obs.vx + obs.vy * obs.vy) * obs.getMass();
				}
			}
		}
		if (!freeElectrons.isEmpty()) {
			synchronized (freeElectrons) {
				for (Electron e : freeElectrons) {
					x += (e.vx * e.vx + e.vy * e.vy) * Electron.mass;
				}
			}
		}
		x *= EV_CONVERTER;
		// the prefactor 0.5 doesn't show up here because it has been included in the mass unit conversion factor.
		kin = numberOfAtoms > 0 ? x / numberOfAtoms : x;
		return kin;
	}