trotzky.lisp (1299B)
1 ;; parameters 2 3 (defparameter *dimension* 15) ;; physical dimension 4 (defparameter *length* 21) 5 (defparameter *particles* 7) 6 7 ;; libraries 8 9 (load "conf.lisp") 10 (require :tebdol) 11 12 (use-package '(:tensor :mps :bhm)) 13 (setf *print-level* 2) 14 15 ;; main 16 17 (defun make-mps (dimension length particles) 18 (loop 19 with c = (/ (1- length) 2) 20 with m = (make-array length) 21 for i from (- c) to c 22 do 23 (setf (svref m (+ i c)) 24 (functional-tensor 25 (list 26 (list (make-segment 27 :numbers 28 (list 29 (cond 30 ((>= (- i) particles) 0) 31 ((>= i particles) particles) 32 ((evenp i) (/ (+ i particles -1) 2)) 33 (t (/ (+ i particles) 2)))) 34 :dimension 35 1)) 36 (ket-physical-index dimension) 37 (list (make-segment 38 :numbers 39 (list 40 (cond 41 ((>= (- i) particles) 0) 42 ((>= i particles) (- particles)) 43 ((evenp i) (- (/ (+ i particles 1) 2))) 44 (t (/ (- (+ i particles)) 2)))) 45 :dimension 46 1))) 47 #'(lambda (s) (declare (ignore s)) 1))) 48 finally 49 (return m))) 50 51 (defparameter *mps* (make-mps *dimension* *length* *particles*)) 52 53 (save-mps 54 *mps* 55 *dimension* 56 *particles* 57 (make-pathname 58 :directory 59 (list :relative (format nil "inputs/trotzky-l-~A-n-~A" *length* *particles*))))