C++ C********* INCLUDE FILE, 'MC_GEOM.INC' ********** C C 08 Feb 1994: converted from COMMON to STRUCTUREs. Added WT, M, and POL to C particle record. Require Y direction to be vertical (for C gravity). [PAS] C 17 Feb 1994: added BETA to surface record; type 5 boundary; made MAXP C a parameter [PAS] C 15 Feb 1995: include structure /MC_ELEMENT/ formerly in MC_ELMNT.INC [PAS] C 04 Dec 1995: larger MAXR, MAXP; replace POL with Q and (PX,PY,PZ) [PAS] C 27 Nov 1997: larger MAXS, MAXR, MAXP (total size 65530 bytes) [LLD,PAS] C 14 Sep 1998: SURFACE and PARAM changed from REAL*4 to REAL*8 [PAS] C 26 Mar 1999: larger MAXS, MAXR, MAXP (total size 121648 bytes) [Fitz,PAS] C 30 Sep 2003: larger MAXS, MAXR, MAXP (total size 227722 bytes) [PAS] C 14 Jun 2005: larger MAXS (total size 314432 bytes) [PAS] C 07 Jul 2006: make MAXM (number of magnetic regions) a parameter [PAS] C 14 Nov 2009: make usage F90 standard: "STRUCTURE" --> "TYPE" [PAS] C C To change dimensions of all arrays, change maximum numbers of C surfaces (MAXS), regions (MAXR), element parameters (MAXP), and/or C magnetic regions (MAXM) in following PARAMETER statement. INTEGER*4 MAXS, MAXR, MAXP, MAXM PARAMETER (MAXS=400, MAXR=255, MAXP=8000, MAXM=50) C C Definitions of surface parameters and array of boundaries of surfaces: C SURFACE is a derived type containing 10 coefficients of a general C quadratic surface, of the form C A*(X**2) + B*X + C*(Y**2) + D*Y + E*(Z**2) + F*Z + G + C P*(X*Y) + Q*(Y*Z) + R*(Z*X) = 0 C BETA = surface roughness parameter between 0 (smooth) and 1 (cosine); C negative or >1 is completely random TYPE SURFACE SEQUENCE REAL*8 A, B, C, D, E, F, G, P, Q, R, BETA END TYPE C C REGION is derived type containing NSURF values of the I*2 variable IGEOM, C defining a region by its bounding surfaces: C + if interior of region is on + side of surface C - if interior of region is on - side of surface C 0 if surface is not a boundary of the region C 1 for ordinary surface described by roughness BETA and possibility C of refraction or critical reflection C 2 for totally reflecting surface C 3 for diffuse scattering surface C 4 for absorbing surface C 5 special action required in previous region before crossing surface C 6 split particle by 2 after crossing surface, treated as type 1 C 10 for boundary of a magnetic field region C +10 for a surface which bounds an embedded region within the region; not C tested to determine if within region, but tested for exit from region C +20 for embedded surface with possible regions on BOTH sides TYPE REGION SEQUENCE INTEGER*2 IGEOM(MAXS) END TYPE C C MC_GEOM is a derived type giving the complete geometry of an instrument C NSURF = number of surfaces defined C NREG = number of regions defined TYPE MC_GEOM SEQUENCE INTEGER*4 NSURF, NREG TYPE(SURFACE) SURFACE(MAXS) TYPE(REGION) REGION(MAXR) END TYPE C C MC_ELEMENT is a derived type with the variables for what happens C to neutrons in a REGION. Each INDEX points to the beginning of a C structure within the contiguous block PARAM. The first entry in C PARAM for each element identifies the type, followed by a varying C number of variables. Element types and parameters are defined in C a separate file, MC_ELMNT.INC C NAME = descriptive name of a region or element C NEXTINDX = pointer to next available location in PARAM C INDEX = pointer into parameter block; C 0 if region is NOT an "element" C PARAM = combined block of parameters for the whole instrument TYPE MC_ELEMENT SEQUENCE CHARACTER*40 NAME(MAXR) INTEGER*4 NEXTINDX, INDEX(MAXR) REAL*8 PARAM(MAXP) END TYPE C C PARTICLE is a derived type giving position, velocity, and polarization C of a neutron or other particle. C (X,Y,Z) = position of particle (m); define -Y = direction of gravity, C +Z = nominal beam direction, +X = right; note left-handed system C (VX,VY,VZ) = velocity of particle (m/us) C TOF = time of flight of particle (us) C M = atomic number of particle (e.g., 1 for neutron, 0 for photon) C Q = charge number of particle (e.g., 0 for neutron, +1 for proton) C WT = statistical weight of particle C (PX,PY,PZ) = average polarization vector, from -1.0 to +1.0 TYPE PARTICLE SEQUENCE REAL*4 X, Y, Z, VX, VY, VZ, TOF REAL*4 M, Q, WT, PX, PY, PZ END TYPE