       optimiser
       initial-params
       (fn [state]
-        (swap! log* conj (util/map-vals force state))
+        (swap! log* conj (util/force-map state))
         (terminate? state)))
     @log*))
 

  (outputf terminate?
           "f = % .8e, |grad| = % .8e, |dx| = % .8e%n"
           :value
           (comp m/magnitude force :gradient)
           (fn [state]
             (if-not (:initial-step state)
               (m/magnitude (force (:last-step state)))
               Double/NaN))))

(defn pause

  [terminate? cutoff params]
  (fn [state]
    (or (terminate? state)
        (<= (m/distance (- (:params state)
                           params))
            cutoff))))

