c	spur_buf.inc
c	Common block variables containing ALL info in the qbuffer
c	and the LPI buffer. Do it this way, so may continuously update
c	during the program and then output modifications to files
c	or the screen or the plot.

c	Note: The common blocks could be converted to a structure.

c...	the q-buffer from ICP program, in order of appearance
      CHARACTER*17 qb_bufnum
      CHARACTER*60 qb_comment
c234567
      real*4 qb_lattice_a(3)	!! lattice parameters [A]
      real*4 qb_lattice_angle(3)!! angles alpha, beta, gamma [degrees]

      real qb_energy_ec		!! Center energy of scan [meV]
      real qb_energy_es		!! energy step of scan [meV]
      real qb_energy_fe		!! fixed energy on analyzer/monitor [meV]
      CHARACTER*5 qb_energy_fix	!! Which mono-chrometer e is fixed?['(ANA)'/'(MON)']
      real qb_energy_dM		!! Monitor's lattice parameter [A]
      real qb_energy_dA		!! Analyzer's lattice parameter [A]

      real*4 qb_space_hc(3)	!! Center hkl-s of scan	[A^-1]
      real*4 qb_space_hs(3)	!! step hkl-s of scan	[A^-1]

      integer qb_orient_u(3)	!! plane of scattering: u vector [Miller, unitless]
      real qb_orient_angle	!! Unused by ICP.
      integer qb_orient_v(3)	!! plane of scattering: v vector [Miller, unitless]

c		The temperature info is not used with/in the program,
c		but it is included so that the resulting output file
c		looks like the input file.
      real qb_temp_T0		!! temperature [K] 
      real qb_temp_incT		!! increment temperature [K]
      real qb_temp_wait		!! Wait time for T to settle down (or less) [min]
      real qb_temp_err		!! Tolerance for temperature [K]
      real qb_temp_hold0	!! Wait time before 1st point [min]
      real qb_temp_hold		!! Wait time between points [min]
      character*7 qb_temp_str1	!! 'FIELD' or ??
      
      integer qb_time_monitor	!! Number of monitor events [unitless]
      real qb_time_prefact	!! Monitor counts prefactor [unitless]
      character*4 qb_time_mtype	!!Length of run det'd by 'TIME' or mon events 'NEUT'
      integer qb_time_scanpts	!! Number of ponts in scan 
	 			!! (see qb_energy* and qb_space*).
      character*4 qb_time_str1		!! ?? 'AMON'
      character*4 qb_time_str2		!! ?? 'POLA'
      character*4 qb_time_str3		!! ?? 'FKEY'

      common /cb_qbuf/	!! order by type to avoid crossing 4-btye boundaries.
     &	qb_lattice_a, qb_lattice_angle, 		!! real
     &	qb_energy_ec, qb_energy_es, qb_energy_fe, 	!! real
     &	qb_energy_dM, qb_energy_dA, qb_space_hc, qb_space_hs, !! real
     &  qb_orient_angle,				 !! real
     &	qb_temp_T0, qb_temp_incT, qb_temp_wait, qb_temp_err, !! real
     &	qb_time_monitor, qb_time_prefact, 		!! real
     &	qb_temp_hold0, qb_temp_hold,			!! real
     &  qb_time_scanpts,				!! integer 
     &	qb_orient_u, qb_orient_v, 			!! integer
     $  qb_time_mtype, 					!! string
     &	qb_temp_str1, qb_time_str1, qb_time_str2, qb_time_str3,	!! string
     &  qb_bufnum, qb_comment, 	qb_energy_fix			!! string

c... Items included in the header of data file *.bt* 
c...	(called BTX files by Carl Adams) in order of appearance.
c...	Items which duplicate the qb_* variables use EQUIVALENCE.
c...	Items which are difference than qbufffer variables go into a common block.
c...	First line
      character*40 qd_filename	!! 'prossoo7.bt2'
      character*19 qd_date	!! '12-aug-2001 12:43'
      character*3 qd_scanstyle	!! 'Q'
      integer qd_monitor	!! monitor counts [unitless]
      equivalence (qd_monitor, qb_time_monitor)
      real qd_prefactor		!! monitor counts prefactor real? [unitless]
      equivalence (qd_prefactor, qb_time_prefact)
      character*4 qd_base 	!! Length of run det'd by 'TIME' or mon events 'NEUT'
      equivalence (qd_base, qb_time_mtype)
      integer qd_scanpts	!! number of points in scan 
      equivalence (qd_scanpts, qb_time_scanpts) 
      character*5 qd_type

c...	third line
	!! File name PROSS007.BT2 = <dq_fileprefix><run#=007>.<instrument=BT2>
      character*20 qd_fileprefix	!! PROSS
      character*40 qd_comment		!! comment, name of sample or chemical comp.

c...	fourth line
      integer qd_collimation(4)
      real qd_mosaic(3)
      integer qd_u(3)		!! plane of scattering: u vector [unitless]
      equivalence (qd_u, qb_orient_u)
      real qd_angle		!! Unused by ICP.
      equivalence (qd_angle,qb_orient_angle) 
      integer qd_v(3)		!! plane of scattering: v vector [unitless]
      equivalence (qd_v, qb_orient_v)

c... 	sixth line
      real*4 qd_lattice_a(3)		!!  lattice parameters [A]
      equivalence (qd_lattice_a,  qb_lattice_a)
      real*4 qd_lattice_angle(3)	!! angles alpha, beta, gamma [degrees]
      equivalence (qd_lattice_angle,  qb_lattice_angle)

c...	eight line 
      real qd_ec		!! Center energy of scan [meV]
      equivalence ( qd_ec, qb_energy_ec)
      real qd_es		!! energy step of scan [meV]
      equivalence ( qd_es, qb_energy_es)
      real qd_fe		!! fixed energy on analyzer/monitor [meV]
      equivalence ( qd_fe, qb_energy_fe)
      real qd_dM		!! Monitor's lattice parameter [A?]
      equivalence ( qd_dM, qb_energy_dM)
      real qd_dA		!! Analyzer's lattice parameter [A?]
      equivalence ( qd_dA, qb_energy_dA)
      real qd_temp_T0		!! temperature [K] 
      equivalence ( qd_temp_T0, qb_temp_T0)
      real qd_temp_incT		!! increment temperature [K]
      equivalence ( qd_temp_incT, qb_temp_incT)

c...	nineth line
      CHARACTER*2 qd_ana_or_mon	!! Which mono-chrometer e is fixed?['EA'/'EM']
     				!! Needs to be coordinated with qb_energy_mon

c...	tenth line
      real*4 qd_space_hc(3)	!! Center hkl-s of scan	[unitless]
      equivalence ( qb_space_hc, qd_space_hc)
      real*4 qd_space_hs(3)	!! step hkl-s of scan	[unitless]
      equivalence ( qb_space_hs, qd_space_hs)
      real qd_hfield		!! Is this related to hld0 and hld?


c...	the data file common block contains the info from data file header *.BT*
c...	which is not mapped by EQUIVALENCE to the qbuffer common block cb_qbuf       
      common /cb_qdata/ !! order by type to avoid crossing 4-btye boundaries.
     &  qd_mosaic, qd_hfield,				!! real
     &  qd_collimation, 				!! integer 
     &  qd_filename, qd_date, qd_scanstyle,  qd_type,	!! string
     &	qd_fileprefix, qd_comment, qd_ana_or_mon 	!! string
