.. _userdefined: [ T-Userdefined ] section ================================================== This tally is used for estimating and outputting physical quantities that cannot be calculated by the other tallies. To use this tally, the user must change ``usrtally.f`` and re-compile PHITS. When **[t-userdefined]** is defined in an input file, PHITS calls the subroutine ``usrtally`` at each moment in the PHITS simulation, that is, with the same timing used for calling the **dumpall** option. A subroutine for outputting all information is written in the default of ``usrtally.f``, and the user can set the output so that only required information is output by revising this file. Please see the read-me file or sample input file in ``/phits/utility/usrtally/`` for more details. In **[t-userdefined]**, several parameters can be used: **file**, for specifying a file name; **nudtvar**, for specifying the number of variables **udtvar(i)**; **udtvar(i)** [#udtvar-note]_, for specifying a numerical value. These parameters can be used in the subroutine ``usrtally`` without recompiling PHITS. .. rst-class:: no-caption-number .. list-table:: **file** :header-rows: 0 * - value - explanation * - file name - Output file names used in the usrtally subroutine. A maximum of 50 files can be used, and the device numbers of these files are from 151 to 200. .. rst-class:: no-caption-number .. list-table:: **nudtvar** :header-rows: 0 * - value - explanation * - 0 (default) - The number of available **udtvar(i)**. .. rst-class:: no-caption-number .. list-table:: **udtvar(i)** :header-rows: 0 * - value - explanation * - Numerical value (D=0) - Parameters used in the usrtally subroutine. These can be defined up to **i=nudtvar**. .. code-block:: text :caption: An example input for **[t-userdefined]** 1: file = output1.dat <-its device number is iudtf(1)=151 2: file = output2.dat <-its device number is iudtf(2)=152 3: nudtvar = 2 <-nudtvar 4: udtvar(1) = 20.0 <-udtvar(1) 5: udtvar(2) = -10.0 <-udtvar(2) The following parameters can be used in the subroutine ``usrtally``. 1. **NCOL** This is an intrinsic variable in the program and denotes identification of process. .. code-block:: text :caption: Meaning of **NCOL** NCOL 1 : start of calculation 2 : end of calculation 3 : end of a batch 4 : source 5 : detection of geometry error 6 : recovery of geometry error 7 : termination by geometry error 8 : termination by weight cut-off 9 : termination by time cut-off 10 : geometry boundary crossing 11 : termination by energy cut-off 12 : termination by escape or leakage 13 : (n,x) reaction 14 : (n,n'x) reaction 15 : sequential transport only for tally 16 : surface cross for WW of xyz mesh 2. **npe, me** These are the number of used PEs, Processor Elements, and ID number of each processor, respectively, in the distributed-memory parallel computing. 3. **ipomp, npomp** These are ID number of each core and the total number of used cores, respectively, in the shared memory parallel computing. 4. **iusrtally** This is a parameter to control whether the subroutine ``usrtally`` is used or not. If **[t-userdefined]** is defined in an input file, this parameter is set to 1. 5. **iudtf(50)** These are device numbers of output files defined with **file=**. For example, if there is the earliest file defined in **[t-userdefined]**, its device number is **iudtf(1)=151**. 6. **nudtvar** The number of available **udtvar(i)**. This is given as **nudtvar** in the input file. 7. **udtvar(i)** These are numerical values defined as **udtvar(i)** in the input file. **udtvar(i)** up to **i=nudtvar** can be used. If **udtvar(i)** is not defined in the input file, it is set to 0. 8. **NOCAS, NOBCH, RCASC, RSOUIN** .. code-block:: text :caption: Meaning of **NOCAS**, **NOBCH**, **RCASC**, and **RSOUIN** NOCAS : current history number in this batch NOBCH : current batch number RCASC : real number of NOCAS+maxcas*(NOBCH-1) RSOUIN : sum of the weight of source particle 9. **NO, IDMN, ITYP, KTYP, JTYP, MTYP, RTYP, OLDWT** .. code-block:: text :caption: Meaning of **NO**, **IDMN**, **ITYP**, **KTYP**, **JTYP**, **MTYP**, **RTYP**, and **OLDWT** NO : cascade id in this history IDMN : material id ITYP : particle type KTYP : particle kf-code JTYP : charge number of the particle MTYP : baryon number of the particle RTYP : rest mass of the particle (MeV) OLDWT : weight of the particle at (x,y,z) 10. **QS** This is :math:`dE/dx` for electrons at (x,y,z). 11. **IBLZ1, IBLZ2, ILEV1, ILEV2** Meaning of **IBLZ1**, **IBLZ2**, **ILEV1**, and **ILEV2**:: IBLZ1 : cell id at (x,y,z) IBLZ2 : cell id after crossing ILEV1 : level structure id of the cell at (x,y,z) ILEV2 : level structure id of the cell after crossing **ILAT1** and **ILAT2** are variables of level structure of cell. 12. **COSTH, UANG(1), UANG(2), UANG(3), NSURF** .. code-block:: text :caption: Meaning of **COSTH**, **UANG(1-3)**, and **NSURF** COSTH : cosine of an angle of incidence in a surface crossing UANG(1,2,3) : x,y,z component of a normal vector of its surface, respectively NSURF : internal number of the surface This is different from the surface number defined in **[surface]**. 13. **NAME, NCNT(1), NCNT(2), NCNT(3)** .. code-block:: text :caption: Meaning of **NAME** and **NCNT(1-3)** NAME : collision number of the particle NCNT(1,2,3) : values of counter 1, 2, and 3 14. **WT, U, V, W** .. code-block:: text :caption: Meaning of **WT**, **U**, **V**, and **W** WT : weight of the particle at (xc,yc,zc) U, V, W : unit vector of momentum of the particle 15. **E, T, X, Y, Z** .. code-block:: text :caption: Meaning of **E**, **T**, **X**, **Y**, and **Z** E : energy of the particle at (x,y,z) (MeV) T : time of the particle at (x,y,z) (nsec) X, Y, Z : position coordinate of the preceding event point (cm) 16. **EC, TC, XC, YC, ZC** .. code-block:: text :caption: Meaning of **EC**, **TC**, **XC**, **YC**, and **ZC** EC : energy of the particle at (xc,yc,zc) (MeV) TC : time of the particle at (xc,yc,zc) (nsec) XC, YC, ZC : position coordinate of the particle (cm) 17. **SPX, SPY, SPZ** .. code-block:: text :caption: Meaning of **SPX**, **SPY**, and **SPZ** SPX, SPY, SPZ : unit vector of spin direction of the particle 18. **NZST** This is charge state of the particle. 19. **NCLSTS** This variable means the number of produced particle and nucleus. **MATHZ, MATHN, JCOLL, KCOLL** Meaning of **MATHZ**, **MATHN**, **JCOLL**, and **KCOLL**:: MATHZ : Z number of the mother nucleus MATHN : N number of the mother nucleus JCOLL : reaction type id1 KCOLL : reaction type id2 **JCOLL** and **KCOLL** indicate the following meaning. .. code-block:: text :caption: Meaning of **JCOLL** JCOLL 0 : nothing happen 1 : Hydrogen collisions 2 : Particle Decays 3 : Elastic collisions 4 : High Energy Nuclear collisions 5 : Heavy Ion reactions 6 : Neutron reactions by data 7 : Photon reactions by data 8 : Electron reactions by data 9 : P,d,a, and photo-nuclear reactions by data 10 : Neutron event mode 11 : Delta Ray production 12 : Muon atomic interaction 13 : Photon reactions by EGS5 14 : Electron reactions by EGS5 15 : Photon photonuclear interaction 16 : Negative muon captured by nucleon 17 : Muon photonuclear interaction 18 : Electron recoil by track structure mode 19 : Muon pair production (photon -> mu+ mu-) 20 : User defined interaction Meaning of **KCOLL**:: KCOLL 0 : normal 1 : high energy fission 2 : high energy absorption 3 : low energy n elastic 4 : low energy n non-elastic 5 : low energy n fission 6 : low energy n absorption **ICLUSTS, JCLUSTS, QCLUSTS, JCOUNT** These variables have an array and denote the information on the produced particle and nucleus. .. code-block:: text :caption: Meaning of **ICLUSTS** ICLUSTS 0 : nucleus 1 : proton 2 : neutron 3 : pion 4 : photon 5 : kaon 6 : muon 7 : others .. code-block:: text :caption: Meaning of **JCLUSTS(i)** JCLUSTS(i) i = 0 : angular momentum = 1 : proton number = 2 : neutron number = 3 : ityp = 4 : status of the particle, 0: real, <0: dead = 5 : charge number = 6 : baryon number = 7 : kf code = 8 : isomer level (0: ground state, 1: first isomer, 2: second isomer) .. code-block:: text :caption: Meaning of **QCLUSTS(i)** QCLUSTS(i) i = 0 : impact parameter = 1 : x-component of unit vector of momentum = 2 : y-component of unit vector of momentum = 3 : z-component of unit vector of momentum = 4 : e_tot = sqrt(p^2 + m^2) (GeV) = 5 : rest mass (GeV) = 6 : excitation energy (MeV) = 7 : kinetic energy (MeV) = 8 : weight = 9 : time (nsec) = 10 : x coordinate (cm) = 11 : y coordinate (cm) = 12 : z coordinate (cm) .. [#udtvar-note] This parameter plays the same role as **udtparai**, :math:`i=0-9`, before version 3.01. **udtpara$i$** can also be set after version 3.02.