Changeset 8e36cdd in sasview for sansmodels/src/libigor/libCylinder.c
- Timestamp:
- Aug 20, 2009 1:24:23 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:
- 1d67243
- Parents:
- 191b369
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/libigor/libCylinder.c
r7d11b81 r8e36cdd 83 83 84 84 Pi = 4.0*atan(1.0); 85 va = 0 ;86 vb = 1 ; //orintational average, outer integral87 vaj=0 ;85 va = 0.0; 86 vb = 1.0; //orintational average, outer integral 87 vaj=0.0; 88 88 vbj=Pi; //endpoints of inner integral 89 89 … … 163 163 164 164 Pi = 4.0*atan(1.0); 165 va = 0 ;166 vb = 1 ; //orintational average, outer integral167 vaj=0 ;165 va = 0.0; 166 vb = 1.0; //orintational average, outer integral 167 vaj=0.0; 168 168 vbj=Pi; //endpoints of inner integral 169 169 … … 243 243 244 244 Pi = 4.0*atan(1.0); 245 va = 0 ;246 vb = 1 ; //orintational average, outer integral247 vaj = 0 ;248 vbj = 1 ; //endpoints of inner integral245 va = 0.0; 246 vb = 1.0; //orintational average, outer integral 247 vaj = 0.0; 248 vbj = 1.0; //endpoints of inner integral 249 249 250 250 summ = 0.0; //initialize intergral … … 314 314 315 315 // Pi = 4.0*atan(1.0); 316 va = 0 ;317 vb = 1 ; //orintational average, outer integral318 vaj = 0 ;319 vbj = 1 ; //endpoints of inner integral316 va = 0.0; 317 vb = 1.0; //orintational average, outer integral 318 vaj = 0.0; 319 vbj = 1.0; //endpoints of inner integral 320 320 321 321 summ = 0.0; //initialize intergral … … 349 349 answer = (vbj-vaj)/2.0*summj; 350 350 351 arg = mu*cc*sigma/2 ;352 if ( arg == 0 ) {353 answer *= 1 ;351 arg = mu*cc*sigma/2.0; 352 if ( arg == 0.0 ) { 353 answer *= 1.0; 354 354 } else { 355 355 answer *= sin(arg)*sin(arg)/arg/arg; … … 397 397 398 398 pi = 4.0*atan(1.0); 399 va = 0 ;400 vb = 1 ; //limits of numerical integral399 va = 0.0; 400 vb = 1.0; //limits of numerical integral 401 401 402 402 summ = 0.0; //initialize intergral … … 450 450 451 451 pi = 4.0*atan(1.0); 452 va = 0 ;453 vb = 1 ; //limits of numerical integral452 va = 0.0; 453 vb = 1.0; //limits of numerical integral 454 454 455 455 summ = 0.0; //initialize intergral … … 470 470 answer *= delrho*delrho; 471 471 //normalize by volume 472 answer *= 4 *pi/3*a*a*nua;472 answer *= 4.0*pi/3.0*a*a*nua; 473 473 //convert to [cm-1] 474 474 answer *= 1.0e8; … … 804 804 answer = (uplim-lolim)/2.0*summ; 805 805 // normalize by particle volume 806 prolatevol = 4 *Pi/3*trmaj*trmin*trmin;806 prolatevol = 4.0*Pi/3.0*trmaj*trmin*trmin; 807 807 answer /= prolatevol; 808 808 … … 1009 1009 1010 1010 Euler = 0.5772156649; // Euler's constant 1011 dQDefault = 0 ; //0.0025; //[=] 1/A, q-resolution, default value1011 dQDefault = 0.0; //0.0025; //[=] 1/A, q-resolution, default value 1012 1012 dQ = dQDefault; 1013 1013 … … 1602 1602 t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) )); 1603 1603 1604 t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14 *b3*pow(E,(-((q02*Rg2)/b2))))/(15*q03*Rg2) + (2*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15*q02*Rg2)))*Rg2)/b)))/L;1605 1606 t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3 )/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(2*C5);1607 1608 t4 = (b4*sqrt(Rg2)*(((-1 ) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);1609 1610 t5 = (2 *b4*(((2*q0*Rg2)/b - (2*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1611 1612 t6 = (8 *b4*b*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1+ 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);1613 1614 t7 = (((-((3 *C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 3/miu)))/miu)) - (2*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 2/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 1/miu)))/miu));1615 1616 t8 = ((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));1617 1618 t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7 *b2)/(15*q02*Rg2))) + (7*b2)/(15*q02*Rg2))))/L;1619 1620 t10 = (2 *b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1+ 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1621 1622 1623 yy = ((-1 *(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1)/miu))))*((1+ tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));1604 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; 1605 1606 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); 1607 1608 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); 1609 1610 t5 = (2.0*b4*(((2*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); 1611 1612 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); 1613 1614 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)); 1615 1616 t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))); 1617 1618 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; 1619 1620 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); 1621 1622 1623 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)))))))))); 1624 1624 1625 1625 return (yy); … … 1845 1845 nord = 76; 1846 1846 lolim = 0; 1847 uplim = Pi/2 ;1847 uplim = Pi/2.0; 1848 1848 halfheight = length/2.0; 1849 1849 … … 2191 2191 2192 2192 //handle arg=0 separately, as sin(t)/t -> 1 as t->0 2193 arg1 = (mu/2 )*cos(Pi*uu/2);2194 arg2 = (mu*aa/2 )*sin(Pi*uu/2);2193 arg1 = (mu/2.0)*cos(Pi*uu/2.0); 2194 arg2 = (mu*aa/2.0)*sin(Pi*uu/2.0); 2195 2195 if(arg1==0.0) { 2196 2196 tmp1 = 1.0;
Note: See TracChangeset
for help on using the changeset viewer.