([steptype],[num-grps],[sp_pixsiz],[ang-step],[r2],[alignsh],[prj-radius],[sp_winsiz],[incore-yn],[bp-type],[qsub]) ; ; Sets reconstruction parameters and files
 ;
 ; SOURCE: spider/docs/techs/recon1/Procs/recon_settings.spi
 ;         New                                 ArDean Leith  Jul 2002
 ;         [] variables                        ArDean Leith  Dec 2005
 ;         Rewritten, more stacks              ArDean Leith  Dec 2006
 ;         Variable assignment                 ArDean Leith  Jan 2010
 ;         Even-odd replaced                   ArDean Leith  Jan 2011
 ;         pixsiz returned, fsc                ArDean Leith  Aug 2012
 ;         For CTF corrected images            ArDean Leith  Oct 2013
 ;         For gold standard reconstruction    ArDean Leith  May 2014
 ;         Inlined params, changed dirs        ArDean Leith  Mar 2016
 ;
 ; INPUT REGISTERS:   [steptype] (0==align,  1==reconstruct, 3==restack, <1==none
 ;
 ; OUTPUT REGISTERS (SET  BELOW):
 ;   [num-grps]       Number of groups used
 ;   [sp_pixsiz]      Pixel size                        (A) 
 ;   [ang-step]       Angular step for ref. projections (degrees)
 ;   [r2]             Object alignment radius           (pixels)
 ;   [alignsh]        Alignment shift +- allowed        (pixels) 
 ;   [prj-radius]     Object projection radius          (pixels)
 ;   [sp_winsiz]      Image/window size = volume size   (pixels)
 ;   [incore-yn]      Use incore files                  (1 == true)
 ;   [bp-type]        Backprojection method  (1=='BP CG', 2=='BP 3F', 3=='BP RP', 4=='BP 3N')
 ;   [qsub]           Specifies que type     (1 == use PBS, 0 == use PubSub,  <0 == none)
 ;
 ; ---------Set Refinement parameters from parameter file ----------
 
 ; ---- Adjust these parameters for your project --------------- EDIT -----

 [num-grps]    = 10     ; Number of groups

 [qsub]        = 1      ; Specifies que (1 == use PBS, 0 == use PubSub,  <0 == none)

 [diam]        = 414    ; Diameter of the structure (A) used in alignment search. EDIT as needed.
 
 [sp_pixsiz]   = 1.1    ; Pixel size from  'params.spi' file (A)  

 [sp_winsiz]   = 400    ; Window size from 'params.spi' file (pixels)   

 [win-frac]    = 0.95   ; Fraction of window diameter used in projection (0.95 == 95%)

 [alignsh]     = 8      ; Alignment shift (pixels) searched is +- this value

 [ang-step]    = 15     ; Angular separation for reference projections

 [bp-type]     = 2      ; Backprojection method (1==BP CG, 2==BP 3F, 3==BP RP, 4==BP 3N)

 [rad-bp]      = -1     ; Radius of reconstructed object, pixels (<0 will use: 95% winsize / 2)

 [incore-yn]   = 1      ; Load input images into incore stack (>0 == Yes, we have enough memory)

 [max-wait]    = 600    ; Maximum delay in seconds for copying stacks before next group starts

 ; ----------------- Original input files ---  EDIT names as needed, These files must exist ------

 GLO [params]           = '../params'                             ; Parameter doc file  (one)  

 GLO [ref_vol_unfilt]   = '../ref_vol_unfilt'                     ; Initial unfiltered reference volume or reference volume (one)   
 GLO [ref_vol]          = '../ref_vol'                            ; Initial filtered   reference volume or reference volume (one)   
 GLO [vol]              = '../ref_vol'                            ; Initial starting volume (== ref vol) (one)   
 
 IF ( [steptype] <= 0) THEN
    GLO [win_dir] = '../win_0'                                    ; Dir. used for alignment
 ELSE
    GLO [win_dir] = '../win_1'                                    ; Dir. used for reconstruction or refinement
 ENDIF

 GLO [sel_group]        = '[win_dir]/sel_group'                   ; Group selection doc file         (one)

 GLO [sel_parts]        = '[win_dir]/sel_part_{***[grp]}'         ; Particle selection doc files     (one/group)

 ; The variable: [unaligned_images] must be an absolute path to images or a link to an absolute path! 
 GLO [unaligned_images] = '[win_dir]/data_{***[grp]}'             ; Original unaligned images stack  (one/group)
               
 ; OPTIONAL local dir for speeding up parallel use 
 GLO [local_work_dir]   = '/scratch'                              ; OPTIONAL local scratch dir for parallel use (one)

 ; OPTIONAL doc file needed if using symmetry                         
 GLO [symmetry_doc]     = '*'                                     ; OPTIONAL symmetry doc file for 'back projection' (one)

 ; -------------- Output files -- Usually no need to edit for default reconstruction ----------

 IF ( [steptype] <= 0) THEN
    GLO [rec_dir]          = '../rec_0/'                          ; Dir. for files from alignment
 ELSE
    GLO [rec_dir]          = '../rec_1'                           ; Dir. for files from reconstruction 
 ENDIF

 GLO [work_dir]            = 'work/'                              ; Dir. for scratch files

 GLO [aligned_images]      = '[rec_dir]/dala_01_{***[grp]}'       ; Aligned image data                 (one/group)

 GLO [vol]                 = '[rec_dir]/vol_00'                   ; Current volume == ref. volume      (one)  

 GLO [next_vol]            = '[rec_dir]/vol_01'                   ; Next volume stem   
 GLO [next_vol_s]          = '[next_vol]_s{*[s]}'                 ; Filtered, shifted volumes          (two)

 GLO [group_vol_stem]      = '[work_dir]/vol_00_{***[grp]}_***'   ; Current group volumes              (two/group) 
 GLO [next_group_vol]      = '[work_dir]/vol_01_{***[grp]}'       ; Next group volume                  (one/group)   

!GLO [next_group_vol_stem] = '[work_dir]/vol_01_***_s{*[s]}'      ; Next group volume stem
 GLO [next_group_vol_stem] = '[work_dir]/vol_{**[next-iter]}_***_s{*[s]}' ; Next subset group volume stem       
 GLO [next_group_vol_s]    = '[next_group_vol]_s{*[s]}'           ; Next group volume                  (two/group)

 GLO [next_group_align]    = '[rec_dir]/align_01_{***[grp]}'      ; Next group alignment doc file stem 

 GLO [iter_refangs]        = '[rec_dir]/ref_angs_00'              ; Reference projection angle file      (one)
 GLO [iter_refangs_grp]    = '[work_dir]/ref_angs_00_{***[grp]}'  ; Reference projection angles doc file (one/group) (deleted)

 GLO [ref_projs]           = '[rec_dir]/ref_projs_00'             ; Reference projections              (one)
 GLO [ref_view_list]       = '[rec_dir]/sel_proj'                 ; List of reference views            (one)

 GLO [fsc_mask]            = '[rec_dir]/fsc_mask'                 ; Mask for FSC                       (one) 
 GLO [next_u_fsc]          = '[rec_dir]/fscdoc_u_01'              ; Unmasked FSC curve doc file        (one)
 GLO [next_m_fsc]          = '[rec_dir]/fscdoc_m_01'              ; Masked   FSC curve doc file        (one)
 GLO [next_gm_fsc]         = '[rec_dir]/fscdoc_gm_01'             ; Masked   gold-standard FSC curve doc file (one only if legacy)
 GLO [fscplots]            = 'fsc_iter.gnu'                       ; Gnuplot script for FSC plotting    (one) 

 GLO [iter_resol]          = '[rec_dir]/resolutions'              ; Overall resolution doc file        (one)
       
 GLO [ref_rings]           = '[work_dir]/SCR_00_{***[grp]}'       ; OPTIONAL Reference rings files output     (one/group)
 GLO [wait_file]           = 'jnk_waited_***'                     ; OPTIONAL Created when local copy finished (one/group)

 GLO [part2global]         = '[win_dir]/part2glonum_***'          ; OPTIONAL Global particle lookup table     (one/group) 
 GLO [global2grp_lut]      = '[win_dir]/global2group'             ; OPTIONAL Combined global lookup table  (one)

 GLO [finished_file]       = 'jnk_sync_{****[rn]}_{***[grp]}'     ; Created when parallel segment finished     (one/group)

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

 ; ---- Usually no need to adjust following parameters 

 [r2] = INT([diam]/(2.0*[sp_pixsiz]))   ; Alignment radius (pixels) used in alignment search

 ; Ensure that sum of alignment radius + translation is within window dimensions 
 [ring-sh] = [r2] + [alignsh]           ; Last ring + translation step
 [maxrad]  = INT([sp_winsiz]/2) - 1     ; Max radius of object in window

 IF ( [ring-sh] >= [maxrad] ) THEN
   ; Must reduce radius of outer ring, not translation step
   [r2] = [maxrad] - [alignsh] - 2      ; Reduces rotational search radius 
 ENDIF

 [prj-radius] = INT(([win-frac]*[sp_winsiz])/2.0 )  ; Convert fraction to pixel radius

 RE
 ;