public void assignTemperature(float temperature) {
		if (temperature < ZERO)
			temperature = 0.0f;
		float rtemp = (float) Math.sqrt(temperature) * VT_CONVERSION_CONSTANT;
		float sumVx = 0.0f;
		float sumVy = 0.0f;
		float sumVz = 0.0f;
		float sumMass = 0.0f;
		if (iAtom > 0) {
			if (random == null)
				random = new Random();
			for (int i = 0; i < iAtom; i++) {
				if (!atom[i].isMovable())
					continue;
				atom[i].vx = rtemp * (float) random.nextGaussian();
				atom[i].vy = rtemp * (float) random.nextGaussian();
				atom[i].vz = rtemp * (float) random.nextGaussian();
				sumVx += atom[i].vx * atom[i].mass;
				sumVy += atom[i].vy * atom[i].mass;
				sumVz += atom[i].vz * atom[i].mass;
				sumMass += atom[i].mass;
			}
		}
		if (sumMass > ZERO) {
			sumVx /= sumMass;
			sumVy /= sumMass;
			sumVz /= sumMass;
			if (iAtom > 1) {
				for (int i = 0; i < iAtom; i++) {
					if (!atom[i].isMovable())
						continue;
					atom[i].vx -= sumVx;
					atom[i].vy -= sumVy;
					atom[i].vz -= sumVz;
				}
			}
			setTemperature(temperature);
		}
	}