48 #if defined __cplusplus
59 static struct ZSymbol ZSymbols[] = { { 0,
"n" }, { 1,
"H" }, { 2,
"He" }, { 3,
"Li" }, { 4,
"Be" }, { 5,
"B" }, { 6,
"C" },
60 { 7,
"N" }, { 8,
"O" }, { 9,
"F" }, { 10,
"Ne" }, { 11,
"Na" }, { 12,
"Mg" }, { 13,
"Al" }, { 14,
"Si" }, { 15,
"P" },
61 { 16,
"S" }, { 17,
"Cl" }, { 18,
"Ar" }, { 19,
"K" }, { 20,
"Ca" }, { 21,
"Sc" }, { 22,
"Ti" }, { 23,
"V" }, { 24,
"Cr" },
62 { 25,
"Mn" }, { 26,
"Fe" }, { 27,
"Co" }, { 28,
"Ni" }, { 29,
"Cu" }, { 30,
"Zn" }, { 31,
"Ga" }, { 32,
"Ge" }, { 33,
"As" },
63 { 34,
"Se" }, { 35,
"Br" }, { 36,
"Kr" }, { 37,
"Rb" }, { 38,
"Sr" }, { 39,
"Y" }, { 40,
"Zr" }, { 41,
"Nb" }, { 42,
"Mo" },
64 { 43,
"Tc" }, { 44,
"Ru" }, { 45,
"Rh" }, { 46,
"Pd" }, { 47,
"Ag" }, { 48,
"Cd" }, { 49,
"In" }, { 50,
"Sn" }, { 51,
"Sb" },
65 { 52,
"Te" }, { 53,
"I" }, { 54,
"Xe" }, { 55,
"Cs" }, { 56,
"Ba" }, { 57,
"La" }, { 58,
"Ce" }, { 59,
"Pr" }, { 60,
"Nd" },
66 { 61,
"Pm" }, { 62,
"Sm" }, { 63,
"Eu" }, { 64,
"Gd" }, { 65,
"Tb" }, { 66,
"Dy" }, { 67,
"Ho" }, { 68,
"Er" }, { 69,
"Tm" },
67 { 70,
"Yb" }, { 71,
"Lu" }, { 72,
"Hf" }, { 73,
"Ta" }, { 74,
"W" }, { 75,
"Re" }, { 76,
"Os" }, { 77,
"Ir" }, { 78,
"Pt" },
68 { 79,
"Au" }, { 80,
"Hg" }, { 81,
"Tl" }, { 82,
"Pb" }, { 83,
"Bi" }, { 84,
"Po" }, { 85,
"At" }, { 86,
"Rn" }, { 87,
"Fr" },
69 { 88,
"Ra" }, { 89,
"Ac" }, { 90,
"Th" }, { 91,
"Pa" }, { 92,
"U" }, { 93,
"Np" }, { 94,
"Pu" }, { 95,
"Am" }, { 96,
"Cm" },
70 { 97,
"Bk" }, { 98,
"Cf" }, { 99,
"Es" }, { 100,
"Fm" }, { 101,
"Md" }, { 102,
"No" }, { 103,
"Lr" }, { 104,
"Rf" }, { 105,
"Db" },
71 { 106,
"Sg" }, { 107,
"Bh" }, { 108,
"Hs" }, { 109,
"Mt" } };
78 return(
sizeof( ZSymbols ) /
sizeof(
struct ZSymbol ) );
87 return( ZSymbols[iZ].
symbol.c_str() );
96 for( i = 0; i <
n; i++ ) {
98 if( !strcmp( Z, ZSymbols[i].
symbol.c_str() ) )
return( ZSymbols[i].Z );
109 char s[1024] =
"", *q, *
e;
114 if( !strncmp(
"FissionProduct", name, 14 ) ) {
119 if( !strcmp(
"gamma", name ) )
return( 0 );
120 for( p = name, q = s, i = 0; ( *p !=
'_' ) && ( i != n ); p++, q++, i++ ) *q = *p;
122 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Failed to find first '_' in particle name %s", name ); }
126 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Particle %s's symbol = '%s' not found", name, s ); }
128 for( p++, q = s; ( *p !=
'_' ) && ( *p != 0 ) && ( i !=
n ); p++, q++, i++ ) *q = *p;
130 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Failed to find second '_' in particle name %s", name ); }
133 if( strcmp( s,
"natural" ) == 0 ) {
137 *A = (
int) strtol( s, &e, 10 );
140 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Failed to convert A to integer in particle name %s", name ); }
146 smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Particle name %s missing meta-stable label 'm'", name ); }
149 *m = (
int) strtol( p, &e, 10 );
150 if( *e != 0 )
smr_setMessageError( smr, NULL, __FILE__, __LINE__, 1,
"Failed to convert m to integer in particle name %s", name );
168 if( !
smr_isOk( smr ) )
return( NULL );
171 if( element != NULL ) {
174 smr_setMessageError( smr, NULL, file, line, 1,
"element does not have attribute named %s for file = %d", name, path );
184 const char *fmt, ... ) {
190 va_start( args, fmt );
195 va_start( args, fmt );
199 status =
smr_setMessageError( smr, userInterface, file, line, code,
"%s for element %s at line %d column %d", msg, element->
fullName,
212 if( d < ds[0] )
return( -2 );
213 if( d > ds[n-1] )
return( -1 );
215 imid = ( imin + imax ) >> 1;
216 if( imid == imin )
break;
300 double xsec = 0.0, e1, e2;
302 if( ( index >= crossSection->
start ) && ( index < crossSection->end ) ) {
303 e1 = energyGrid[
index];
304 e2 = energyGrid[index + 1];
305 index -= crossSection->
start;
307 xsec = 0.5 * ( crossSection->
data[
index] + crossSection->
data[index + 1] ); }
309 xsec = ( crossSection->
data[
index] * ( e2 - e_in ) + crossSection->
data[index + 1] * ( e_in - e1 ) ) / ( e2 - e1 );
353 d = (
double *) &(epbs[list->
n]);
354 for( i = 0, epb = epbs; i < list->
n; i++, epb++ ) {
408 r = rng( rngState ); }
423 int i, j, index1, index2, method = 0;
424 double fE = 1.,
r, value1, value2, value3, P12, P23,
value = -2.;
426 if( e_in <= binned->energies[0].value ) {
433 for( i = 0; i < binned->
numberOfEs - 1; i++ ) {
434 if( e_in <= binned->energies[i].value )
break;
445 j = (
int) (
r * nBins);
446 if( j >= nBins ) j = nBins - 1;
451 if( ( ( j == 0 ) && (
r <= 0.5 ) ) || ( j == ( nBins - 1 ) &&
r > 0.5 ) ) method = 0;
456 value = ( 1. -
r ) * value1 +
r * value2; }
462 P12 = 1. / ( value2 - value1 );
463 P23 = 1. / ( value3 - value2 );
465 if( 0.25 * ( 1.0 + 2.0 * ( value2 - value1 ) / ( value3 - value1 ) ) >
r ) {
466 P23 = 2. / ( value3 - value1 );
469 P12 = 2. / ( value3 - value1 );
473 if( P23 != P12 )
r = ( -P12 + std::sqrt( P12 * P12 * ( 1. -
r ) +
r * P23 * P23 ) ) / ( P23 - P12 );
474 value = 0.5 * ( value1 + value2 +
r * ( value3 - value1 ) );
480 #if defined __cplusplus