Changeset c451be9 in sasview for sansmodels/src/sans/models/c_models
- Timestamp:
- Jan 7, 2010 3:04:25 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- dfa8832
- Parents:
- 4cbaf35
- Location:
- sansmodels/src/sans/models/c_models
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/coreshellcylinder.cpp
r15f52f8 rc451be9 82 82 double sum = 0.0; 83 83 double norm = 0.0; 84 double vol = 0.0; 84 85 85 86 // Loop over radius weight points … … 94 95 for(int k=0; k<weights_thick.size(); k++) { 95 96 dp[2] = weights_thick[k].value; 96 97 //Un-normalize by volume 97 98 sum += weights_rad[i].weight 98 99 * weights_len[j].weight 99 100 * weights_thick[k].weight 100 * CoreShellCylinder(dp, q); 101 * CoreShellCylinder(dp, q) 102 * pow(weights_rad[i].value+weights_thick[k].value,2) 103 *(weights_len[j].value+2.0*weights_thick[k].value); 104 //Find average volume 105 vol += weights_rad[i].weight 106 * weights_len[j].weight 107 * weights_thick[k].weight 108 * pow(weights_rad[i].value+weights_thick[k].value,2) 109 *(weights_len[j].value+2.0*weights_thick[k].value); 101 110 norm += weights_rad[i].weight 102 111 * weights_len[j].weight … … 105 114 } 106 115 } 116 117 if (vol != 0.0 && norm != 0.0) { 118 //Re-normalize by avg volume 119 sum = sum/(vol/norm);} 120 107 121 return sum/norm + background(); 108 122 } … … 151 165 double sum = 0.0; 152 166 double norm = 0.0; 167 double norm_vol = 0.0; 168 double vol = 0.0; 153 169 154 170 // Loop over radius weight points … … 172 188 for(int l=0; l<weights_phi.size(); l++) { 173 189 dp.axis_phi = weights_phi[l].value; 174 190 //Un-normalize by volume 175 191 double _ptvalue = weights_rad[i].weight 176 192 * weights_len[j].weight … … 178 194 * weights_theta[k].weight 179 195 * weights_phi[l].weight 180 * core_shell_cylinder_analytical_2DXY(&dp, qx, qy); 196 * core_shell_cylinder_analytical_2DXY(&dp, qx, qy) 197 * pow(weights_rad[i].value+weights_thick[m].value,2) 198 *(weights_len[j].value+2.0*weights_thick[m].value); 199 181 200 if (weights_theta.size()>1) { 182 201 _ptvalue *= sin(weights_theta[k].value); 183 202 } 184 203 sum += _ptvalue; 204 205 //Find average volume 206 vol += weights_rad[i].weight 207 * weights_len[j].weight 208 * weights_thick[m].weight 209 * pow(weights_rad[i].value+weights_thick[m].value,2) 210 *(weights_len[j].value+2.0*weights_thick[m].value); 211 //Find norm for volume 212 norm_vol += weights_rad[i].weight 213 * weights_len[j].weight 214 * weights_thick[m].weight; 185 215 186 216 norm += weights_rad[i].weight … … 199 229 // integration (see documentation). 200 230 if (weights_theta.size()>1) norm = norm / asin(1.0); 231 232 if (vol != 0.0 && norm_vol != 0.0) { 233 //Re-normalize by avg volume 234 sum = sum/(vol/norm_vol);} 235 201 236 return sum/norm + background(); 202 237 } -
sansmodels/src/sans/models/c_models/coreshellsphere.cpp
rf9bf661 rc451be9 75 75 double sum = 0.0; 76 76 double norm = 0.0; 77 double vol = 0.0; 77 78 78 79 // Loop over radius weight points … … 83 84 for(int j=0; j<weights_thick.size(); j++) { 84 85 dp[2] = weights_thick[j].value; 86 //Un-normalize SphereForm by volume 87 sum += weights_rad[i].weight 88 * weights_thick[j].weight * CoreShellForm(dp, q)* pow(weights_rad[i].value+weights_thick[j].value,3); 85 89 86 sum += weights_rad[i].weight 87 * weights_thick[j].weight * CoreShellForm(dp, q); 90 //Find average volume 91 vol += weights_rad[i].weight * weights_thick[j].weight 92 * pow(weights_rad[i].value+weights_thick[j].value,3); 88 93 norm += weights_rad[i].weight 89 94 * weights_thick[j].weight; 90 95 } 91 96 } 97 98 if (vol != 0.0 && norm != 0.0) { 99 //Re-normalize by avg volume 100 sum = sum/(vol/norm);} 101 92 102 return sum/norm + background(); 93 103 } -
sansmodels/src/sans/models/c_models/cylinder.cpp
rf9bf661 rc451be9 73 73 double sum = 0.0; 74 74 double norm = 0.0; 75 double vol = 0.0; 75 76 76 77 // Loop over radius weight points … … 81 82 for(int j=0; j<weights_len.size(); j++) { 82 83 dp[2] = weights_len[j].value; 83 84 //Un-normalize by volume 84 85 sum += weights_rad[i].weight 85 * weights_len[j].weight * CylinderForm(dp, q); 86 * weights_len[j].weight * CylinderForm(dp, q) 87 *pow(weights_rad[i].value,2)*weights_len[j].value; 88 89 //Find average volume 90 vol += weights_rad[i].weight 91 * weights_len[j].weight *pow(weights_rad[i].value,2)*weights_len[j].value; 86 92 norm += weights_rad[i].weight 87 93 * weights_len[j].weight; 88 94 } 89 95 } 96 if (vol != 0.0 && norm != 0.0) { 97 //Re-normalize by avg volume 98 sum = sum/(vol/norm);} 99 90 100 return sum/norm + background(); 91 101 } … … 127 137 double sum = 0.0; 128 138 double norm = 0.0; 139 double norm_vol = 0.0; 140 double vol = 0.0; 129 141 130 142 // Loop over radius weight points … … 144 156 for(int l=0; l<weights_phi.size(); l++) { 145 157 dp.cyl_phi = weights_phi[l].value; 146 158 //Un-normalize by volume 147 159 double _ptvalue = weights_rad[i].weight 148 160 * weights_len[j].weight 149 161 * weights_theta[k].weight 150 162 * weights_phi[l].weight 151 * cylinder_analytical_2DXY(&dp, qx, qy); 163 * cylinder_analytical_2DXY(&dp, qx, qy) 164 *pow(weights_rad[i].value,2)*weights_len[j].value; 152 165 if (weights_theta.size()>1) { 153 166 _ptvalue *= sin(weights_theta[k].value); 154 167 } 155 168 sum += _ptvalue; 169 //Find average volume 170 vol += weights_rad[i].weight 171 * weights_len[j].weight 172 * pow(weights_rad[i].value,2)*weights_len[j].value; 173 //Find norm for volume 174 norm_vol += weights_rad[i].weight 175 * weights_len[j].weight; 156 176 157 177 norm += weights_rad[i].weight … … 168 188 // integration (see documentation). 169 189 if (weights_theta.size()>1) norm = norm / asin(1.0); 190 if (vol != 0.0 && norm_vol != 0.0) { 191 //Re-normalize by avg volume 192 sum = sum/(vol/norm_vol);} 193 170 194 return sum/norm + background(); 171 195 } -
sansmodels/src/sans/models/c_models/ellipsoid.cpp
rf9bf661 rc451be9 73 73 double sum = 0.0; 74 74 double norm = 0.0; 75 double vol = 0.0; 75 76 76 77 // Loop over radius_a weight points … … 81 82 for(int j=0; j<weights_rad_b.size(); j++) { 82 83 dp[2] = weights_rad_b[j].value; 83 84 //Un-normalize by volume 84 85 sum += weights_rad_a[i].weight 85 * weights_rad_b[j].weight * EllipsoidForm(dp, q); 86 * weights_rad_b[j].weight * EllipsoidForm(dp, q) 87 * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 88 89 //Find average volume 90 vol += weights_rad_a[i].weight 91 * weights_rad_b[j].weight 92 * pow(weights_rad_b[j].value,2) 93 * weights_rad_a[i].value; 86 94 norm += weights_rad_a[i].weight 87 95 * weights_rad_b[j].weight; 88 96 } 89 97 } 98 99 if (vol != 0.0 && norm != 0.0) { 100 //Re-normalize by avg volume 101 sum = sum/(vol/norm);} 102 90 103 return sum/norm + background(); 91 104 } … … 127 140 double sum = 0.0; 128 141 double norm = 0.0; 142 double norm_vol = 0.0; 143 double vol = 0.0; 129 144 130 145 // Loop over radius weight points … … 144 159 for(int l=0; l<weights_phi.size(); l++) { 145 160 dp.axis_phi = weights_phi[l].value; 146 161 //Un-normalize by volume 147 162 double _ptvalue = weights_rad_a[i].weight 148 163 * weights_rad_b[j].weight 149 164 * weights_theta[k].weight 150 165 * weights_phi[l].weight 151 * ellipsoid_analytical_2DXY(&dp, qx, qy); 166 * ellipsoid_analytical_2DXY(&dp, qx, qy) 167 * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 152 168 if (weights_theta.size()>1) { 153 169 _ptvalue *= sin(weights_theta[k].value); 154 170 } 155 171 sum += _ptvalue; 172 //Find average volume 173 vol += weights_rad_a[i].weight 174 * weights_rad_b[j].weight 175 * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 176 //Find norm for volume 177 norm_vol += weights_rad_a[i].weight 178 * weights_rad_b[j].weight; 156 179 157 180 norm += weights_rad_a[i].weight … … 168 191 // integration (see documentation). 169 192 if (weights_theta.size()>1) norm = norm / asin(1.0); 193 194 if (vol != 0.0 && norm_vol != 0.0) { 195 //Re-normalize by avg volume 196 sum = sum/(vol/norm_vol);} 197 170 198 return sum/norm + background(); 171 199 } -
sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp
rf9bf661 rc451be9 79 79 double sum = 0.0; 80 80 double norm = 0.0; 81 double vol = 0.0; 81 82 82 83 // Loop over r_minor weight points … … 91 92 for(int k=0; k<weights_len.size(); k++) { 92 93 dp[3] = weights_len[k].value; 93 94 //Un-normalize by volume 94 95 sum += weights_rad[i].weight 95 96 * weights_len[k].weight 96 97 * weights_rat[j].weight 97 * EllipCyl20(dp, q); 98 * EllipCyl20(dp, q) 99 * pow(weights_rad[i].value,2) * weights_rat[j].value 100 * weights_len[k].value; 101 //Find average volume 102 vol += weights_rad[i].weight 103 * weights_len[k].weight 104 * weights_rat[j].weight 105 * pow(weights_rad[i].value,2) * weights_rat[j].value 106 * weights_len[k].value; 98 107 norm += weights_rad[i].weight 99 * weights_len[k].weight100 * weights_rat[j].weight;108 * weights_len[k].weight 109 * weights_rat[j].weight; 101 110 } 102 111 } 103 112 } 113 114 if (vol != 0.0 && norm != 0.0) { 115 //Re-normalize by avg volume 116 sum = sum/(vol/norm);} 117 104 118 return sum/norm + background(); 105 119 } … … 151 165 double sum = 0.0; 152 166 double norm = 0.0; 167 double norm_vol = 0.0; 168 double vol = 0.0; 153 169 154 170 // Loop over minor radius weight points … … 176 192 for(int o=0; o<weights_psi.size(); o++) { 177 193 dp.cyl_psi = weights_psi[o].value; 178 194 //Un-normalize by volume 179 195 double _ptvalue = weights_rad[i].weight 180 196 * weights_len[j].weight … … 183 199 * weights_phi[l].weight 184 200 * weights_psi[o].weight 185 * elliptical_cylinder_analytical_2DXY(&dp, qx, qy); 201 * elliptical_cylinder_analytical_2DXY(&dp, qx, qy) 202 * pow(weights_rad[i].value,2) 203 * weights_len[j].value 204 * weights_rat[m].value; 186 205 if (weights_theta.size()>1) { 187 206 _ptvalue *= sin(weights_theta[k].value); 188 207 } 189 208 sum += _ptvalue; 209 //Find average volume 210 vol += weights_rad[i].weight 211 * weights_len[j].weight 212 * weights_rat[m].weight 213 * pow(weights_rad[i].value,2) 214 * weights_len[j].value 215 * weights_rat[m].value; 216 //Find norm for volume 217 norm_vol += weights_rad[i].weight 218 * weights_len[j].weight 219 * weights_rat[m].weight; 190 220 191 221 norm += weights_rad[i].weight … … 206 236 // integration (see documentation). 207 237 if (weights_theta.size()>1) norm = norm / asin(1.0); 238 239 if (vol != 0.0 && norm_vol != 0.0) { 240 //Re-normalize by avg volume 241 sum = sum/(vol/norm_vol);} 242 208 243 return sum/norm + background(); 244 209 245 } 210 246 -
sansmodels/src/sans/models/c_models/flexiblecylinder.cpp
rf9bf661 rc451be9 79 79 double sum = 0.0; 80 80 double norm = 0.0; 81 double vol = 0.0; 81 82 82 83 // Loop over semi axis A weight points … … 91 92 for(int k=0; k< (int)weights_rad.size(); k++) { 92 93 dp[3] = weights_rad[k].value; 93 94 //Un-normalize by volume 94 95 sum += weights_len[i].weight 95 * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q); 96 * weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q) 97 * pow(weights_rad[k].value,2)*weights_len[i].value; 98 //Find average volume 99 vol += weights_rad[k].weight 100 * weights_len[i].weight 101 * weights_kuhn[j].weight 102 *pow(weights_rad[k].value,2)*weights_len[i].value; 96 103 norm += weights_len[i].weight 97 104 * weights_kuhn[j].weight*weights_rad[k].weight; … … 99 106 } 100 107 } 108 if (vol != 0.0 && norm != 0.0) { 109 //Re-normalize by avg volume 110 sum = sum/(vol/norm);} 111 101 112 return sum/norm + background(); 102 113 } -
sansmodels/src/sans/models/c_models/hollowcylinder.cpp
rf9bf661 rc451be9 78 78 double sum = 0.0; 79 79 double norm = 0.0; 80 double vol = 0.0; 80 81 81 82 // Loop over core radius weight points … … 90 91 for(int k=0; k< (int)weights_radius.size(); k++) { 91 92 dp[2] = weights_radius[k].value; 92 93 //Un-normalize by volume 93 94 sum += weights_core_radius[i].weight 94 95 * weights_length[j].weight 95 96 * weights_radius[k].weight 96 * HollowCylinder(dp, q); 97 * HollowCylinder(dp, q) 98 * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2)) 99 * weights_length[j].value; 100 //Find average volume 101 vol += weights_core_radius[i].weight 102 * weights_length[j].weight 103 * weights_radius[k].weight 104 * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2)) 105 * weights_length[j].value; 106 97 107 norm += weights_core_radius[i].weight 98 * weights_length[j].weight99 * weights_radius[k].weight;108 * weights_length[j].weight 109 * weights_radius[k].weight; 100 110 } 101 111 } 102 112 } 113 if (vol != 0.0 && norm != 0.0) { 114 //Re-normalize by avg volume 115 sum = sum/(vol/norm);} 116 103 117 return sum/norm + background(); 104 118 } … … 145 159 double sum = 0.0; 146 160 double norm = 0.0; 161 double norm_vol = 0.0; 162 double vol = 0.0; 147 163 148 164 // Loop over core radius weight points … … 166 182 for(int l=0; l< (int)weights_phi.size(); l++) { 167 183 dp.axis_phi = weights_phi[l].value; 168 184 //Un-normalize by volume 169 185 double _ptvalue = weights_core_radius[i].weight 170 186 * weights_length[j].weight … … 172 188 * weights_theta[k].weight 173 189 * weights_phi[l].weight 174 * hollow_cylinder_analytical_2DXY(&dp, qx, qy); 190 * hollow_cylinder_analytical_2DXY(&dp, qx, qy) 191 * (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2)) 192 * weights_length[j].value; 175 193 if (weights_theta.size()>1) { 176 194 _ptvalue *= sin(weights_theta[k].value); 177 195 } 178 196 sum += _ptvalue; 197 //Find average volume 198 vol += weights_core_radius[i].weight 199 * weights_length[j].weight 200 * weights_radius[k].weight 201 * (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2)) 202 * weights_length[j].value; 203 //Find norm for volume 204 norm_vol += weights_core_radius[i].weight 205 * weights_length[j].weight 206 * weights_radius[m].weight; 179 207 180 208 norm += weights_core_radius[i].weight … … 193 221 // integration (see documentation). 194 222 if (weights_theta.size()>1) norm = norm / asin(1.0); 223 if (vol != 0.0 && norm_vol != 0.0) { 224 //Re-normalize by avg volume 225 sum = sum/(vol/norm_vol);} 195 226 return sum/norm + background(); 196 227 } -
sansmodels/src/sans/models/c_models/multishell.cpp
rf9bf661 rc451be9 80 80 double sum = 0.0; 81 81 double norm = 0.0; 82 double vol = 0.0; 82 83 83 84 // Loop over radius weight points … … 88 89 for(int k=0; k< (int)weights_w_thickness.size(); k++){ 89 90 dp[3] = weights_w_thickness[k].value; 90 91 //Un-normalize SphereForm by volume 91 92 sum += weights_core_radius[i].weight*weights_s_thickness[j].weight 92 *weights_w_thickness[k].weight* MultiShell(dp, q); 93 *weights_w_thickness[k].weight* MultiShell(dp, q) 94 *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3); 95 //Find average volume 96 vol += weights_core_radius[i].weight*weights_s_thickness[j].weight 97 *weights_w_thickness[k].weight 98 *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3); 93 99 norm += weights_core_radius[i].weight*weights_s_thickness[j].weight 94 100 *weights_w_thickness[k].weight; … … 96 102 } 97 103 } 104 if (vol != 0.0 && norm != 0.0) { 105 //Re-normalize by avg volume 106 sum = sum/(vol/norm);} 98 107 return sum/norm + background(); 99 108 } -
sansmodels/src/sans/models/c_models/parallelepiped.cpp
rf9bf661 rc451be9 84 84 double sum = 0.0; 85 85 double norm = 0.0; 86 double vol = 0.0; 86 87 87 88 // Loop over short_edgeA weight points … … 96 97 for(int k=0; k< (int)weights_long_c.size(); k++) { 97 98 dp[3] = weights_long_c[k].value; 99 //Un-normalize by volume 98 100 sum += weights_short_a[i].weight * weights_short_b[j].weight 99 * weights_long_c[k].weight * Parallelepiped(dp, q); 101 * weights_long_c[k].weight * Parallelepiped(dp, q) 102 * weights_short_a[i].value*weights_short_b[j].value 103 * weights_long_c[k].value; 104 //Find average volume 105 vol += weights_short_a[i].weight * weights_short_b[j].weight 106 * weights_long_c[k].weight 107 * weights_short_a[i].value * weights_short_b[j].value 108 * weights_long_c[k].value; 100 109 101 110 norm += weights_short_a[i].weight … … 104 113 } 105 114 } 115 if (vol != 0.0 && norm != 0.0) { 116 //Re-normalize by avg volume 117 sum = sum/(vol/norm);} 106 118 107 119 return sum/norm + background(); … … 155 167 double sum = 0.0; 156 168 double norm = 0.0; 169 double norm_vol = 0.0; 170 double vol = 0.0; 157 171 158 172 // Loop over radius weight points … … 179 193 for(int n=0; n< (int)weights_parallel_psi.size(); n++) { 180 194 dp.parallel_psi = weights_parallel_psi[n].value; 181 195 //Un-normalize by volume 182 196 double _ptvalue = weights_short_a[i].weight 183 197 * weights_short_b[j].weight … … 186 200 * weights_parallel_phi[m].weight 187 201 * weights_parallel_psi[n].weight 188 * parallelepiped_analytical_2DXY(&dp, qx, qy); 202 * parallelepiped_analytical_2DXY(&dp, qx, qy) 203 * weights_short_a[i].value*weights_short_b[j].value 204 * weights_long_c[k].value; 205 189 206 if (weights_parallel_theta.size()>1) { 190 207 _ptvalue *= sin(weights_parallel_theta[l].value); 191 208 } 192 209 sum += _ptvalue; 210 //Find average volume 211 vol += weights_short_a[i].weight 212 * weights_short_b[j].weight 213 * weights_long_c[k].weight 214 * weights_short_a[i].value*weights_short_b[j].value 215 * weights_long_c[k].value; 216 //Find norm for volume 217 norm_vol += weights_short_a[i].weight 218 * weights_short_b[j].weight 219 * weights_long_c[k].weight; 193 220 194 221 norm += weights_short_a[i].weight … … 209 236 // integration (see documentation). 210 237 if (weights_parallel_theta.size()>1) norm = norm / asin(1.0); 238 239 if (vol != 0.0 && norm_vol != 0.0) { 240 //Re-normalize by avg volume 241 sum = sum/(vol/norm_vol);} 242 211 243 return sum/norm + background(); 212 244 } -
sansmodels/src/sans/models/c_models/sphere.cpp
rf9bf661 rc451be9 62 62 double sum = 0.0; 63 63 double norm = 0.0; 64 double vol = 0.0; 64 65 65 66 // Loop over radius weight points … … 67 68 dp[1] = weights_rad[i].value; 68 69 70 //Un-normalize SphereForm by volume 69 71 sum += weights_rad[i].weight 70 * SphereForm(dp, q); 72 * SphereForm(dp, q) * pow(weights_rad[i].value,3); 73 //Find average volume 74 vol += weights_rad[i].weight 75 * pow(weights_rad[i].value,3); 76 71 77 norm += weights_rad[i].weight; 72 78 } 79 80 if (vol != 0.0 && norm != 0.0) { 81 //Re-normalize by avg volume 82 sum = sum/(vol/norm);} 73 83 return sum/norm + background(); 74 84 } -
sansmodels/src/sans/models/c_models/spheroid.cpp
rf9bf661 rc451be9 91 91 double sum = 0.0; 92 92 double norm = 0.0; 93 double vol = 0.0; 93 94 94 95 // Loop over major core weight points … … 107 108 for(int l=0; l<(int)weights_polar_shell.size(); l++) { 108 109 dp[4] = weights_polar_shell[l].value; 109 110 //Un-normalize by volume 110 111 sum += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight 111 * weights_polar_shell[l].weight * ProlateForm(dp, q); 112 * weights_polar_shell[l].weight * ProlateForm(dp, q) 113 * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 114 //Find average volume 115 vol += weights_equat_core[i].weight* weights_polar_core[j].weight 116 * weights_equat_shell[k].weight 117 * weights_polar_shell[l].weight 118 * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 112 119 norm += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight 113 120 * weights_polar_shell[l].weight; … … 116 123 } 117 124 } 125 if (vol != 0.0 && norm != 0.0) { 126 //Re-normalize by avg volume 127 sum = sum/(vol/norm);} 118 128 return sum/norm + background(); 119 129 } … … 194 204 double sum = 0.0; 195 205 double norm = 0.0; 206 double norm_vol = 0.0; 207 double vol = 0.0; 196 208 197 209 // Loop over major core weight points … … 218 230 for(int n=0; n< (int)weights_phi.size(); n++) { 219 231 dp.axis_phi = weights_phi[n].value; 220 232 //Un-normalize by volume 221 233 double _ptvalue = weights_equat_core[i].weight *weights_polar_core[j].weight 222 234 * weights_equat_shell[k].weight * weights_polar_shell[l].weight 223 235 * weights_theta[m].weight 224 236 * weights_phi[n].weight 225 * spheroid_analytical_2DXY(&dp, qx, qy); 237 * spheroid_analytical_2DXY(&dp, qx, qy) 238 * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 226 239 if (weights_theta.size()>1) { 227 240 _ptvalue *= sin(weights_theta[m].value); 228 241 } 229 242 sum += _ptvalue; 243 //Find average volume 244 vol += weights_equat_shell[k].weight 245 * weights_polar_shell[l].weight 246 * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 247 //Find norm for volume 248 norm_vol += weights_equat_shell[k].weight 249 * weights_polar_shell[l].weight; 230 250 231 251 norm += weights_equat_core[i].weight *weights_polar_core[j].weight … … 242 262 // integration (see documentation). 243 263 if (weights_theta.size()>1) norm = norm / asin(1.0); 264 265 if (vol != 0.0 && norm_vol != 0.0) { 266 //Re-normalize by avg volume 267 sum = sum/(vol/norm_vol);} 268 244 269 return sum/norm + background(); 245 270 } -
sansmodels/src/sans/models/c_models/stackeddisks.cpp
rf9bf661 rc451be9 89 89 double sum = 0.0; 90 90 double norm = 0.0; 91 double vol = 0.0; 91 92 92 93 // Loop over length weight points … … 101 102 for(int k=0; k< (int)weights_layer_thick.size(); k++) { 102 103 dp[3] = weights_layer_thick[k].value; 103 104 //Un-normalize by volume 104 105 sum += weights_radius[i].weight 105 * weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q); 106 * weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q) 107 *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value); 108 //Find average volume 109 vol += weights_radius[i].weight 110 * weights_core_thick[j].weight * weights_layer_thick[k].weight 111 *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value); 106 112 norm += weights_radius[i].weight 107 113 * weights_core_thick[j].weight* weights_layer_thick[k].weight; … … 109 115 } 110 116 } 117 if (vol != 0.0 && norm != 0.0) { 118 //Re-normalize by avg volume 119 sum = sum/(vol/norm);} 120 111 121 return sum/norm + background(); 112 122 } … … 157 167 double sum = 0.0; 158 168 double norm = 0.0; 169 double norm_vol = 0.0; 170 double vol = 0.0; 159 171 160 172 // Loop over length weight points … … 177 189 dp.axis_phi = weights_phi[m].value; 178 190 191 //Un-normalize by volume 179 192 double _ptvalue = weights_core_thick[i].weight 180 193 * weights_radius[j].weight … … 182 195 * weights_theta[l].weight 183 196 * weights_phi[m].weight 184 * stacked_disks_analytical_2DXY(&dp, qx, qy); 197 * stacked_disks_analytical_2DXY(&dp, qx, qy) 198 *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value); 185 199 if (weights_theta.size()>1) { 186 200 _ptvalue *= sin(weights_theta[l].value); 187 201 } 188 202 sum += _ptvalue; 203 //Find average volume 204 vol += weights_radius[j].weight 205 * weights_core_thick[i].weight * weights_layer_thick[k].weight 206 *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value); 207 //Find norm for volume 208 norm_vol += weights_radius[j].weight 209 * weights_core_thick[i].weight * weights_layer_thick[k].weight; 189 210 190 211 norm += weights_core_thick[i].weight … … 202 223 // integration (see documentation). 203 224 if (weights_theta.size()>1) norm = norm / asin(1.0); 225 if (vol != 0.0 && norm_vol != 0.0) { 226 //Re-normalize by avg volume 227 sum = sum/(vol/norm_vol);} 204 228 return sum/norm + background(); 205 229 } -
sansmodels/src/sans/models/c_models/triaxialellipsoid.cpp
rf9bf661 rc451be9 81 81 double sum = 0.0; 82 82 double norm = 0.0; 83 double vol = 0.0; 83 84 84 85 // Loop over semi axis A weight points … … 93 94 for(int k=0; k< (int)weights_semi_axisC.size(); k++) { 94 95 dp[3] = weights_semi_axisC[k].value; 95 96 //Un-normalize by volume 96 97 sum += weights_semi_axisA[i].weight 97 * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q); 98 * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q) 99 * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 100 //Find average volume 101 vol += weights_semi_axisA[i].weight 102 * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight 103 * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 104 98 105 norm += weights_semi_axisA[i].weight 99 106 * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight; … … 101 108 } 102 109 } 110 if (vol != 0.0 && norm != 0.0) { 111 //Re-normalize by avg volume 112 sum = sum/(vol/norm);} 113 103 114 return sum/norm + background(); 104 115 } … … 150 161 double sum = 0.0; 151 162 double norm = 0.0; 163 double norm_vol = 0.0; 164 double vol = 0.0; 152 165 153 166 // Loop over semi axis A weight points … … 173 186 for(int n=0; n <(int)weights_psi.size(); n++) { 174 187 dp.axis_psi = weights_psi[n].value; 175 188 //Un-normalize by volume 176 189 double _ptvalue = weights_semi_axisA[i].weight 177 190 * weights_semi_axisB[j].weight … … 180 193 * weights_phi[m].weight 181 194 * weights_psi[n].weight 182 * triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy); 195 * triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy) 196 * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 183 197 if (weights_theta.size()>1) { 184 198 _ptvalue *= sin(weights_theta[k].value); 185 199 } 186 200 sum += _ptvalue; 201 //Find average volume 202 vol += weights_semi_axisA[i].weight 203 * weights_semi_axisB[j].weight 204 * weights_semi_axisC[k].weight 205 * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 206 //Find norm for volume 207 norm_vol += weights_semi_axisA[i].weight 208 * weights_semi_axisB[j].weight 209 * weights_semi_axisC[k].weight; 187 210 188 211 norm += weights_semi_axisA[i].weight … … 203 226 // integration (see documentation). 204 227 if (weights_theta.size()>1) norm = norm / asin(1.0); 228 229 if (vol != 0.0 && norm_vol != 0.0) { 230 //Re-normalize by avg volume 231 sum = sum/(vol/norm_vol);} 232 205 233 return sum/norm + background(); 206 234 } -
sansmodels/src/sans/models/c_models/vesicle.cpp
rf9bf661 rc451be9 71 71 double sum = 0.0; 72 72 double norm = 0.0; 73 double vol = 0.0; 73 74 74 75 // Loop over radius weight points … … 78 79 dp[2] = weights_thickness[j].value; 79 80 sum += weights_radius[i].weight 80 * weights_thickness[j].weight * VesicleForm(dp, q); 81 * weights_thickness[j].weight * VesicleForm(dp, q) 82 *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3)); 83 //Find average volume 84 vol += weights_radius[i].weight * weights_thickness[j].weight 85 *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3)); 81 86 norm += weights_radius[i].weight * weights_thickness[j].weight; 82 87 } 83 88 } 89 if (vol != 0.0 && norm != 0.0) { 90 //Re-normalize by avg volume 91 sum = sum/(vol/norm);} 92 84 93 return sum/norm + background(); 85 94 }
Note: See TracChangeset
for help on using the changeset viewer.