ttrefine
refines defocus, astigmatism, tiltaxis and tiltangle in images of thin tilted crystals.
C******************************************************************************* C C TTREFINE : refines defocus, astigmatism, tiltaxis and tiltangle in images C of thin tilted crystals. C VERY IMPORTANT NOTE : The quality of image data required for success C in this type of least squares refinement is high, particularly C if more than one parameter is to be refined. BE VERY CAREFUL. C C Version 1.01 9 Dec 1985 RH C Version 1.02 27 Dec 1985 RH C Version 1.03 13 Sep 1986 JMB Corr stat interm output. C Version 1.04 1 May 1987 RH Allows points off curve C Version 1.05 1 July 1987 RH Allows NX.ne. NY C Version 1.06 2 July 1987 JMB Allows up to 800 spots C Version 1.07 28 Oct 1987 JMB ISHIFT option on card 1 C Version 1.08 2 Nov 1987 JMB IREF=0 option on card 1 C Version 1.09 7 Dec 1987 JMB Some tidying C Version 1.10 30 Dec 1987 RH Correction to TANGL sign C Version 1.11 19 Feb 1988 JMB Some Format alterations C Version 1.12 30 Mar 1989 RH FSHIFT drops if oscill. C Version 1.13 8.Jun 1989 JMB Better converg. test & formats. C Version 1.14 14 Jun 1989 RH IQ=9 added. C Version 2.00 3 Jan 1992 RH Convert to UNIX for Alliant C Version 2.01 25 Jul 1995 RH Convert to Alpha, extraneous bit C Version 2.02 4 Jul 1999 RH add mtz input, remove all lcf C Version 2.03 30 Oct 1999 RH STOP if ISHIFT=T and NCYC.gt.1 C Version 2.04 29 Mar 2000 JMS irtorg mod to include zorigin C Version 2.05 29 Oct 2001 RH change FILIN to CHARACTER*80 C Version 3.00 30 Oct 2005 HS 2dx C C DATACARDS : C C 1. IMODE,NCYC,FSHIFT,LIST,MTZ,MAXIM,LISTS,ISHIFT,IREF (*) C C 2. FILIN -- full name of input file (.FFT) C C 3. ISIZEX,ISIZEY,DSTEP,XMAG,CS,KVOLT (*) C C 4. NUMSPOT, NOH, NOK, NHOR, NVERT (*) C C 5. RESMIN, RESMAX (*) C C 6. AX, AY, BX, BY (*) C C 7. ISPGRP,ORIGH,ORIGK,REVHK,ROT180,SGNXCH (*) C C 8. DFMID1,DFMID2,ANGAST,TLTAXIS,TLTANGL (*) These are parameters which C can be refined. C 9. LABIN FC=F SIGFC=SIGF PHCAL=PHS FOM=FOM ## Program uses SIGFC as test for C the presence of F and FOM as C test for presence of phase. This C data is input on stream HKLIN C C C IMODE if = 1 Defocus refined C = 2 Defocus and astigmatism refined. C = 3 Tiltaxis refined. C = 4 Tiltangle refined. C = 5 All five parameters refined. C NCYC Maximum number of cycles of refinement. C FSHIFT Fractional shifts to be applied at each cycle. C LIST if T, list spots whose amps and phases will be used, C and list their resulting details. C MTZ if T, reads in ref amplitudes from MTZ(or non-MTZ) file. C if F, uses dummy amplitudes, in which case the various C R-factors and residuals do not mean a lot. C MAXIM IF T, the program simply maximises the corrected diffraction C spot intensities. C if F, the program minimises the rms R-factor against MTZ amps. C LISTS IF T, write output to data set 10 for use in statistics C program C ISHIFT IF T, adds 1/3(ax + bx); 1/3(ay +by) to lattice points for use C in control calculations. If F does nothing. As an added C caution, ISHIFT.eq.T requires NCYC.lt.2 C IREF if = 0 Set IREF=0. Read formatted data h,k,a,p; not MTZ file C = 1 Use MTZ file ---- only needed if MTZ.eq.T C C ISIZEX size of image, used to check against image file-header. C ISIZEY C DSTEP densitometer stepsize in microns. C XMAG magnification of micrograph. C CS spherical aberration coefficient in mm. C KVOLT microscope voltage in KV, used to calculate wavelength. C NUMSPOT number of spots to be printed out at each cycle. C NOH, NOK number of orders of spots in H & K directions to be generated. C NHOR, NVERT box size in grid units in horizontal & vertical directions, C i.e. X & Y resp. ( up to 20 grid units in each C direction). C RESMIN, RESMAX inner & outer resolution limits in Angstroms within which C spots(centre of box) must fall. C AX,AY,BX,BY coordinates in grid units of 1,0 & 0,1 spots C respectively. C DFMID1 defocus in one direction (underfocus +ve) C DFMID2 defocus at 90-degs to above C ANGAST direction for DFMID1 in degrees relative to x,y in transform. C TLTAXIS direction of tiltaxis in degrees relative to x,y in transform, C should be between -90 and +90 degrees. C TLTANGL magnitude of tiltangle. C (+ve for less underfocus at start of scan(y=0)) C (or if TLTAXIS is parallel to y, at x=0) C ISPGRP two-dimensional space group number (1 - 17) C ORIGH,ORIGK phase origin shifts for (1,0) and (0,1) reflection to bring C phases to the precise crystallographic origin (from ORIGMERG). C REVHK reverses H and K before comparing to reference data. C ROT180 rotates by 180 degs about c-axis. (needed in p3) C SGNXCH rotates by 180 degs about a-axis. (needed in p121) C C The function which this program minimises (when MTZ=.TRUE. and MAXIM=.FALSE.) C is :- C C L = Sum of [1/sigma**2]*[Aobs-Aed*]**2 C C where Aed is the scaled (sf+tf) C electron diffraction data. C and Aobs is the result of con- C volution of the F.T. of the C image with the F.T. of the C function of ctf with position. C See Henderson et al, Utramic.(1986). C C******************************************************************************* C