private double[] getTotalKineticEnergy(byte type, Shape shape) {
		double[] result = new double[2];
		result[0] = result[1] = 0;
		Atom a = null;
		for (int i = 0; i < numberOfAtoms; i++) {
			a = atom[i];
			if (type == -1) {
				if (shape == null || a.isCenterOfMassContained(shape)) {
					result[0]++;
					result[1] += (a.vx * a.vx + a.vy * a.vy) * a.mass;
				}
			} else {
				if (a.id == type) {
					if (shape == null || a.isCenterOfMassContained(shape)) {
						result[0]++;
						result[1] += (a.vx * a.vx + a.vy * a.vy) * a.mass;
					}
				}
			}
		}
		// the prefactor 0.5 doesn't show up here because it has been included in the conversion factors.
		result[1] *= EV_CONVERTER;
		return result;
	}