36 {
37
39 char *endptr, name_[256], AStr[32];
40 char const *ZStr, *alias = NULL;
42
43 char const *yiNames[] = { "p", "h2", "h3", "he3", "he4", "photon" };
44 char const *yiAliases[] = { "h1", "d", "t", "he3", "a", "g" };
45
46
47
48 if( special == NULL ) special = "";
49 if( index < 0 ) {
50 if( isdigit( name[0] ) ) {
51 ZA = (int) strtol( name, &endptr, 10 );
52 if( *endptr != 0 ) {
54 return( -1 );
55 }
56 Z = ZA / 1000;
58
59 ispecial = 0;
60 if( strcmp( special, "LLNL" ) == 0 ) {
61 if( ( ZA > 1 ) && ( ZA < 8 ) ) {
62 strcpy( name_, yiNames[ZA-2] );
63 alias = yiAliases[ZA-2];
64
65 ispecial = 1; }
66 else if( ( ZA == 1801 ) || ( ZA == 1901 ) ) {
67 strcpy( name_, yiNames[0] );
68 alias = yiAliases[0];
69
70 ispecial = 1; }
71 else if( ZA == 1902 ) {
72 strcpy( name_, yiNames[1] );
73 alias = yiAliases[1];
74
75 ispecial = 1; }
76 else if( ZA == 4809 ) {
77 strcpy( name_, "Be9" );
78
79 ispecial = 1; }
80 else if( ZA == 4909 ) {
81 strcpy( name_, "Be9" );
82
83 ispecial = 1; }
84 else if( ZA == 6912 ) {
85 strcpy( name_, "C12" );
86
87 ispecial = 1; }
88 else if( ZA == 8916 ) {
89 strcpy( name_, "O16" );
90
91 ispecial = 1; }
92 else if( ZA == 95242 ) {
93 strcpy( name_, "Am242_e2" );
94
95
96 ispecial = 1; }
97 else if( Z == 99 ) {
98 if( ( 120 <= A ) && ( A < 126 ) ) {
99 sprintf( name_, "FissionProductENDL99%d", A );
100
101 ispecial = 1;
102 }
103 }
104 }
105 if( ispecial == 0 ) {
106 if( ZA == 1 ) {
107 AStr[0] = 0; }
108 else if( A == 0 ) {
109 strcpy( AStr, "_natural" ); }
110 else {
111 sprintf( AStr, "%d", A );
112 }
113 if( ( ZStr = lPoPs_ZSymbol( Z ) ) == NULL ) {
115 return( -1 );
116 }
117 sprintf( name_, "%s%s", ZStr, AStr );
118
119
120 } }
121 else {
122 strcpy( name_, name );
123 ZA = -1;
124 if( strcmp( name, "neutron" ) == 0 ) {
125 strcpy( name_, "n" );
127 }
128 else if( strcmp( name, "electron" ) == 0 ) {
129 strcpy( name_, "e-" );
131 }
132 else if( strcmp( name, "positron" ) == 0 ) {
133 strcpy( name_, "e+" );
135 }
136 else if( ( strcmp( name, "h1" ) == 0 ) || ( strcmp( name, "proton" ) == 0 ) ) {
137 ZA = 2; }
138 else if( ( strcmp( name, "d" ) == 0 ) || ( strcmp( name, "deuteron" ) == 0 ) ) {
139 ZA = 3; }
140 else if( ( strcmp( name, "t" ) == 0 ) || ( strcmp( name, "triton" ) == 0 ) ) {
141 ZA = 4; }
142 else if( strcmp( name, "helium3" ) == 0 ) {
143 ZA = 5; }
144 else if( ( strcmp( name, "a" ) == 0 ) || ( strcmp( name, "alpha" ) == 0 ) || ( strcmp( name, "helium4" ) == 0 ) ) {
145 ZA = 6; }
146 else if( ( strcmp( name, "g" ) == 0 ) || ( strcmp( name, "gamma" ) == 0 ) ) {
147 ZA = 7; }
148 else if( strcmp( name, "FP" ) == 0 ) {
149 strcpy( name_, "FissionProductENDL99120" );
150
151 }
152 if( ZA != -1 ) {
153 strcpy( name_, yiNames[ZA-2] );
155
156 }
157 }
158
161 return( -1 );
162 }
165
167 if( ( pop =
PoP_makeAlias( smr, name_, name ) ) == NULL )
return( -1 );
169 }
170
171 if( alias != NULL ) {
173 if( ( pop =
PoP_makeAlias( smr, name_, alias ) ) == NULL )
return( -1 );
175 }
176 }
177 }
178 return( index );
179}
double A(double temperature)
@ PoPs_errorToken_badName
int PoPs_particleIndex(char const *name)
PoP * PoPs_particleCreateLoadInfo(statusMessageReporting *smr, const char *name)
PoP * PoP_makeAlias(statusMessageReporting *smr, char const *name, char const *alias)
PoP * PoPs_addParticleIfNeeded(statusMessageReporting *smr, PoP *pop)
const char * name(G4int ptype)
#define smr_setReportError2(smr, libraryID, code, fmt,...)