; Compute 3D reconstruction for each defocus group
;
; SOURCE: bpall.bat
;
; PURPOSE: Compute the 3D reconstruction for each defocus group.
;
; MASTER COPY: /net/bali/usr1/spider/docs/techs/recon/newprogs/
;
; I/O PARAMETERS AND FILES ARE SET HERE:
;
; ------------ DO NOT COPY FROM WEB BROWSER     ------------------
;
; --------------------- Parameters -----------------------------------

x41 =  -1        ; Radius of restored object (use -1 for 95% winsize / 2)
x42 = 0.2e-5     ; Lambda
x43 = 0.0        ; Correction limit
x44 = 60         ; Iteration limit

; ---------------------- Input files ---------------------------------
FR G
[params]../params             ; parameter file

FR G
[order]order_defocus             ; Selection file for defocus groups

FR G
[ali]../Alignment/ali/sar******  ; Aligned particles

FR G
[sel]df{***x77}/seltotal         ; Selection file for particles 

FR G
[angles]../Alignment/align_01_{***x77} ; Alignment parameter files

; ----------------------- Output files -------------------------------
FR G
[vol]vol001                     ; Volume (one for each defocus group)

; ------------------------ END BATCH HEADER -----------------------

MD 
SET MP 
0  ;  0 = use all processors available

IF (x41.eq.-1) THEN
   UD 17,x55     ; key 17 = windowsize
   [params]
   x41 = INT( (0.95*x55)/2.0 )
ENDIF

UD N,x50     ; Find number of defocus groups
[order]

DO LB1 x77=1,x50   ; Loop over all defocus groups

   ; Compute 3D reconstruction for this group.
   BP RP, x90   ; Register has number of iterations
   [ali]        ; Template for input 2D image files
   [sel]        ; Selection doc file for input images
   x41          ; Radius of restored object
   [angles]     ; Angles doc file
   *            ; Symmetries doc file (* means no symmetries)
   [vol]        ; Output reconstructed 3D volume
   x42,x43      ; Lambda, correction limit
   x44,0        ; Iteration limit, mode
   (.5,.5)      ; Minimum, maximum
   (.5)         ; Smoothing constant
LB1

EN
;