Changeset 34c2649 in sasview
- Timestamp:
- Nov 21, 2011 4:52:25 PM (13 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:
- 1810613
- Parents:
- afea8fe
- Location:
- sansmodels/src/sans/models
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp
r35aface r34c2649 175 175 { 176 176 PyArrayObject *result; 177 int i, j, x_len, y_len, dims[1];177 int i, x_len, dims[1]; 178 178 //check validity of input vectors 179 179 if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE … … 188 188 189 189 x_len = dims[0]= x->dimensions[0]; 190 y_len = dims[0]= y->dimensions[0];191 190 192 191 // Make a new double matrix of same dims … … 346 345 static PyObject * calculate_ER(CHardsphereStructure *self) { 347 346 348 PyObject* pars;349 int npars;350 351 347 // Get parameters 352 348 -
sansmodels/src/sans/models/c_models/barbell.cpp
r4628e31 r34c2649 83 83 pi = 4.0*atan(1.0); 84 84 // Loop over radius weight points 85 for( int i=0; i<weights_rad_bar.size(); i++) {85 for(size_t i=0; i<weights_rad_bar.size(); i++) { 86 86 dp[1] = weights_rad_bar[i].value; 87 for( int j=0; j<weights_len_bar.size(); j++) {87 for(size_t j=0; j<weights_len_bar.size(); j++) { 88 88 dp[2] = weights_len_bar[j].value; 89 for( int k=0; k<weights_rad_bell.size(); k++) {89 for(size_t k=0; k<weights_rad_bell.size(); k++) { 90 90 dp[3] = weights_rad_bell[k].value; 91 91 … … 125 125 BarBellParameters dp; 126 126 127 double q = sqrt(qx*qx + qy*qy);128 127 dp.scale = scale(); 129 128 dp.rad_bar = rad_bar(); … … 163 162 double norm_vol = 0.0; 164 163 double vol = 0.0; 165 double pi,hDist ,result;164 double pi,hDist; 166 165 double vol_i = 0.0; 167 166 pi = 4.0*atan(1.0); 168 167 169 168 // Loop over radius weight points 170 for( int i=0; i<weights_rad_bar.size(); i++) {169 for(size_t i=0; i<weights_rad_bar.size(); i++) { 171 170 dp.rad_bar = weights_rad_bar[i].value; 172 for( int j=0; j<weights_len_bar.size(); j++) {171 for(size_t j=0; j<weights_len_bar.size(); j++) { 173 172 dp.len_bar = weights_len_bar[j].value; 174 for( int k=0; k<weights_rad_bell.size(); k++) {173 for(size_t k=0; k<weights_rad_bell.size(); k++) { 175 174 dp.rad_bell = weights_rad_bell[k].value; 176 175 // Average over theta distribution 177 for( int l=0; l< weights_theta.size(); l++) {176 for(size_t l=0; l< weights_theta.size(); l++) { 178 177 dp.theta = weights_theta[l].value; 179 178 // Average over phi distribution 180 for( int m=0; m< weights_phi.size(); m++) {179 for(size_t m=0; m< weights_phi.size(); m++) { 181 180 dp.phi = weights_phi[m].value; 182 181 //Un-normalize Form by volume … … 251 250 double BarBellModel :: calculate_ER() { 252 251 //NOT implemented yet!!! 253 } 252 return 0.0; 253 } -
sansmodels/src/sans/models/c_models/bcc.cpp
r4628e31 r34c2649 75 75 76 76 // Loop over radius weight points 77 for( int i=0; i<weights_rad.size(); i++) {77 for(size_t i=0; i<weights_rad.size(); i++) { 78 78 dp[3] = weights_rad[i].value; 79 79 … … 107 107 double BCCrystalModel :: operator()(double qx, double qy) { 108 108 BCParameters dp; 109 double q = sqrt(qx*qx + qy*qy);110 109 dp.scale = scale(); 111 110 dp.dnn = dnn(); … … 142 141 143 142 // Loop over radius weight points 144 for( int i=0; i<weights_rad.size(); i++) {143 for(size_t i=0; i<weights_rad.size(); i++) { 145 144 dp.radius = weights_rad[i].value; 146 145 // Average over theta distribution 147 for( int j=0; j< weights_theta.size(); j++) {146 for(size_t j=0; j< weights_theta.size(); j++) { 148 147 dp.theta = weights_theta[j].value; 149 148 // Average over phi distribution 150 for( int k=0; k< weights_phi.size(); k++) {149 for(size_t k=0; k< weights_phi.size(); k++) { 151 150 dp.phi = weights_phi[k].value; 152 151 // Average over phi distribution 153 for( int l=0; l< weights_psi.size(); l++) {152 for(size_t l=0; l< weights_psi.size(); l++) { 154 153 dp.psi = weights_psi[l].value; 155 154 //Un-normalize SphereForm by volume … … 207 206 double BCCrystalModel :: calculate_ER() { 208 207 //NOT implemented yet!!! 209 } 208 return 0.0; 209 } -
sansmodels/src/sans/models/c_models/binaryHS.cpp
rf9bf661 r34c2649 122 122 double BinaryHSModel :: calculate_ER() { 123 123 //NOT implemented yet!!! 124 double rad_out;124 return 0.0; 125 125 } 126 126 -
sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp
rf9bf661 r34c2649 120 120 double BinaryHSPSF11Model :: calculate_ER() { 121 121 //NOT implemented yet!!! 122 return 0.0; 122 123 } -
sansmodels/src/sans/models/c_models/capcyl.cpp
r4628e31 r34c2649 83 83 pi = 4.0*atan(1.0); 84 84 // Loop over radius weight points 85 for( int i=0; i<weights_rad_cyl.size(); i++) {85 for(size_t i=0; i<weights_rad_cyl.size(); i++) { 86 86 dp[1] = weights_rad_cyl[i].value; 87 for( int j=0; j<weights_len_cyl.size(); j++) {87 for(size_t j=0; j<weights_len_cyl.size(); j++) { 88 88 dp[2] = weights_len_cyl[j].value; 89 for( int k=0; k<weights_rad_cap.size(); k++) {89 for(size_t k=0; k<weights_rad_cap.size(); k++) { 90 90 dp[3] = weights_rad_cap[k].value; 91 91 … … 125 125 CapCylParameters dp; 126 126 127 double q = sqrt(qx*qx + qy*qy);128 127 dp.scale = scale(); 129 128 dp.rad_cyl = rad_cyl(); … … 162 161 double norm_vol = 0.0; 163 162 double vol = 0.0; 164 double pi,hDist ,result;163 double pi,hDist; 165 164 double vol_i = 0.0; 166 165 pi = 4.0*atan(1.0); 167 166 168 167 // Loop over radius weight points 169 for( int i=0; i<weights_rad_cyl.size(); i++) {168 for(size_t i=0; i<weights_rad_cyl.size(); i++) { 170 169 dp.rad_cyl = weights_rad_cyl[i].value; 171 for( int j=0; j<weights_len_cyl.size(); j++) {170 for(size_t j=0; j<weights_len_cyl.size(); j++) { 172 171 dp.len_cyl = weights_len_cyl[j].value; 173 for( int k=0; k<weights_rad_cap.size(); k++) {172 for(size_t k=0; k<weights_rad_cap.size(); k++) { 174 173 dp.rad_cap = weights_rad_cap[k].value; 175 174 // Average over theta distribution 176 for( int l=0; l< weights_theta.size(); l++) {175 for(size_t l=0; l< weights_theta.size(); l++) { 177 176 dp.theta = weights_theta[l].value; 178 177 // Average over phi distribution 179 for( int m=0; m< weights_phi.size(); m++) {178 for(size_t m=0; m< weights_phi.size(); m++) { 180 179 dp.phi = weights_phi[m].value; 181 180 //Un-normalize Form by volume … … 250 249 double CappedCylinderModel :: calculate_ER() { 251 250 //NOT implemented yet!!! 252 } 251 return 0.0; 252 } -
sansmodels/src/sans/models/c_models/corefourshell.cpp
r339ce67 r34c2649 103 103 104 104 // Loop over radius weight points 105 for( int i=0; i<weights_rad.size(); i++) {105 for(size_t i=0; i<weights_rad.size(); i++) { 106 106 dp[1] = weights_rad[i].value; 107 107 // Loop over radius weight points 108 for( int j=0; j<weights_s1.size(); j++) {108 for(size_t j=0; j<weights_s1.size(); j++) { 109 109 dp[3] = weights_s1[j].value; 110 110 // Loop over radius weight points 111 for( int k=0; k<weights_s2.size(); k++) {111 for(size_t k=0; k<weights_s2.size(); k++) { 112 112 dp[5] = weights_s2[k].value; 113 113 // Loop over radius weight points 114 for( int l=0; l<weights_s3.size(); l++) {114 for(size_t l=0; l<weights_s3.size(); l++) { 115 115 dp[7] = weights_s3[l].value; 116 116 // Loop over radius weight points 117 for( int m=0; m<weights_s4.size(); m++) {117 for(size_t m=0; m<weights_s4.size(); m++) { 118 118 dp[9] = weights_s4[m].value; 119 119 //Un-normalize FourShell by volume … … 206 206 207 207 // Loop over radius weight points 208 for( int i=0; i<weights_rad.size(); i++) {208 for(size_t i=0; i<weights_rad.size(); i++) { 209 209 dp.rad_core0 = weights_rad[i].value; 210 210 // Loop over radius weight points 211 for( int j=0; j<weights_s1.size(); j++) {211 for(size_t j=0; j<weights_s1.size(); j++) { 212 212 dp.thick_shell1 = weights_s1[j].value; 213 213 // Loop over radius weight points 214 for( int k=0; k<weights_s2.size(); k++) {214 for(size_t k=0; k<weights_s2.size(); k++) { 215 215 dp.thick_shell2 = weights_s2[k].value; 216 216 // Loop over radius weight points 217 for( int l=0; l<weights_s3.size(); l++) {217 for(size_t l=0; l<weights_s3.size(); l++) { 218 218 dp.thick_shell3 = weights_s3[l].value; 219 219 // Loop over radius weight points 220 for( int m=0; m<weights_s4.size(); m++) {220 for(size_t m=0; m<weights_s4.size(); m++) { 221 221 dp.thick_shell4 = weights_s4[m].value; 222 222 //Un-normalize FourShell by volume -
sansmodels/src/sans/models/c_models/coreshellcylinder.cpp
r4628e31 r34c2649 85 85 86 86 // Loop over radius weight points 87 for( int i=0; i<weights_rad.size(); i++) {87 for(size_t i=0; i<weights_rad.size(); i++) { 88 88 dp[1] = weights_rad[i].value; 89 89 90 90 // Loop over length weight points 91 for( int j=0; j<weights_len.size(); j++) {91 for(size_t j=0; j<weights_len.size(); j++) { 92 92 dp[3] = weights_len[j].value; 93 93 94 94 // Loop over thickness weight points 95 for( int k=0; k<weights_thick.size(); k++) {95 for(size_t k=0; k<weights_thick.size(); k++) { 96 96 dp[2] = weights_thick[k].value; 97 97 //Un-normalize by volume … … 169 169 double pi = 4.0*atan(1.0); 170 170 // Loop over radius weight points 171 for( int i=0; i<weights_rad.size(); i++) {171 for(size_t i=0; i<weights_rad.size(); i++) { 172 172 dp.radius = weights_rad[i].value; 173 173 174 174 175 175 // Loop over length weight points 176 for( int j=0; j<weights_len.size(); j++) {176 for(size_t j=0; j<weights_len.size(); j++) { 177 177 dp.length = weights_len[j].value; 178 178 179 179 // Loop over thickness weight points 180 for( int m=0; m<weights_thick.size(); m++) {180 for(size_t m=0; m<weights_thick.size(); m++) { 181 181 dp.thickness = weights_thick[m].value; 182 182 183 183 // Average over theta distribution 184 for( int k=0; k<weights_theta.size(); k++) {184 for(size_t k=0; k<weights_theta.size(); k++) { 185 185 dp.axis_theta = weights_theta[k].value; 186 186 187 187 // Average over phi distribution 188 for( int l=0; l<weights_phi.size(); l++) {188 for(size_t l=0; l<weights_phi.size(); l++) { 189 189 dp.axis_phi = weights_phi[l].value; 190 190 //Un-normalize by volume -
sansmodels/src/sans/models/c_models/coreshellsphere.cpp
rc451be9 r34c2649 78 78 79 79 // Loop over radius weight points 80 for( int i=0; i<weights_rad.size(); i++) {80 for(size_t i=0; i<weights_rad.size(); i++) { 81 81 dp[1] = weights_rad[i].value; 82 82 83 83 // Loop over thickness weight points 84 for( int j=0; j<weights_thick.size(); j++) {84 for(size_t j=0; j<weights_thick.size(); j++) { 85 85 dp[2] = weights_thick[j].value; 86 86 //Un-normalize SphereForm by volume -
sansmodels/src/sans/models/c_models/cylinder.cpp
r4628e31 r34c2649 78 78 79 79 // Loop over radius weight points 80 for( int i=0; i<weights_rad.size(); i++) {80 for(size_t i=0; i<weights_rad.size(); i++) { 81 81 dp[1] = weights_rad[i].value; 82 82 83 83 // Loop over length weight points 84 for( int j=0; j<weights_len.size(); j++) {84 for(size_t j=0; j<weights_len.size(); j++) { 85 85 dp[2] = weights_len[j].value; 86 86 //Un-normalize by volume … … 144 144 double pi = 4.0*atan(1.0); 145 145 // Loop over radius weight points 146 for( int i=0; i<weights_rad.size(); i++) {146 for(size_t i=0; i<weights_rad.size(); i++) { 147 147 dp.radius = weights_rad[i].value; 148 148 149 149 150 150 // Loop over length weight points 151 for( int j=0; j<weights_len.size(); j++) {151 for(size_t j=0; j<weights_len.size(); j++) { 152 152 dp.length = weights_len[j].value; 153 153 154 154 // Average over theta distribution 155 for( int k=0; k<weights_theta.size(); k++) {155 for(size_t k=0; k<weights_theta.size(); k++) { 156 156 dp.cyl_theta = weights_theta[k].value; 157 157 158 158 // Average over phi distribution 159 for( int l=0; l<weights_phi.size(); l++) {159 for(size_t l=0; l<weights_phi.size(); l++) { 160 160 dp.cyl_phi = weights_phi[l].value; 161 161 //Un-normalize by volume -
sansmodels/src/sans/models/c_models/ellipsoid.cpp
r4628e31 r34c2649 78 78 79 79 // Loop over radius_a weight points 80 for( int i=0; i<weights_rad_a.size(); i++) {80 for(size_t i=0; i<weights_rad_a.size(); i++) { 81 81 dp[1] = weights_rad_a[i].value; 82 82 83 83 // Loop over radius_b weight points 84 for( int j=0; j<weights_rad_b.size(); j++) {84 for(size_t j=0; j<weights_rad_b.size(); j++) { 85 85 dp[2] = weights_rad_b[j].value; 86 86 //Un-normalize by volume … … 147 147 double pi = 4.0*atan(1.0); 148 148 // Loop over radius weight points 149 for( int i=0; i<weights_rad_a.size(); i++) {149 for(size_t i=0; i<weights_rad_a.size(); i++) { 150 150 dp.radius_a = weights_rad_a[i].value; 151 151 152 152 153 153 // Loop over length weight points 154 for( int j=0; j<weights_rad_b.size(); j++) {154 for(size_t j=0; j<weights_rad_b.size(); j++) { 155 155 dp.radius_b = weights_rad_b[j].value; 156 156 157 157 // Average over theta distribution 158 for( int k=0; k<weights_theta.size(); k++) {158 for(size_t k=0; k<weights_theta.size(); k++) { 159 159 dp.axis_theta = weights_theta[k].value; 160 160 161 161 // Average over phi distribution 162 for( int l=0; l<weights_phi.size(); l++) {162 for(size_t l=0; l<weights_phi.size(); l++) { 163 163 dp.axis_phi = weights_phi[l].value; 164 164 //Un-normalize by volume -
sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp
r4628e31 r34c2649 84 84 85 85 // Loop over r_minor weight points 86 for( int i=0; i<weights_rad.size(); i++) {86 for(size_t i=0; i<weights_rad.size(); i++) { 87 87 dp[1] = weights_rad[i].value; 88 88 89 89 // Loop over r_ratio weight points 90 for( int j=0; j<weights_rat.size(); j++) {90 for(size_t j=0; j<weights_rat.size(); j++) { 91 91 dp[2] = weights_rat[j].value; 92 92 93 93 // Loop over length weight points 94 for( int k=0; k<weights_len.size(); k++) {94 for(size_t k=0; k<weights_len.size(); k++) { 95 95 dp[3] = weights_len[k].value; 96 96 //Un-normalize by volume … … 172 172 double pi = 4.0*atan(1.0); 173 173 // Loop over minor radius weight points 174 for( int i=0; i<weights_rad.size(); i++) {174 for(size_t i=0; i<weights_rad.size(); i++) { 175 175 dp.r_minor = weights_rad[i].value; 176 176 177 177 178 178 // Loop over length weight points 179 for( int j=0; j<weights_len.size(); j++) {179 for(size_t j=0; j<weights_len.size(); j++) { 180 180 dp.length = weights_len[j].value; 181 181 182 182 // Loop over r_ration weight points 183 for( int m=0; m<weights_rat.size(); m++) {183 for(size_t m=0; m<weights_rat.size(); m++) { 184 184 dp.r_ratio = weights_rat[m].value; 185 185 186 186 // Average over theta distribution 187 for( int k=0; k<weights_theta.size(); k++) {187 for(size_t k=0; k<weights_theta.size(); k++) { 188 188 dp.cyl_theta = weights_theta[k].value; 189 189 190 190 // Average over phi distribution 191 for( int l=0; l<weights_phi.size(); l++) {191 for(size_t l=0; l<weights_phi.size(); l++) { 192 192 dp.cyl_phi = weights_phi[l].value; 193 193 194 194 // Average over phi distribution 195 for( int o=0; o<weights_psi.size(); o++) {195 for(size_t o=0; o<weights_psi.size(); o++) { 196 196 dp.cyl_psi = weights_psi[o].value; 197 197 //Un-normalize by volume … … 270 270 dp.length = length(); 271 271 double rad_out = 0.0; 272 double pi = 4.0*atan(1.0);273 272 double suf_rad = sqrt(dp.r_minor*dp.r_minor*dp.r_ratio); 274 273 … … 290 289 291 290 // Loop over minor radius weight points 292 for( int i=0; i<weights_rad.size(); i++) {291 for(size_t i=0; i<weights_rad.size(); i++) { 293 292 dp.r_minor = weights_rad[i].value; 294 293 295 294 // Loop over length weight points 296 for( int j=0; j<weights_len.size(); j++) {295 for(size_t j=0; j<weights_len.size(); j++) { 297 296 dp.length = weights_len[j].value; 298 297 299 298 // Loop over r_ration weight points 300 for( int m=0; m<weights_rat.size(); m++) {299 for(size_t m=0; m<weights_rat.size(); m++) { 301 300 dp.r_ratio = weights_rat[m].value; 302 301 //Calculate surface averaged radius -
sansmodels/src/sans/models/c_models/fcc.cpp
r4628e31 r34c2649 75 75 76 76 // Loop over radius weight points 77 for( int i=0; i<weights_rad.size(); i++) {77 for(size_t i=0; i<weights_rad.size(); i++) { 78 78 dp[3] = weights_rad[i].value; 79 79 … … 107 107 double FCCrystalModel :: operator()(double qx, double qy) { 108 108 FCParameters dp; 109 double q = sqrt(qx*qx + qy*qy);110 109 dp.scale = scale(); 111 110 dp.dnn = dnn(); … … 142 141 double pi = 4.0*atan(1.0); 143 142 // Loop over radius weight points 144 for( int i=0; i<weights_rad.size(); i++) {143 for(size_t i=0; i<weights_rad.size(); i++) { 145 144 dp.radius = weights_rad[i].value; 146 145 // Average over theta distribution 147 for( int j=0; j< weights_theta.size(); j++) {146 for(size_t j=0; j< weights_theta.size(); j++) { 148 147 dp.theta = weights_theta[j].value; 149 148 // Average over phi distribution 150 for( int k=0; k< weights_phi.size(); k++) {149 for(size_t k=0; k< weights_phi.size(); k++) { 151 150 dp.phi = weights_phi[k].value; 152 151 // Average over phi distribution 153 for( int l=0; l< weights_psi.size(); l++) {152 for(size_t l=0; l< weights_psi.size(); l++) { 154 153 dp.psi = weights_psi[l].value; 155 154 //Un-normalize SphereForm by volume … … 206 205 double FCCrystalModel :: calculate_ER() { 207 206 //NOT implemented yet!!! 208 } 207 return 0.0; 208 } -
sansmodels/src/sans/models/c_models/fractal.cpp
rc724ccd r34c2649 71 71 72 72 // Loop over radius weight points 73 for( int i=0; i<weights_rad.size(); i++) {73 for(size_t i=0; i<weights_rad.size(); i++) { 74 74 dp[1] = weights_rad[i].value; 75 75 … … 118 118 double FractalModel :: calculate_ER() { 119 119 //NOT implemented yet!!! 'cause None shape Model 120 return 0.0; 120 121 } -
sansmodels/src/sans/models/c_models/fuzzysphere.cpp
rc724ccd r34c2649 68 68 69 69 // Loop over radius weight points 70 for( int i=0; i<weights_radius.size(); i++) {70 for(size_t i=0; i<weights_radius.size(); i++) { 71 71 dp[1] = weights_radius[i].value; 72 72 // Loop over fuzziness weight points 73 for( int j=0; j<weights_fuzziness.size(); j++) {73 for(size_t j=0; j<weights_fuzziness.size(); j++) { 74 74 dp[2] = weights_fuzziness[j].value; 75 75 … … 119 119 */ 120 120 double FuzzySphereModel :: calculate_ER() { 121 FuzzySphereParameters dp;122 dp.scale = scale();123 dp.radius = radius();124 dp.fuzziness = fuzziness();125 dp.sldSph = sldSph();126 dp.sldSolv = sldSolv();127 dp.background = background();128 121 double rad_out = 0.0; 129 122 … … 137 130 radius.get_weights(weights_radius); 138 131 // Loop over radius weight points to average the radius value 139 for( int i=0; i<weights_radius.size(); i++) {132 for(size_t i=0; i<weights_radius.size(); i++) { 140 133 sum += weights_radius[i].weight 141 134 * weights_radius[i].value; -
sansmodels/src/sans/models/c_models/lamellar.cpp
rf9bf661 r34c2649 106 106 double LamellarModel :: calculate_ER() { 107 107 //NOT implemented yet!!! 108 return 0.0; 108 109 } -
sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp
rf9bf661 r34c2649 119 119 double LamellarFFHGModel :: calculate_ER() { 120 120 //NOT implemented yet!!! 121 return 0.0; 121 122 } -
sansmodels/src/sans/models/c_models/lamellarPC.cpp
r339ce67 r34c2649 118 118 double LamellarPCrystalModel :: calculate_ER() { 119 119 //NOT implemented yet!!! 120 return 0.0; 120 121 } -
sansmodels/src/sans/models/c_models/lamellarPS.cpp
rf10063e r34c2649 117 117 double LamellarPSModel :: calculate_ER() { 118 118 //NOT implemented yet!!! 119 return 0.0; 119 120 } 120 121 -
sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp
rf9bf661 r34c2649 135 135 double LamellarPSHGModel :: calculate_ER() { 136 136 //NOT implemented yet!!! 137 return 0.0; 137 138 } 138 139 -
sansmodels/src/sans/models/c_models/onion.cpp
r339ce67 r34c2649 223 223 224 224 // Loop over radius weight points 225 for( int i=0; i<weights_rad.size(); i++) {225 for(size_t i=0; i<weights_rad.size(); i++) { 226 226 dp[2] = weights_rad[i].value; 227 227 // Loop over radius weight points 228 for( int j=0; j<weights_s1.size(); j++) {228 for(size_t j=0; j<weights_s1.size(); j++) { 229 229 dp[36] = weights_s1[j].value; 230 230 // Loop over radius weight points 231 for( int k=0; k<weights_s2.size(); k++) {231 for(size_t k=0; k<weights_s2.size(); k++) { 232 232 dp[37] = weights_s2[k].value; 233 233 // Loop over radius weight points 234 for( int l=0; l<weights_s3.size(); l++) {234 for(size_t l=0; l<weights_s3.size(); l++) { 235 235 dp[38] = weights_s3[l].value; 236 236 // Loop over radius weight points 237 for( int m=0; m<weights_s4.size(); m++) {237 for(size_t m=0; m<weights_s4.size(); m++) { 238 238 dp[39] = weights_s4[m].value; 239 for( int n=0; n<weights_s5.size(); n++) {239 for(size_t n=0; n<weights_s5.size(); n++) { 240 240 dp[40] = weights_s5[n].value; 241 for( int o=0; o<weights_s6.size(); o++) {241 for(size_t o=0; o<weights_s6.size(); o++) { 242 242 dp[41] = weights_s6[o].value; 243 for( int p=0; p<weights_s7.size(); p++) {243 for(size_t p=0; p<weights_s7.size(); p++) { 244 244 dp[42] = weights_s7[p].value; 245 for( int t=0; t<weights_s8.size(); t++) {245 for(size_t t=0; t<weights_s8.size(); t++) { 246 246 dp[43] = weights_s8[t].value; 247 for( int r=0; r<weights_s9.size(); r++) {247 for(size_t r=0; r<weights_s9.size(); r++) { 248 248 dp[44] = weights_s9[r].value; 249 for( int s=0; s<weights_s10.size(); s++) {249 for(size_t s=0; s<weights_s10.size(); s++) { 250 250 dp[45] = weights_s10[s].value; 251 251 //Un-normalize Shells by volume … … 375 375 376 376 // Loop over radius weight points 377 for( int i=0; i<weights_rad.size(); i++) {377 for(size_t i=0; i<weights_rad.size(); i++) { 378 378 dp.rad_core0 = weights_rad[i].value; 379 379 // Loop over radius weight points 380 for( int j=0; j<weights_s1.size(); j++) {380 for(size_t j=0; j<weights_s1.size(); j++) { 381 381 dp.thick_shell1 = weights_s1[j].value; 382 382 // Loop over radius weight points 383 for( int k=0; k<weights_s2.size(); k++) {383 for(size_t k=0; k<weights_s2.size(); k++) { 384 384 dp.thick_shell2 = weights_s2[k].value; 385 385 // Loop over radius weight points 386 for( int l=0; l<weights_s3.size(); l++) {386 for(size_t l=0; l<weights_s3.size(); l++) { 387 387 dp.thick_shell3 = weights_s3[l].value; 388 388 // Loop over radius weight points 389 for( int m=0; m<weights_s4.size(); m++) {389 for(size_t m=0; m<weights_s4.size(); m++) { 390 390 dp.thick_shell4 = weights_s4[m].value; 391 391 // Loop over radius weight points 392 for( int n=0; j<weights_s5.size(); n++) {392 for(size_t n=0; j<weights_s5.size(); n++) { 393 393 dp.thick_shell5 = weights_s5[n].value; 394 394 // Loop over radius weight points 395 for( int o=0; k<weights_s6.size(); o++) {395 for(size_t o=0; k<weights_s6.size(); o++) { 396 396 dp.thick_shell6 = weights_s6[o].value; 397 397 // Loop over radius weight points 398 for( int p=0; l<weights_s7.size(); p++) {398 for(size_t p=0; l<weights_s7.size(); p++) { 399 399 dp.thick_shell7 = weights_s7[p].value; 400 400 // Loop over radius weight points 401 for( int t=0; m<weights_s8.size(); t++) {401 for(size_t t=0; m<weights_s8.size(); t++) { 402 402 dp.thick_shell8 = weights_s8[t].value; 403 403 // Loop over radius weight points 404 for( int r=0; l<weights_s9.size(); r++) {404 for(size_t r=0; l<weights_s9.size(); r++) { 405 405 dp.thick_shell8 = weights_s9[r].value; 406 406 // Loop over radius weight points 407 for( int s=0; m<weights_s10.size(); s++) {407 for(size_t s=0; m<weights_s10.size(); s++) { 408 408 dp.thick_shell10 = weights_s10[s].value; 409 409 //Un-normalize FourShell by volume -
sansmodels/src/sans/models/c_models/parameters.cpp
ra5e14410 r34c2649 171 171 172 172 double rectangle_weight(double mean, double sigma, double x) { 173 double vary, expo_value;174 173 double wid = fabs(sigma) * sqrt(3.0); 175 174 if (x>= (mean-wid) && x<=(mean+wid)){ … … 265 264 double value = (*par)(); 266 265 double sig; 267 double log_value;268 266 if (npts<2) { 269 267 weights.insert(weights.end(), WeightPoint(value, 1.0)); … … 316 314 317 315 double schulz_weight(double mean, double sigma, double x) { 318 double vary, expo_value;319 316 double z = pow(mean/ sigma, 2.0)-1.0; 320 317 double R= x/mean; … … 463 460 double Parameter :: operator=(double _value){ 464 461 value = _value; 465 } 462 return value; 463 } -
sansmodels/src/sans/models/c_models/pearlnecklace.cpp
r463eb76e r34c2649 60 60 double tot_vol = 0.0; 61 61 // Loop over core weight points 62 for( int i=0; i<weights_radius.size(); i++) {62 for(size_t i=0; i<weights_radius.size(); i++) { 63 63 dp[1] = weights_radius[i].value; 64 64 // Loop over thick_inter0 weight points 65 for( int j=0; j<weights_edge_separation.size(); j++) {65 for(size_t j=0; j<weights_edge_separation.size(); j++) { 66 66 dp[2] = weights_edge_separation[j].value; 67 67 pearl_vol = 4.0 /3.0 * pi * pow(dp[1], 3); … … 142 142 double tot_vol = 0.0; 143 143 // Loop over core weight points 144 for( int i=0; i<weights_radius.size(); i++) {144 for(size_t i=0; i<weights_radius.size(); i++) { 145 145 dp.radius = weights_radius[i].value; 146 146 // Loop over thick_inter0 weight points 147 for( int j=0; j<weights_edge_separation.size(); j++) {147 for(size_t j=0; j<weights_edge_separation.size(); j++) { 148 148 dp.edge_separation = weights_edge_separation[j].value; 149 149 pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3); -
sansmodels/src/sans/models/c_models/polygausscoil.cpp
r8569cb9 r34c2649 67 67 68 68 // Loop over radius weight points 69 for( int i=0; i<weights_rad.size(); i++) {69 for(size_t i=0; i<weights_rad.size(); i++) { 70 70 dp[1] = weights_rad[i].value; 71 71 … … 117 117 */ 118 118 double Poly_GaussCoil :: calculate_ER() { 119 PolyGaussCoilParameters dp;120 dp.scale = scale();121 dp.rg= rg();122 dp.poly_m = poly_m();123 dp.background = background();124 119 double rad_out = 0.0; 125 120 … … 132 127 rg.get_weights(weights_rad); 133 128 // Loop over radius weight points to average the radius value 134 for( int i=0; i<weights_rad.size(); i++) {129 for(size_t i=0; i<weights_rad.size(); i++) { 135 130 sum += weights_rad[i].weight 136 131 * weights_rad[i].value; -
sansmodels/src/sans/models/c_models/refl.cpp
raae7a8d r34c2649 170 170 double ReflModel :: calculate_ER() { 171 171 //NOT implemented yet!!! 172 return 0.0; 172 173 } -
sansmodels/src/sans/models/c_models/refl_adv.cpp
raae7a8d r34c2649 222 222 double ReflAdvModel :: calculate_ER() { 223 223 //NOT implemented yet!!! 224 } 224 return 0.0; 225 } -
sansmodels/src/sans/models/c_models/rpa.cpp
r35aface r34c2649 149 149 double RPAModel :: calculate_ER() { 150 150 //NOT implemented!!! 151 return 0.0; 151 152 } -
sansmodels/src/sans/models/c_models/sc.cpp
r4628e31 r34c2649 75 75 76 76 // Loop over radius weight points 77 for( int i=0; i<weights_rad.size(); i++) {77 for(size_t i=0; i<weights_rad.size(); i++) { 78 78 dp[3] = weights_rad[i].value; 79 79 … … 107 107 double SCCrystalModel :: operator()(double qx, double qy) { 108 108 SCParameters dp; 109 double q = sqrt(qx*qx + qy*qy);110 109 dp.scale = scale(); 111 110 dp.dnn = dnn(); … … 142 141 double pi = 4.0*atan(1.0); 143 142 // Loop over radius weight points 144 for( int i=0; i<weights_rad.size(); i++) {143 for(size_t i=0; i<weights_rad.size(); i++) { 145 144 dp.radius = weights_rad[i].value; 146 145 // Average over theta distribution 147 for( int j=0; j< weights_theta.size(); j++) {146 for(size_t j=0; j< weights_theta.size(); j++) { 148 147 dp.theta = weights_theta[j].value; 149 148 // Average over phi distribution 150 for( int k=0; k< weights_phi.size(); k++) {149 for(size_t k=0; k< weights_phi.size(); k++) { 151 150 dp.phi = weights_phi[k].value; 152 151 // Average over phi distribution 153 for( int l=0; l< weights_psi.size(); l++) {152 for(size_t l=0; l< weights_psi.size(); l++) { 154 153 dp.psi = weights_psi[l].value; 155 154 //Un-normalize SphereForm by volume … … 212 211 double SCCrystalModel :: calculate_ER() { 213 212 //NOT implemented yet!!! 214 } 213 return 0.0; 214 } -
sansmodels/src/sans/models/c_models/sld_cal.cpp
r0164899a r34c2649 69 69 double SLDCalFunc :: calculate_ER() { 70 70 //NOT implemented yet!!! 71 return 0.0; 71 72 } -
sansmodels/src/sans/models/c_models/sphere.cpp
rf10063e r34c2649 67 67 68 68 // Loop over radius weight points 69 for( int i=0; i<weights_rad.size(); i++) {69 for(size_t i=0; i<weights_rad.size(); i++) { 70 70 dp[1] = weights_rad[i].value; 71 71 … … 113 113 */ 114 114 double SphereModel :: calculate_ER() { 115 SphereParameters dp;116 dp.scale = scale();117 dp.radius = radius();118 dp.sldSph = sldSph();119 dp.sldSolv = sldSolv();120 dp.background = background();121 115 double rad_out = 0.0; 122 116 … … 129 123 radius.get_weights(weights_rad); 130 124 // Loop over radius weight points to average the radius value 131 for( int i=0; i<weights_rad.size(); i++) {125 for(size_t i=0; i<weights_rad.size(); i++) { 132 126 sum += weights_rad[i].weight 133 127 * weights_rad[i].value; -
sansmodels/src/sans/models/c_models/spheresld.cpp
r7a8faf8 r34c2649 174 174 175 175 // Loop over core weight points 176 for( int i=0; i<weights_rad_core0.size(); i++) {176 for(size_t i=0; i<weights_rad_core0.size(); i++) { 177 177 dp[59] = weights_rad_core0[i].value; 178 178 // Loop over thick_inter0 weight points 179 for( int j=0; j<weights_thick_inter0.size(); j++) {179 for(size_t j=0; j<weights_thick_inter0.size(); j++) { 180 180 dp[2] = weights_thick_inter0[j].value; 181 181 … … 273 273 thick_inter0.get_weights(weights_thick_inter0); 274 274 // Loop over radius weight points 275 for( int i=0; i<weights_rad_core0.size(); i++) {275 for(size_t i=0; i<weights_rad_core0.size(); i++) { 276 276 dp.rad_core0 = weights_rad_core0[i].value; 277 277 // Loop over radius weight points 278 for( int j=0; j<weights_thick_inter0.size(); j++) {278 for(size_t j=0; j<weights_thick_inter0.size(); j++) { 279 279 dp.thick_inter0 = weights_thick_inter0[j].value; 280 280 rad_out = dp.rad_core0 + dp.thick_inter0; -
sansmodels/src/sans/models/libigor/libCylinder.c
r3a084629 r34c2649 1337 1337 1338 1338 return answer; 1339 }1340 1341 /////////functions for WRC implementation of flexible cylinders1342 static double1343 Sk_WR(double q, double L, double b)1344 {1345 //1346 double p1,p2,p1short,p2short,q0,qconnect;1347 double C,epsilon,ans,q0short,Sexvmodify,pi;1348 1349 pi = 4.0*atan(1.0);1350 1351 p1 = 4.12;1352 p2 = 4.42;1353 p1short = 5.36;1354 p2short = 5.62;1355 q0 = 3.1;1356 qconnect = q0/b;1357 //1358 q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0);1359 1360 //1361 if(L/b > 10.0) {1362 C = 3.06/pow((L/b),0.44);1363 epsilon = 0.176;1364 } else {1365 C = 1.0;1366 epsilon = 0.170;1367 }1368 //1369 1370 if( L > 4*b ) { // Longer Chains1371 if (q*b <= 3.1) { //Modified by Yun on Oct. 15,1372 Sexvmodify = Sexvnew(q, L, b);1373 ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L);1374 } else { //q(i)*b > 3.11375 ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + pi/(q*L);1376 }1377 } else { //L <= 4*b Shorter Chains1378 if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) {1379 if (q*b<=0.01) {1380 ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0;1381 } else {1382 ans = Sdebye1(q,L,b);1383 }1384 } else { //q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3)1385 ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + pi/(q*L);1386 }1387 }1388 1389 return(ans);1390 //return(a2long(q, L, b, p1, p2, q0));1391 }1392 1393 //WR named this w (too generic)1394 static double1395 w_WR(double x)1396 {1397 double yy;1398 yy = 0.5*(1 + tanh((x - 1.523)/0.1477));1399 1400 return (yy);1401 }1402 1403 //1404 static double1405 u1(double q, double L, double b)1406 {1407 double yy;1408 1409 yy = Rgsquareshort(q,L,b)*q*q;1410 1411 return (yy);1412 }1413 1414 // was named u1415 static double1416 u_WR(double q, double L, double b)1417 {1418 double yy;1419 yy = Rgsquare(q,L,b)*q*q;1420 return (yy);1421 }1422 1423 1424 1425 //1426 static double1427 Rgsquarezero(double q, double L, double b)1428 {1429 double yy;1430 yy = (L*b/6.0) * (1.0 - 1.5*(b/L) + 1.5*pow((b/L),2) - 0.75*pow((b/L),3)*(1.0 - exp(-2.0*(L/b))));1431 1432 return (yy);1433 }1434 1435 //1436 static double1437 Rgsquareshort(double q, double L, double b)1438 {1439 double yy;1440 yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b);1441 1442 return (yy);1443 }1444 1445 //1446 static double1447 Rgsquare(double q, double L, double b)1448 {1449 double yy;1450 yy = AlphaSquare(L/b)*L*b/6.0;1451 1452 return (yy);1453 }1454 1455 //1456 static double1457 AlphaSquare(double x)1458 {1459 double yy;1460 yy = pow( (1.0 + (x/3.12)*(x/3.12) + (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) );1461 1462 return (yy);1463 }1464 1465 // ?? funciton is not used - but should the log actually be log10???1466 static double1467 miu(double x)1468 {1469 double yy;1470 yy = (1.0/8.0)*(9.0*x - 2.0 + 2.0*log(1.0 + x)/x)*exp(1.0/2.565*(1.0/x + (1.0 - 1.0/(x*x))*log(1.0 + x)));1471 1472 return (yy);1473 }1474 1475 //1476 static double1477 Sdebye(double q, double L, double b)1478 {1479 double yy;1480 yy = 2.0*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1.0)/(pow((u_WR(q,L,b)),2));1481 1482 return (yy);1483 }1484 1485 //1486 static double1487 Sdebye1(double q, double L, double b)1488 {1489 double yy;1490 yy = 2.0*(exp(-u1(q,L,b)) + u1(q,L,b) -1.0)/( pow((u1(q,L,b)),2.0) );1491 1492 return (yy);1493 }1494 1495 //1496 static double1497 Sexv(double q, double L, double b)1498 {1499 double yy,C1,C2,C3,miu,Rg2;1500 C1=1.22;1501 C2=0.4288;1502 C3=-1.651;1503 miu = 0.585;1504 1505 Rg2 = Rgsquare(q,L,b);1506 1507 yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu)));1508 1509 return (yy);1510 }1511 1512 // this must be WR modified version1513 static double1514 Sexvnew(double q, double L, double b)1515 {1516 double yy,C1,C2,C3,miu;1517 double del=1.05,C_star2,Rg2;1518 1519 C1=1.22;1520 C2=0.4288;1521 C3=-1.651;1522 miu = 0.585;1523 1524 //calculating the derivative to decide on the corection (cutoff) term?1525 // I have modified this from WRs original code1526 1527 if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0.0 ) {1528 C_star2 = 0.0;1529 } else {1530 C_star2 = 1.0;1531 }1532 1533 Rg2 = Rgsquare(q,L,b);1534 1535 yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu)));1536 1537 return (yy);1538 }1539 1540 // these are the messy ones1541 static double1542 a2short(double q, double L, double b, double p1short, double p2short, double q0)1543 {1544 double yy,Rg2_sh;1545 double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p;1546 double pi;1547 1548 E = 2.718281828459045091;1549 pi = 4.0*atan(1.0);1550 Rg2_sh = Rgsquareshort(q,L,b);1551 Rg2_sh2 = Rg2_sh*Rg2_sh;1552 t1 = ((q0*q0*Rg2_sh)/(b*b));1553 Et1 = pow(E,t1);1554 Emt1 =pow(E,-t1);1555 q02 = q0*q0;1556 q0p = pow(q0,(-4.0 + p2short) );1557 1558 //E is the number e1559 yy = ((-(1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b*b*b*L - 8.0*b*b*b*Et1*L - 2.0*b*b*b*L*p1short + 2.0*b*b*b*Et1*L*p1short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p1short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p1short*pi*q02*q0*Rg2_sh2)))))));1560 1561 return (yy);1562 }1563 1564 //1565 static double1566 a1short(double q, double L, double b, double p1short, double p2short, double q0)1567 {1568 double yy,Rg2_sh;1569 double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p,b3;1570 double pi;1571 1572 E = 2.718281828459045091;1573 pi = 4.0*atan(1.0);1574 Rg2_sh = Rgsquareshort(q,L,b);1575 Rg2_sh2 = Rg2_sh*Rg2_sh;1576 b3 = b*b*b;1577 t1 = ((q0*q0*Rg2_sh)/(b*b));1578 Et1 = pow(E,t1);1579 Emt1 =pow(E,-t1);1580 q02 = q0*q0;1581 q0p = pow(q0,(-4.0 + p1short) );1582 1583 yy = ((1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p2short*pi*q02*q0*Rg2_sh2))))));1584 1585 return(yy);1586 }1587 1588 // this one will be lots of trouble1589 static double1590 a2long(double q, double L, double b, double p1, double p2, double q0)1591 {1592 double yy,C1,C2,C3,C4,C5,miu,C,Rg2;1593 double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,pi;1594 double E,b2,b3,b4,q02,q03,q04,q05,Rg22;1595 1596 pi = 4.0*atan(1.0);1597 E = 2.718281828459045091;1598 if( L/b > 10.0) {1599 C = 3.06/pow((L/b),0.44);1600 } else {1601 C = 1.0;1602 }1603 1604 C1 = 1.22;1605 C2 = 0.4288;1606 C3 = -1.651;1607 C4 = 1.523;1608 C5 = 0.1477;1609 miu = 0.585;1610 1611 Rg2 = Rgsquare(q,L,b);1612 Rg22 = Rg2*Rg2;1613 b2 = b*b;1614 b3 = b*b*b;1615 b4 = b3*b;1616 q02 = q0*q0;1617 q03 = q0*q0*q0;1618 q04 = q03*q0;1619 q05 = q04*q0;1620 1621 t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) ));1622 1623 t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L;1624 1625 t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5);1626 1627 t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);1628 1629 t5 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1630 1631 t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);1632 1633 t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));1634 1635 t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));1636 1637 t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L;1638 1639 t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1640 1641 1642 yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));1643 1644 return (yy);1645 }1646 1647 //need to define this on my own1648 static double1649 sech_WR(double x)1650 {1651 return(1/cosh(x));1652 }1653 1654 //1655 static double1656 a1long(double q, double L, double b, double p1, double p2, double q0)1657 {1658 double yy,C,C1,C2,C3,C4,C5,miu,Rg2;1659 double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15;1660 double E,pi;1661 double b2,b3,b4,q02,q03,q04,q05,Rg22;1662 1663 pi = 4.0*atan(1.0);1664 E = 2.718281828459045091;1665 1666 if( L/b > 10.0) {1667 C = 3.06/pow((L/b),0.44);1668 } else {1669 C = 1.0;1670 }1671 1672 C1 = 1.22;1673 C2 = 0.4288;1674 C3 = -1.651;1675 C4 = 1.523;1676 C5 = 0.1477;1677 miu = 0.585;1678 1679 Rg2 = Rgsquare(q,L,b);1680 Rg22 = Rg2*Rg2;1681 b2 = b*b;1682 b3 = b*b*b;1683 b4 = b3*b;1684 q02 = q0*q0;1685 q03 = q0*q0*q0;1686 q04 = q03*q0;1687 q05 = q04*q0;1688 1689 t1 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));1690 1691 t2 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));1692 1693 t3 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));1694 1695 t4 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));1696 1697 t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2))));1698 1699 t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2)))*Rg2)/b)));1700 1701 t7 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));1702 1703 t8 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));1704 1705 t9 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));1706 1707 t10 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));1708 1709 t11 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));1710 1711 t12 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));1712 1713 t13 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02* Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));1714 1715 t14 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));1716 1717 t15 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));1718 1719 1720 yy = (pow(q0,p1)*(((-((b*pi)/(L*q0))) +t1/L +t2/(q04*Rg22) + 1.0/2.0*t3*t4)) + (t5*((pow(q0,(p1 - p2))*(((-pow(q0,(-p1)))*(((b2*pi)/(L*q02) +t6/L +t7/(2.0*C5) -t8/(C5*q04*Rg22) +t9/(q04*Rg22) -t10/(q05*Rg22) + 1.0/2.0*t11*t12)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) +t13/L +t14/(q04*Rg22) + 1.0/2.0*t15*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))));1721 1722 return (yy);1723 1339 } 1724 1340 … … 2132 1748 } 2133 1749 2134 static double2135 gammaln(double xx)2136 {2137 double x,y,tmp,ser;2138 static double cof[6]={76.18009172947146,-86.50532032941677,2139 24.01409824083091,-1.231739572450155,2140 0.1208650973866179e-2,-0.5395239384953e-5};2141 int j;2142 2143 y=x=xx;2144 tmp=x+5.5;2145 tmp -= (x+0.5)*log(tmp);2146 ser=1.000000000190015;2147 for (j=0;j<=5;j++) ser += cof[j]/++y;2148 return -tmp+log(2.5066282746310005*ser/x);2149 }2150 2151 1750 2152 1751 double -
sansmodels/src/sans/models/libigor/libCylinder.h
r3a084629 r34c2649 67 67 68 68 /////////functions for WRC implementation of flexible cylinders 69 static double Sk_WR(double q, double L, double b); 70 static double w_WR(double x); 71 static double u1(double q, double L, double b); 72 static double u_WR(double q, double L, double b); 73 static double Rgsquarezero(double q, double L, double b); 74 static double Rgsquareshort(double q, double L, double b); 75 static double Rgsquare(double q, double L, double b); 76 static double AlphaSquare(double x); 77 static double miu(double x); 78 static double Sdebye(double q, double L, double b); 79 static double Sdebye1(double q, double L, double b); 80 static double Sexv(double q, double L, double b); 81 static double Sexvnew(double q, double L, double b); 82 static double a2short(double q, double L, double b, double p1short, double p2short, double q0); 83 static double a1short(double q, double L, double b, double p1short, double p2short, double q0); 84 static double a2long(double q, double L, double b, double p1, double p2, double q0); 85 static double sech_WR(double x); 86 static double a1long(double q, double L, double b, double p1, double p2, double q0); 87 static double gammaln(double xx); 69 static double 70 gammaln(double xx) 71 { 72 double x,y,tmp,ser; 73 static double cof[6]={76.18009172947146,-86.50532032941677, 74 24.01409824083091,-1.231739572450155, 75 0.1208650973866179e-2,-0.5395239384953e-5}; 76 int j; 77 78 y=x=xx; 79 tmp=x+5.5; 80 tmp -= (x+0.5)*log(tmp); 81 ser=1.000000000190015; 82 for (j=0;j<=5;j++) ser += cof[j]/++y; 83 return -tmp+log(2.5066282746310005*ser/x); 84 } 85 86 // 87 static double 88 AlphaSquare(double x) 89 { 90 double yy; 91 yy = pow( (1.0 + (x/3.12)*(x/3.12) + (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) ); 92 93 return (yy); 94 } 95 96 // 97 static double 98 Rgsquarezero(double q, double L, double b) 99 { 100 double yy; 101 yy = (L*b/6.0) * (1.0 - 1.5*(b/L) + 1.5*pow((b/L),2) - 0.75*pow((b/L),3)*(1.0 - exp(-2.0*(L/b)))); 102 103 return (yy); 104 } 105 106 // 107 static double 108 Rgsquareshort(double q, double L, double b) 109 { 110 double yy; 111 yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b); 112 113 return (yy); 114 } 115 116 // 117 static double 118 Rgsquare(double q, double L, double b) 119 { 120 double yy; 121 yy = AlphaSquare(L/b)*L*b/6.0; 122 123 return (yy); 124 } 125 126 // ?? funciton is not used - but should the log actually be log10??? 127 static double 128 miu(double x) 129 { 130 double yy; 131 yy = (1.0/8.0)*(9.0*x - 2.0 + 2.0*log(1.0 + x)/x)*exp(1.0/2.565*(1.0/x + (1.0 - 1.0/(x*x))*log(1.0 + x))); 132 133 return (yy); 134 } 135 136 //WR named this w (too generic) 137 static double 138 w_WR(double x) 139 { 140 double yy; 141 yy = 0.5*(1 + tanh((x - 1.523)/0.1477)); 142 143 return (yy); 144 } 145 146 // 147 static double 148 u1(double q, double L, double b) 149 { 150 double yy; 151 152 yy = Rgsquareshort(q,L,b)*q*q; 153 154 return (yy); 155 } 156 157 // was named u 158 static double 159 u_WR(double q, double L, double b) 160 { 161 double yy; 162 yy = Rgsquare(q,L,b)*q*q; 163 return (yy); 164 } 165 166 167 // 168 static double 169 Sdebye1(double q, double L, double b) 170 { 171 double yy; 172 yy = 2.0*(exp(-u1(q,L,b)) + u1(q,L,b) -1.0)/( pow((u1(q,L,b)),2.0) ); 173 174 return (yy); 175 } 176 177 178 // 179 static double 180 Sdebye(double q, double L, double b) 181 { 182 double yy; 183 yy = 2.0*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1.0)/(pow((u_WR(q,L,b)),2)); 184 185 return (yy); 186 } 187 188 // 189 static double 190 Sexv(double q, double L, double b) 191 { 192 double yy,C1,C2,C3,miu,Rg2; 193 C1=1.22; 194 C2=0.4288; 195 C3=-1.651; 196 miu = 0.585; 197 198 Rg2 = Rgsquare(q,L,b); 199 200 yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu))); 201 202 return (yy); 203 } 204 205 // this must be WR modified version 206 static double 207 Sexvnew(double q, double L, double b) 208 { 209 double yy,C1,C2,C3,miu; 210 double del=1.05,C_star2,Rg2; 211 212 C1=1.22; 213 C2=0.4288; 214 C3=-1.651; 215 miu = 0.585; 216 217 //calculating the derivative to decide on the corection (cutoff) term? 218 // I have modified this from WRs original code 219 220 if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0.0 ) { 221 C_star2 = 0.0; 222 } else { 223 C_star2 = 1.0; 224 } 225 226 Rg2 = Rgsquare(q,L,b); 227 228 yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu))); 229 230 return (yy); 231 } 232 233 // these are the messy ones 234 static double 235 a2short(double q, double L, double b, double p1short, double p2short, double q0) 236 { 237 double yy,Rg2_sh; 238 double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p; 239 double pi; 240 241 E = 2.718281828459045091; 242 pi = 4.0*atan(1.0); 243 Rg2_sh = Rgsquareshort(q,L,b); 244 Rg2_sh2 = Rg2_sh*Rg2_sh; 245 t1 = ((q0*q0*Rg2_sh)/(b*b)); 246 Et1 = pow(E,t1); 247 Emt1 =pow(E,-t1); 248 q02 = q0*q0; 249 q0p = pow(q0,(-4.0 + p2short) ); 250 251 //E is the number e 252 yy = ((-(1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b*b*b*L - 8.0*b*b*b*Et1*L - 2.0*b*b*b*L*p1short + 2.0*b*b*b*Et1*L*p1short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p1short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p1short*pi*q02*q0*Rg2_sh2))))))); 253 254 return (yy); 255 } 256 257 // 258 static double 259 a1short(double q, double L, double b, double p1short, double p2short, double q0) 260 { 261 double yy,Rg2_sh; 262 double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p,b3; 263 double pi; 264 265 E = 2.718281828459045091; 266 pi = 4.0*atan(1.0); 267 Rg2_sh = Rgsquareshort(q,L,b); 268 Rg2_sh2 = Rg2_sh*Rg2_sh; 269 b3 = b*b*b; 270 t1 = ((q0*q0*Rg2_sh)/(b*b)); 271 Et1 = pow(E,t1); 272 Emt1 =pow(E,-t1); 273 q02 = q0*q0; 274 q0p = pow(q0,(-4.0 + p1short) ); 275 276 yy = ((1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p2short*pi*q02*q0*Rg2_sh2)))))); 277 278 return(yy); 279 } 280 281 282 //need to define this on my own 283 static double 284 sech_WR(double x) 285 { 286 return(1/cosh(x)); 287 } 288 289 // this one will be lots of trouble 290 static double 291 a2long(double q, double L, double b, double p1, double p2, double q0) 292 { 293 double yy,C1,C2,C3,C4,C5,miu,C,Rg2; 294 double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,pi; 295 double E,b2,b3,b4,q02,q03,q04,q05,Rg22; 296 297 pi = 4.0*atan(1.0); 298 E = 2.718281828459045091; 299 if( L/b > 10.0) { 300 C = 3.06/pow((L/b),0.44); 301 } else { 302 C = 1.0; 303 } 304 305 C1 = 1.22; 306 C2 = 0.4288; 307 C3 = -1.651; 308 C4 = 1.523; 309 C5 = 0.1477; 310 miu = 0.585; 311 312 Rg2 = Rgsquare(q,L,b); 313 Rg22 = Rg2*Rg2; 314 b2 = b*b; 315 b3 = b*b*b; 316 b4 = b3*b; 317 q02 = q0*q0; 318 q03 = q0*q0*q0; 319 q04 = q03*q0; 320 q05 = q04*q0; 321 322 t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) )); 323 324 t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L; 325 326 t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5); 327 328 t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22); 329 330 t5 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22); 331 332 t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22); 333 334 t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu)); 335 336 t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))); 337 338 t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L; 339 340 t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22); 341 342 343 yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))); 344 345 return (yy); 346 } 347 // 348 static double 349 a1long(double q, double L, double b, double p1, double p2, double q0) 350 { 351 double yy,C,C1,C2,C3,C4,C5,miu,Rg2; 352 double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15; 353 double E,pi; 354 double b2,b3,b4,q02,q03,q04,q05,Rg22; 355 356 pi = 4.0*atan(1.0); 357 E = 2.718281828459045091; 358 359 if( L/b > 10.0) { 360 C = 3.06/pow((L/b),0.44); 361 } else { 362 C = 1.0; 363 } 364 365 C1 = 1.22; 366 C2 = 0.4288; 367 C3 = -1.651; 368 C4 = 1.523; 369 C5 = 0.1477; 370 miu = 0.585; 371 372 Rg2 = Rgsquare(q,L,b); 373 Rg22 = Rg2*Rg2; 374 b2 = b*b; 375 b3 = b*b*b; 376 b4 = b3*b; 377 q02 = q0*q0; 378 q03 = q0*q0*q0; 379 q04 = q03*q0; 380 q05 = q04*q0; 381 382 t1 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2)))); 383 384 t2 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))); 385 386 t3 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu)))); 387 388 t4 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))); 389 390 t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)))); 391 392 t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2)))*Rg2)/b))); 393 394 t7 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2)); 395 396 t8 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2)); 397 398 t9 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))); 399 400 t10 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))); 401 402 t11 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu)); 403 404 t12 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))); 405 406 t13 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02* Rg2))) + (7.0*b2)/(15.0*q02*Rg2)))); 407 408 t14 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))); 409 410 t15 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu)))); 411 412 413 yy = (pow(q0,p1)*(((-((b*pi)/(L*q0))) +t1/L +t2/(q04*Rg22) + 1.0/2.0*t3*t4)) + (t5*((pow(q0,(p1 - p2))*(((-pow(q0,(-p1)))*(((b2*pi)/(L*q02) +t6/L +t7/(2.0*C5) -t8/(C5*q04*Rg22) +t9/(q04*Rg22) -t10/(q05*Rg22) + 1.0/2.0*t11*t12)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) +t13/L +t14/(q04*Rg22) + 1.0/2.0*t15*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))))); 414 415 return (yy); 416 } 417 418 419 static double 420 Sk_WR(double q, double L, double b) 421 { 422 // 423 double p1,p2,p1short,p2short,q0; 424 double C,ans,q0short,Sexvmodify,pi; 425 426 pi = 4.0*atan(1.0); 427 428 p1 = 4.12; 429 p2 = 4.42; 430 p1short = 5.36; 431 p2short = 5.62; 432 q0 = 3.1; 433 // 434 q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0); 435 436 // 437 if(L/b > 10.0) { 438 C = 3.06/pow((L/b),0.44); 439 } else { 440 C = 1.0; 441 } 442 // 443 444 if( L > 4*b ) { // Longer Chains 445 if (q*b <= 3.1) { //Modified by Yun on Oct. 15, 446 Sexvmodify = Sexvnew(q, L, b); 447 ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L); 448 } else { //q(i)*b > 3.1 449 ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + pi/(q*L); 450 } 451 } else { //L <= 4*b Shorter Chains 452 if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) { 453 if (q*b<=0.01) { 454 ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0; 455 } else { 456 ans = Sdebye1(q,L,b); 457 } 458 } else { //q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3) 459 ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + pi/(q*L); 460 } 461 } 462 463 return(ans); 464 //return(a2long(q, L, b, p1, p2, q0)); 465 } 466 -
sansmodels/src/sans/models/libigor/libSphere.c
r3a084629 r34c2649 653 653 } 654 654 655 /* 655 656 static double 656 657 LogNormal_distr(double sig, double mu, double pt) … … 672 673 return(retval); 673 674 } 675 */ 674 676 675 677 // scattering from a core shell sphere with a (Schulz) polydisperse core and constant ratio (shell thickness)/(core radius) … … 1220 1222 } 1221 1223 1224 /* 1222 1225 static double 1223 1226 SchulzPoint(double x, double avg, double zz) { … … 1245 1248 return -tmp+log(2.5066282746310005*ser/x); 1246 1249 } 1250 */ 1247 1251 1248 1252 double … … 1262 1266 // variables are: 1263 1267 //[0] scale factor 1264 //[1] radius of core [ ]1265 //[2] SLD of the core [ -2]1266 //[3] thickness of the shell [ ]1268 //[1] radius of core [ï¿œ] 1269 //[2] SLD of the core [ï¿œ-2] 1270 //[3] thickness of the shell [ï¿œ] 1267 1271 //[4] SLD of the shell 1268 1272 //[5] SLD of the solvent … … 1305 1309 f += vol*bes*contr; 1306 1310 1307 // normalize to particle volume and rescale from [ -1] to [cm-1]1311 // normalize to particle volume and rescale from [ï¿œ-1] to [cm-1] 1308 1312 f2 = f*f/vol*1.0e8; 1309 1313 … … 1321 1325 // variables are: 1322 1326 //[0] scale factor 1323 //[1] radius of core [ ]1324 //[2] SLD of the core [ -2]1325 //[3] thickness of shell 1 [ ]1327 //[1] radius of core [ï¿œ] 1328 //[2] SLD of the core [ï¿œ-2] 1329 //[3] thickness of shell 1 [ï¿œ] 1326 1330 //[4] SLD of shell 1 1327 //[5] thickness of shell 2 [ ]1331 //[5] thickness of shell 2 [ï¿œ] 1328 1332 //[6] SLD of shell 2 1329 1333 //[7] SLD of the solvent … … 1379 1383 1380 1384 1381 // normalize to particle volume and rescale from [ -1] to [cm-1]1385 // normalize to particle volume and rescale from [ï¿œ-1] to [cm-1] 1382 1386 f2 = f*f/vol*1.0e8; 1383 1387 … … 1395 1399 // variables are: 1396 1400 //[0] scale factor 1397 //[1] radius of core [ ]1398 //[2] SLD of the core [ -2]1399 //[3] thickness of shell 1 [ ]1401 //[1] radius of core [ï¿œ] 1402 //[2] SLD of the core [ï¿œ-2] 1403 //[3] thickness of shell 1 [ï¿œ] 1400 1404 //[4] SLD of shell 1 1401 //[5] thickness of shell 2 [ ]1405 //[5] thickness of shell 2 [ï¿œ] 1402 1406 //[6] SLD of shell 2 1403 1407 //[7] thickness of shell 3 … … 1467 1471 f += vol*bes*contr; 1468 1472 1469 // normalize to particle volume and rescale from [ -1] to [cm-1]1473 // normalize to particle volume and rescale from [ï¿œ-1] to [cm-1] 1470 1474 f2 = f*f/vol*1.0e8; 1471 1475 … … 1483 1487 // variables are: 1484 1488 //[0] scale factor 1485 //[1] radius of core [ ]1486 //[2] SLD of the core [ -2]1487 //[3] thickness of shell 1 [ ]1489 //[1] radius of core [ï¿œ] 1490 //[2] SLD of the core [ï¿œ-2] 1491 //[3] thickness of shell 1 [ï¿œ] 1488 1492 //[4] SLD of shell 1 1489 //[5] thickness of shell 2 [ ]1493 //[5] thickness of shell 2 [ï¿œ] 1490 1494 //[6] SLD of shell 2 1491 1495 //[7] thickness of shell 3 … … 1570 1574 1571 1575 1572 // normalize to particle volume and rescale from [ -1] to [cm-1]1576 // normalize to particle volume and rescale from [ï¿œ-1] to [cm-1] 1573 1577 f2 = f*f/vol*1.0e8; 1574 1578 … … 1997 2001 bes = 3.0*(sin(x*radius)-x*radius*cos(x*radius))/(x*x*x)/(radius*radius*radius); 1998 2002 vol = 4.0*pi/3.0*radius*radius*radius; 1999 f = vol*bes*delrho ; // [=] 2003 f = vol*bes*delrho ; // [=] ï¿œ 2000 2004 // normalize to single particle volume, convert to 1/cm 2001 2005 f2 = f * f / vol * 1.0e8; // [=] 1/cm -
sansmodels/src/sans/models/libigor/libSphere.h
r3a084629 r34c2649 49 49 50 50 51 static double SchulzPoint(double x, double avg, double zz); 52 static double gammln(double xx); 53 static double Gauss_distr(double sig, double avg, double pt); 54 static double LogNormal_distr(double sig, double mu, double pt); 51 static double 52 gammln(double xx) { 53 double x,y,tmp,ser; 54 static double cof[6]={76.18009172947146,-86.50532032941677, 55 24.01409824083091,-1.231739572450155, 56 0.1208650973866179e-2,-0.5395239384953e-5}; 57 int j; 55 58 59 y=x=xx; 60 tmp=x+5.5; 61 tmp -= (x+0.5)*log(tmp); 62 ser=1.000000000190015; 63 for (j=0;j<=5;j++) ser += cof[j]/++y; 64 return -tmp+log(2.5066282746310005*ser/x); 65 } 66 67 static double 68 LogNormal_distr(double sig, double mu, double pt) 69 { 70 double retval,pi; 71 72 pi = 4.0*atan(1.0); 73 retval = (1.0/ (sig*pt*sqrt(2.0*pi)) )*exp( -0.5*(log(pt) - mu)*(log(pt) - mu)/sig/sig ); 74 return(retval); 75 } 76 77 static double 78 Gauss_distr(double sig, double avg, double pt) 79 { 80 double retval,Pi; 81 82 Pi = 4.0*atan(1.0); 83 retval = (1.0/ (sig*sqrt(2.0*Pi)) )*exp(-(avg-pt)*(avg-pt)/sig/sig/2.0); 84 return(retval); 85 } 86 87 static double SchulzPoint(double x, double avg, double zz) { 88 double dr; 89 dr = zz*log(x) - gammln(zz+1.0)+(zz+1.0)*log((zz+1.0)/avg)-(x/avg*(zz+1.0)); 90 return (exp(dr)); 91 }; 92 -
sansmodels/src/sans/models/libigor/libTwoPhase.c
r3a084629 r34c2649 421 421 { 422 422 //w[0] = scale 423 //w[1] = radius of gyration [ ]423 //w[1] = radius of gyration [ï¿œ] 424 424 //w[2] = polydispersity, ratio of Mw/Mn 425 425 //w[3] = bkg [cm-1] … … 475 475 476 476 477 static double478 gammln(double xx) {479 480 double x,y,tmp,ser;481 static double cof[6]={76.18009172947146,-86.50532032941677,482 24.01409824083091,-1.231739572450155,483 0.1208650973866179e-2,-0.5395239384953e-5};484 int j;485 486 y=x=xx;487 tmp=x+5.5;488 tmp -= (x+0.5)*log(tmp);489 ser=1.000000000190015;490 for (j=0;j<=5;j++) ser += cof[j]/++y;491 return -tmp+log(2.5066282746310005*ser/x);492 }493 494 477 double 495 478 GaussianShell(double w[], double x) … … 497 480 // variables are: 498 481 //[0] scale 499 //[1] radius ( )500 //[2] thick ( ) (thickness parameter - this is the std. dev. of the Gaussian width of the shell)482 //[1] radius (ï¿œ) 483 //[2] thick (ï¿œ) (thickness parameter - this is the std. dev. of the Gaussian width of the shell) 501 484 //[3] polydispersity of the radius 502 //[4] sld shell ( -2)485 //[4] sld shell (ï¿œ-2) 503 486 //[5] sld solvent 504 487 //[6] background (cm-1) -
sansmodels/src/sans/models/libigor/libTwoPhase.h
r3a084629 r34c2649 24 24 25 25 /* internal functions */ 26 static double gammln(double xx); 26 static double 27 gammln(double xx) { 27 28 29 double x,y,tmp,ser; 30 static double cof[6]={76.18009172947146,-86.50532032941677, 31 24.01409824083091,-1.231739572450155, 32 0.1208650973866179e-2,-0.5395239384953e-5}; 33 int j; 34 35 y=x=xx; 36 tmp=x+5.5; 37 tmp -= (x+0.5)*log(tmp); 38 ser=1.000000000190015; 39 for (j=0;j<=5;j++) ser += cof[j]/++y; 40 return -tmp+log(2.5066282746310005*ser/x); 41 } 42 43
Note: See TracChangeset
for help on using the changeset viewer.