([doalign],[shrange],[step],[diam],[r1],[r2],[max-wait]) ; Compute alignment parameters and optionally apply them
;
; SOURCE: spider/docs/techs/recon/newprogs/apshgrp.spi   
;                   New                                 Nov 2004 ArDean Leith
;                   Rewritten                           Feb 2005 ArDean Leith
;                   Added alignment option & stack op   Nov 2006 ArDean Leith
;                   SET MP location                     Feb 2008 ArDean Leith
;                   VAR name                            Feb 2010 ArDean Leith
;                   VAR names changed                   Dec 2010 ArDean Leith
;
; PURPOSE: Multi-reference alignment of an image series. 
;          Sample images are aligned with reference projections via
;          shifts (translations) and rotations.  
;          FOR PROJECTS WITH MULTIPLE GROUPS- WITH OR WITHOUT PUBSUB.
;
;------------ Edit next 7 Input parameters ------------------------------ 

[doalign]  = 1     ; If >0 apply alignment to images

[shrange]  = 8     ; Translation search range (must be divisible by step size)
[step]     = 2     ; Translation step size

[diam]     = 348   ; Diameter of object (Angstroms) for alignment search.
                   ;   (EDIT as needed!) Used to find last rotational alignment radius.

[r1]       = 5     ; First rotation alignment ring, only radii > this will be analyzed
[r2]       = 0     ; Last rotation ring (If zero, compute from object diameter)

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

; ----------------- Input files --------------------------------------------

GLOBAL [params]              = '../params'                            ; Parameter setting file

GLOBAL [group_list]          = 'sel_group'                            ; List of defocus groups (doc. file)

GLOBAL [ref_images]          = 'projs/prj_{***[grp]}@'                ; Reference images  

GLOBAL [ref_images_angles]   = 'refangles'                            ; Reference images angles doc. file

GLOBAL [unaligned_images]    = 'data{***[grp]}@'                      ; Unaligned particles images 

GLOBAL [group_particle_list] = 'sel_particles_***'                    ; Group particle list

GLOBAL [mic2global_lut]      = '../Particles/coords/mic2global****'   ; Micrograph-to-particle lookup-table

; ----------------- Output files ------------------------------------------------

GLOBAL [temp_images]         = '_8@'                                  ; Local stacks (if fits in memory)
;GLOBAL [temp_images]         = '/var/tmp/data{***[grp]}@'             ; Local stacks (if doesn't fit in memory)

GLOBAL [align_parameters]    = 'align_01_***'                         ; Alignment parameters doc. file 

GLOBAL [align_params_all]    = 'align_01_all'                         ; Combined alignment parameters

GLOBAL [aligned_images]      = 'dala01_{***[grp]}@'                   ; Rotated, shifted (aligned) particles

GLOBAL [dummy_wait_file]     = 'jnk_apshwait***'                      ; Dummy file created when finished copying

GLOBAL [finished_flag]       = 'flag-apsh-done_{***[grp]}'            ; Dummy file created when finished

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

RE

;