@@ -73,10 +73,12 @@ void pyne::_load_atomic_mass_map() { |
73 | 73 | H5Dclose(atomic_mass_set); |
74 | 74 | H5Fclose(nuc_data_h5); |
75 | 75 |
|
76 | | - // Ok now that we have the array of stucts, put it in the map |
| 76 | + // Ok now that we have the array of structs, put it in the map |
77 | 77 | for(int n = 0; n < atomic_mass_length; n++) { |
78 | | - atomic_mass_map[atomic_mass_array[n].nuc] = atomic_mass_array[n].mass; |
79 | | - natural_abund_map[atomic_mass_array[n].nuc] = atomic_mass_array[n].abund; |
| 78 | + atomic_mass_map.insert(std::pair<int, double>(atomic_mass_array[n].nuc, \ |
| 79 | + atomic_mass_array[n].mass)); |
| 80 | + natural_abund_map.insert(std::pair<int, double>(atomic_mass_array[n].nuc, \ |
| 81 | + atomic_mass_array[n].abund)); |
80 | 82 | } |
81 | 83 |
|
82 | 84 | delete[] atomic_mass_array; |
@@ -91,12 +93,8 @@ double pyne::atomic_mass(int nuc) { |
91 | 93 | nuc_end = atomic_mass_map.end(); |
92 | 94 |
|
93 | 95 | // First check if we already have the nuc mass in the map |
94 | | - double aw; |
95 | 96 | if (nuc_iter != nuc_end) { |
96 | | - aw = nuc_iter->second; |
97 | | - if (aw != 0.0) { |
98 | | - return (*nuc_iter).second; |
99 | | - } |
| 97 | + return (*nuc_iter).second; |
100 | 98 | } |
101 | 99 |
|
102 | 100 | // Next, fill up the map with values from the |
@@ -107,21 +105,26 @@ double pyne::atomic_mass(int nuc) { |
107 | 105 | return atomic_mass(nuc); |
108 | 106 | } |
109 | 107 |
|
| 108 | + double aw; |
110 | 109 | int nucid = nucname::id(nuc); |
111 | 110 |
|
112 | 111 | // If in an excited state, return the ground |
113 | 112 | // state mass...not strictly true, but good guess. |
114 | 113 | if (0 < nucid%10000) { |
115 | 114 | aw = atomic_mass((nucid/10000)*10000); |
116 | | - atomic_mass_map[nuc] = aw; |
| 115 | + if (atomic_mass_map.count(nuc) != 1) { |
| 116 | + atomic_mass_map.insert(std::pair<int, double>(nuc, aw)); |
| 117 | + } |
117 | 118 | return aw; |
118 | 119 | }; |
119 | 120 |
|
120 | 121 | // Finally, if none of these work, |
121 | 122 | // take a best guess based on the |
122 | 123 | // aaa number. |
123 | 124 | aw = (double) ((nucid/10000)%1000); |
124 | | - atomic_mass_map[nuc] = aw; |
| 125 | + if (atomic_mass_map.count(nuc) != 1) { |
| 126 | + atomic_mass_map.insert(std::pair<int, double>(nuc, aw)); |
| 127 | + } |
125 | 128 | return aw; |
126 | 129 | }; |
127 | 130 |
|
@@ -170,7 +173,7 @@ double pyne::natural_abund(int nuc) { |
170 | 173 | // state abundance...not strictly true, but good guess. |
171 | 174 | if (0 < nucid%10000) { |
172 | 175 | na = natural_abund((nucid/10000)*10000); |
173 | | - atomic_mass_map[nuc] = na; |
| 176 | + natural_abund_map[nuc] = na; |
174 | 177 | return na; |
175 | 178 | }; |
176 | 179 |
|
|