private static Color setGridChargeColor(float q, float qmin, float qmax) {
		if (Math.round(q) == 0)
			return Color.black;
		// pos. blue, neg. green, neu. black
		float scale = 1.0f;
		int ncolor;
		int isign = Math.round(qmax * qmin);
		if (isign > 0) {
			scale = 255.0f / (qmax - qmin); // all pos. or neg.
			ncolor = Math.round(scale * (q - qmin));
		}
		else if (isign < 0) {
			scale = q > 0 ? 255.0f / qmax : 255.0f / qmin; // some pos., some neg.
			ncolor = Math.round(scale * q);
		}
		else {
			if (Math.round(qmax) > 0) {
				scale = 255.0f / qmax; // some pos., some neu., no neg.
			}
			else if (Math.round(qmin) < 0) {
				scale = 255.0f / qmin; // some neg., some neu., no pos.
			}
			ncolor = Math.round(scale * q);
		}
		ncolor = ncolor > 255 ? 255 : ncolor;
		ncolor = ncolor < 0 ? 0 : ncolor;
		return q > 0 ? new Color(0, 0, ncolor) : new Color(0, ncolor, 0);
	}