Skip to content

Commit

Permalink
Fix #257: rest mass used before it is set in HATCH
Browse files Browse the repository at this point in the history
Initialize prm (precise rest mass) in the COMIN/USEFUL declaration to
fix a critical bug introduced in commit 1eaf898. The bug affects
applications where prm is used before HATCH is called, so at least the
following ones:

HEN_HOUSE/omega/beamnrc/beamnrc.mortran
HEN_HOUSE/user_codes/cavrznrc/cavrznrc.mortran
HEN_HOUSE/user_codes/cavsphnrc/cavsphnrc.mortran
HEN_HOUSE/user_codes/dosxyznrc/dosxyznrc.mortran
HEN_HOUSE/user_codes/sprrznrc/sprrznrc.mortran

In DOSXYZnrc, for example, it affects monoenergetic sources, resulting
in the energy of incident electrons being increased by the value of the
electron rest mass.
  • Loading branch information
rtownson authored and ftessier committed Mar 1, 2017
1 parent 2f6b486 commit 1c1cdb2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 0 additions & 3 deletions HEN_HOUSE/src/egs_utilities.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,6 @@ kmpi = 12; kmpo = 8; dunit = 1;
rng_seed = 999999;
latchi = 0;

" The rest mass value is as recommended by CODATA 2014
" http://physics.nist.gov/cgi-bin/cuu/Value?mec2mev
rm = 0.5109989461;
rmt2 = 2*rm; rmsq = rm*rm;

pi = 4*datan(1d0); twopi = 2*pi; pi5d2 = 2.5*pi;
Expand Down
3 changes: 3 additions & 0 deletions HEN_HOUSE/src/egsnrc.macros
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,9 @@ REPLACE {;COMIN/USEFUL/;} WITH
$REAL RM; "electron mass in MeV"
$INTEGER MEDIUM, "medium index of current region"
MEDOLD; "medium index of previous region"
" The rest mass value is as recommended by CODATA 2014"
" http://physics.nist.gov/cgi-bin/cuu/Value?mec2mev"
DATA RM,PRM,PRMT2,PZERO/0.5109989461,0.5109989461,1.0219978922,0.D0/;
}

"------------------------------------------------------------------"
Expand Down
5 changes: 0 additions & 5 deletions HEN_HOUSE/src/egsnrc.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -1843,11 +1843,6 @@ $INTEGER lnblnk1;" in house lnblnk function becuase not all compilers"
DATA MDLABL/$S' MEDIUM='/,LMDL/8/,LMDN/24/,DUNITO/1./;
DATA I1ST/1/,NSINSS/37/,MXSINC/$MXSINC/,ISTEST/0/,NRNA/1000/;

" SET UP ENERGY PRECISION VARIABLES"
PRM=RM; "PRECISE REST MASS"
PRMT2=2.D0*PRM; "TWICE THE PRECISION REST MASS"
PZERO=0.0D0; "PRECISE ZERO"

$INIT-PEGS4-VARIABLES;

" FORMAT STATEMENTS USED MULTIPLE TIMES IN SETUP"
Expand Down

0 comments on commit 1c1cdb2

Please sign in to comment.