(x10,x11,x76) ; Creates align doc file
;
; makealigndoc.pam        ArDean Leith Apr 2003
;
; MASTER COPY: /net/bali/usr1/spider/docs/techs/recon/programs/
;
; PURPOSE: Copies angles & trans. doc files into new align doc file
;
; I/O Registers and files are set in: refine settings refine settings.pam.pam); INPUT REGISTERS:
;
; INPUT REGISTERS):
;    x10                        Defocus group set start
;    x11                        Defocus group set end
;    x76                        Iteration in use

FR G
[group_trans]final/trans{**x76}_{***x77}    ; Current group translations doc files
FR G
[group_angles]final/angles{**x76}_{***x77}  ; Group angles files (iter 2...)


x60=1    ; Starting image number

DO LB1 x78=x10,x11                ; Loop over defocus group set  
   UD S,x78,x77                   ; Get defocus group number
   [sorted_order_select]

   DE
   [group_align]                  ; Next align. doc file

   UD IC,x77,x61                  ; Set x61=number of particles in group
   [order_select]                 ; Need this input file

   DO LB2 x50=x60,x61             ; Loops over images 

      UD IC,x50,x66,x67,x68       ; Retrieve angles
      [group_angles]              ; Angles input doc file  

      UD IC,x50,x61,x62,x63,x64   ; Retrieve translations
      [group_trans]               ; Translations input doc file 

      UD IC,x50,x99,x82,x99,x99,x99,x99,x12 ; Retrieve cc and ang. diff.
      [group_apmd]                ; APMD input doc file (made by AP MD) 

      ; Save alignment parameters
      ; angle, angle, angle, cc, inplane angle, Sx, Sy, mirror, ang. diff
      ; x64=flag for Y-mirror (0-no mirror; 1-mirror)
      ; x12=angular difference in this iteration

      SD x50,x66,x67,x68,x82,x61,x62,x63,x64,x12         
      [group_align]              ; Next align. doc file (output)

   LB2

   UD ICE
   [group_angles]             ; angles input doc file

   UD ICE
   [group_trans]              ; angles input doc file

   UD ICE
   [group_apmd]               ; APMD input doc file

   SD E
   [group_align]              ; Next align. doc file
LB1

RE
;