 
 	phi_n_i (double (phi pos-n_i pos-u_i))]
     (cond
-     (<= 0 phi_n_i phi_0)
-     (* (nth edge-rot part)
-        (/ (- (square (Math/sin phi_n_i))
-	      (square (Math/sin phi_0)))
-	   (square y_e))),
-
-     (<= phi_0 phi_n_i (- Math/PI phi_0))
-     0.0,
-
-     (<= (- Math/PI phi_0) phi_n_i Math/PI)
-     (* (nth edge-rot part)
-	(/ (- (square (Math/sin phi_0))
-	      (square (Math/sin phi_n_i)))
-	   (square y_e))))))
+     (<= y_e 0) (if (zero? part)
+		  0.0
+		  Double/NEGATIVE_INFINITY),
+     (<= phi_0 phi_n_i (- Math/PI phi_0)) 0.0,
+     :else (* (if (<= 0 phi_n_i phi_0)
+		1
+		-1)
+	      (nth edge-rot part)
+	      (/ (- (square (Math/sin phi_n_i))
+		    (square (Math/sin phi_0)))
+		 (square y_e))))))
 
 
 ;; Overall Energy and Force

;;;

(defn- test-repulsive-force
  ""
  [pos-w n_i]
  (let [layout [{:w pos-w, :w-1 [0 0], :w-2 [1 1]}
		#{[:w-1 :w-2]}],

  (let [part (mod n 2),
	n_i (nth inf-irrs (div n 2))]
    (double
     (+ (* *repulsive-amount* (with-printed-result (str "F_rep(" (div n 2) ", " part ") =")
				(repulsive-force layout n_i part information)))
	(* *attractive-amount* (with-printed-result (str "F_att(" (div n 2) ", " part ") =")
				 (attractive-force layout n_i part information)))
	(* *gravitative-amount* (with-printed-result (str "F_gra(" (div n 2) ", " part ") =")
				  (gravitative-force layout n_i part information)))))))

;;

