anchor.diff:                  ~4TConcentration = 1 : -1e-6 : 1E20~%~
                   END~%"))
   
  +(defun split-rate-string-equally (str &optional (max-char-size *numerica-rate-string-max-length*))
  +  (let ((term-breaks (sort (nconc (positions #\+ str)
  +                                  (positions #\- str))
  +                           #'<)))
  +    (loop with cur-start-pos = 0
  +          for last-term-pos = 0 then term-pos
  +          for term-pos in term-breaks
  +          for expr-len = (- term-pos cur-start-pos)
  +          when (> expr-len max-char-size)
  +          collect (subseq str cur-start-pos last-term-pos) into parts
  +          and do (setf cur-start-pos last-term-pos)
  +          finally 
  +          (setf parts (nconc parts (if (> last-term-pos cur-start-pos)
  +                                       (list (subseq str cur-start-pos last-term-pos)))))
  +          (return parts))))
  +          
  +
   (defun write-model-block (nm file)
     (let* ((ode-vars  (numerica-model-ode-vars nm))
            (allvars (query var))
            (klen-pos  nil))
  +    (flet ((write-ode-fn (i rate)
  +             (let ((rate-strs (split-rate-string-equally 
  +                               (with-dimensionless-math (numerica-model-base-units nm)
  +                                 (format nil "~S" rate)))))
  +               (princ #\.)
  +               (cond
  +                ((> (length rate-strs) 1)
  +                 (loop for rate-str in rate-strs
  +                       for p = 1 then (1+ p)
  +                       do (format file "~%~4Tpart~S := ~A;" p rate-str)
  +                       collect p into parts
  +                       finally (format file "~%~4T$c(~S) = ~{part~S~^+~};" i parts)))
  +                (t (format file "~%~4T$c(~S) = ~A;" i (first rate-strs)))))))
  +
       (format t "~&; Writing model block")
       (format file "MODEL ~A~%~
                     ~2TPARAMETER~%~
  
positive.code:       (file-position file klen-pos)
        (princ (numerica-model-kvar-count nm) file)
        (file-position file end))
      (format file "~%END~%~%")))
  
  
  (defun compute-display-var-indicies (nm)
  
negative.code:             (first varlist) (rest varlist))))
  
  (defun order-vars (vars)
    (format t "~&; Sorting variables...~%")
    (sort (copy-list vars)  ; must copy the list! Allegro destructively modifies the input list (removing elements!!!)
          #'string<
          :key (lambda (o) 
  