anchor.diff:      (with-valid-index-cpu (i n)
         (%boundary-condition-cpu i x v a info))))
   
  -;; (defkernel %update-acceleration (void ((i int) (a float4*) (f float4*) (rho float*)))
  -;;   (symbol-macrolet ((ai   (aref a i))
  -;;                     (fi   (aref f i))
  -;;                     (rhoi (aref rho i)))
  -;;     (set ai (+ (/ fi rhoi) g))))
  -;;
  -;; (defkernel update-acceleration (void ((a float4*) (f float4*) (rho float*) (n int)))
  -;;   (with-valid-index (i n)
  -;;     (%update-acceleration i a f rho)))
  +;; returns dummy integer to avoid __host__ qualifier
  +(defkernel %update-acceleration (int ((i int) (a float4*) (f float4*) (rho float*)))
  +  (symbol-macrolet ((ai   (aref a i))
  +                    (fi   (aref f i))
  +                    (rhoi (aref rho i)))
  +    (let ((g2 (float4 0.0 -9.8 0.0 0.0)))
  +      (set ai (+ (/ fi rhoi) g))))
  +  (return 0))
  +
  +(defkernel update-acceleration (void ((a float4*) (f float4*) (rho float*) (n int)))
  +  (with-valid-index (i n)
  +    (%update-acceleration i a f rho)))
   
   (defun %update-acceleration-cpu (i a f rho)
     (symbol-macrolet ((ai   (mem-aref a i))
                       (fi   (mem-aref f i))
                       (rhoi (mem-aref rho i)))
  -    (setf ai (float4-add-cpu (float4-scale-inverted-cpu fi rhoi)
  -                             g))))
  +    (let ((g (make-float4 0.0 -9.8 0.0 0.0)))
  +      (setf ai (float4-add-cpu (float4-scale-inverted-cpu fi rhoi)
  +                               g)))))
   
   (defun update-acceleration-cpu (a f rho n &key grid-dim block-dim)
     (with-thread-block (grid-dim block-dim)
       (with-valid-index-cpu (i n)
         (%update-acceleration-cpu i a f rho))))
   
  -;; (defkernel %update-velocity (void ((i int) (v float4*) (a float4*)))
  -;;   (symbol-macrolet ((vi (aref v i))
  -;;                     (ai (aref a i)))
  -;;     (inc vi (* ai dt))))
  -;;
  -;; (defkernel update-velocity (void ((v float4*) (a float4*) (n int)))
  -;;   (with-valid-index (i n)
  -;;     (%update-velocity i v a)))
  +;; returns dummy integer to avoid __host__ qualifier
  +(defkernel %update-velocity (int ((i int) (v float4*) (a float4*)))
  +  (symbol-macrolet ((vi (aref v i))
  +                    (ai (aref a i)))
  +    (inc vi (* ai dt)))
  +  (return 0))
  +
  +(defkernel update-velocity (void ((v float4*) (a float4*) (n int)))
  +  (with-valid-index (i n)
  +    (%update-velocity i v a)))
   
   (defun %update-velocity-cpu (i v a)
     (symbol-macrolet ((vi (mem-aref v i))
  
positive.code: ;;; Output functions
  ;;;
  
  (defun file-name (i)
    (format nil "result~8,'0d.pov" i))
  
  (defun head ()
    (format nil (concatenate 'string
                             "#include \"colors.inc\"~%"
                             "camera {~%"
                             "  location <10, 30, -40>~%"
                             "  look_at <10, 10, 0>~%"
                             "}~%"
                             "light_source { <0, 30, -30> color White }~%")))
  
  (defun sphere (pos i)
    (let ((x (float4-x (mem-aref pos i)))
          (y (float4-y (mem-aref pos i)))
          (z (float4-z (mem-aref pos i))))
      (format nil
              (concatenate 'string
                           "sphere {~%"
                           "  <~F,~F,~F>,0.5~%"
                           "  texture {~%"
                           "    pigment { color Yellow }~%"
                           "  }~%"
                           "}~%")
              x y z)))
  
  (defun output (pos frame n)
    (with-open-file (out (file-name frame)
                         :direction :output
                         :if-exists :supersede)
      (princ (head) out)
      (dotimes (i n)
        (princ (sphere pos i) out))))
  
  ;; (defun output ()
  ;;   (error "undefined"))
  
  
  ;;;
  
negative.code:                                  (pow-cpu (- h r) 2))
                                (float4-scale-inverted-cpu x r))))
  
  (defkernel rap-visc-kernel (float ((x float4)))
    (let ((r (norm x)))
      (return (* (/ 45.0 (* pi (pow h 6.0)))
                 (- h r)))))
  
  (defun rap-visc-kernel-cpu (x)
    (let ((r (norm-cpu x)))
      (* (/ 45.0 (* pi-cpu (pow-cpu h 6)))
         (- h r))))
  
  ;; returns dummy integer to avoid __host__ qualifier
  (defkernel %update-density (int ((i int) (rho float*) (x float4*) (nbr int*) (info float*)))
    (let ((xi (aref x i)))
    (symbol-macrolet (;(xi (aref x i))
                      (xj (aref x j))
                      (rhoi (aref rho i)))
      (let ((tmp 0.0))
        (do-neighbor-particles (j nbr info xi)
          (let ((dr (* (- xi xj) simscale)))
            (when (<= (norm dr) h)
              (inc tmp (* pmass (poly6-kernel dr))))))
        (set rhoi tmp))))
    (return 0))
  
  (defkernel update-density (void ((rho float*) (x float4*) (nbr int*) (info float*) (n int)))
    (with-valid-index (i n)
      (%update-density i rho x nbr info)))
  
  (defun %update-density-cpu (i rho x nbr info)
    (symbol-macrolet ((xi (mem-aref x i))
  