Changeset 3a48772 in sasmodels
- Timestamp:
- Oct 14, 2016 5:23:40 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- a5b6997
- Parents:
- b716cc6
- Location:
- sasmodels/models
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.c
r11ca2ab r3a48772 39 39 // translate dx in [-1,1] to dx in [lower,upper] 40 40 const double integral = total*zm; 41 const double bell_fq = 2 *M_PI*cube(radius_bell)*integral;41 const double bell_fq = 2.0*M_PI*cube(radius_bell)*integral; 42 42 return bell_fq; 43 43 } -
sasmodels/models/binary_hard_sphere.c
r87bc707 r3a48772 49 49 // /* do form factor calculations */ 50 50 51 v1 = 4.0*M_PI/3.0*r1*r1*r1;52 v2 = 4.0*M_PI/3.0*r2*r2*r2;51 v1 = M_4PI_3*r1*r1*r1; 52 v2 = M_4PI_3*r2*r2*r2; 53 53 54 54 n1 = phi1/v1; … … 70 70 sc1 = sph_j1c(qr1); 71 71 sc2 = sph_j1c(qr2); 72 b1 = r1*r1*r1*(rho1-rhos)* 4.0/3.0*M_PI*sc1;73 b2 = r2*r2*r2*(rho2-rhos)* 4.0/3.0*M_PI*sc2;72 b1 = r1*r1*r1*(rho1-rhos)*M_4PI_3*sc1; 73 b2 = r2*r2*r2*(rho2-rhos)*M_4PI_3*sc2; 74 74 inten = n1*b1*b1*psf11; 75 75 inten += sqrt(n1*n2)*2.0*b1*b2*psf12; -
sasmodels/models/capped_cylinder.c
r5bddd89 r3a48772 45 45 // translate dx in [-1,1] to dx in [lower,upper] 46 46 const double integral = total*zm; 47 const double cap_Fq = 2 *M_PI*cube(radius_cap)*integral;47 const double cap_Fq = 2.0*M_PI*cube(radius_cap)*integral; 48 48 return cap_Fq; 49 49 } … … 56 56 const double bj = sas_J1c(q*radius*sin_alpha); 57 57 const double si = sinc(q*half_length*cos_alpha); 58 const double cyl_Fq = 2. *M_PI*radius*radius*half_length*bj*si;58 const double cyl_Fq = 2.0*M_PI*radius*radius*half_length*bj*si; 59 59 const double Aq = cap_Fq + cyl_Fq; 60 60 return Aq; -
sasmodels/models/core_shell_parallelepiped.c
r2222134 r3a48772 89 89 double tb = (a_scaled+2.0*thick_rim_b)/length_b; 90 90 91 double arg1 = (0.5*mudum*a_scaled) * sin( 0.5*M_PI*uu);92 double arg2 = (0.5*mudum) * cos( 0.5*M_PI*uu);93 double arg3= (0.5*mudum*ta) * sin( 0.5*M_PI*uu);94 double arg4= (0.5*mudum*tb) * cos( 0.5*M_PI*uu);91 double arg1 = (0.5*mudum*a_scaled) * sin(M_PI_2*uu); 92 double arg2 = (0.5*mudum) * cos(M_PI_2*uu); 93 double arg3= (0.5*mudum*ta) * sin(M_PI_2*uu); 94 double arg4= (0.5*mudum*tb) * cos(M_PI_2*uu); 95 95 96 96 if(arg1==0.0){ -
sasmodels/models/core_shell_sphere.c
r2c74c11 r3a48772 16 16 double form_volume(double radius, double thickness) 17 17 { 18 return 4.0 * M_PI / 3.0 * pow((radius + thickness), 3);18 return M_4PI_3 * cube(radius + thickness); 19 19 } -
sasmodels/models/flexible_cylinder_elliptical.c
r87bc707 r3a48772 18 18 19 19 for(int i=0;i<N_POINTS_76;i++) { 20 double zi = ( Gauss76Z[i] + 1.0 )*M_PI /4.0;20 double zi = ( Gauss76Z[i] + 1.0 )*M_PI_4; 21 21 double sn, cn; 22 22 SINCOS(zi, sn, cn); -
sasmodels/models/fractal_core_shell.c
ra807206 r3a48772 13 13 double form_volume(double radius, double thickness) 14 14 { 15 return 4.0 * M_PI / 3.0 * pow((radius + thickness), 3);15 return M_4PI_3 * cube(radius + thickness); 16 16 } 17 17 -
sasmodels/models/fuzzy_sphere.py
r9a4811a r3a48772 86 86 # This should perhaps be volume normalized? 87 87 form_volume = """ 88 return 1.333333333333333*M_PI*radius*radius*radius;88 return M_4PI_3*cube(radius); 89 89 """ 90 90 -
sasmodels/models/hayter_msa.c
r0bef47b r3a48772 23 23 double SIdiam, diam, Kappa, cs, IonSt; 24 24 double Perm, Beta; 25 double pi,charge;25 double charge; 26 26 int ierr; 27 27 28 pi = M_PI;29 30 28 diam=2*radius_effective; //in A 31 29 … … 38 36 charge=zz*Elcharge; //in Coulomb (C) 39 37 SIdiam = diam*1.0E-10; //in m 40 Vp= 4.0*pi/3.0*(SIdiam/2.0)*(SIdiam/2.0)*(SIdiam/2.0); //in m^338 Vp=M_4PI_3*cube(SIdiam/2.0); //in m^3 41 39 cs=csalt*6.022E23*1.0E3; //# salt molecules/m^3 42 40 … … 50 48 Kappa=sqrt(2*Beta*IonSt/Perm); //Kappa calc from Ionic strength 51 49 // Kappa=2/SIdiam // Use to compare with HP paper 52 gMSAWave[5]=Beta*charge*charge/( pi*Perm*SIdiam*pow((2.0+Kappa*SIdiam),2));50 gMSAWave[5]=Beta*charge*charge/(M_PI*Perm*SIdiam*pow((2.0+Kappa*SIdiam),2)); 53 51 54 52 // Finally set up dimensionless parameters -
sasmodels/models/hollow_rectangular_prism.c
r87bc707 r3a48772 34 34 //Integration limits to use in Gaussian quadrature 35 35 double v1a = 0.0; 36 double v1b = 0.5 * M_PI; //theta integration limits36 double v1b = M_PI_2; //theta integration limits 37 37 double v2a = 0.0; 38 double v2b = 0.5 * M_PI; //phi integration limits38 double v2b = M_PI_2; //phi integration limits 39 39 40 40 //Order of integration … … 88 88 // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 89 89 // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 90 answer *= (2.0/M_PI);90 answer /= M_PI_2; 91 91 92 92 // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. -
sasmodels/models/hollow_rectangular_prism_thin_walls.c
r87bc707 r3a48772 26 26 //Integration limits to use in Gaussian quadrature 27 27 double v1a = 0.0; 28 double v1b = 0.5 * M_PI; //theta integration limits28 double v1b = M_PI_2; //theta integration limits 29 29 double v2a = 0.0; 30 double v2b = 0.5 * M_PI; //phi integration limits30 double v2b = M_PI_2; //phi integration limits 31 31 32 32 //Order of integration … … 71 71 // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 72 72 // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 73 answer *= (2.0/M_PI);73 answer /= M_PI_2; 74 74 75 75 // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. -
sasmodels/models/lib/core_shell.c
r7d4b2ae r3a48772 17 17 const double core_contrast = core_sld - shell_sld; 18 18 const double core_bes = sph_j1c(core_qr); 19 const double core_volume = 4.0 * M_PI / 3.0 * radius * radius * radius;19 const double core_volume = M_4PI_3 * cube(radius); 20 20 double f = core_volume * core_bes * core_contrast; 21 21 … … 24 24 const double shell_contrast = shell_sld - solvent_sld; 25 25 const double shell_bes = sph_j1c(shell_qr); 26 const double shell_volume = 4.0 * M_PI / 3.0 * pow((radius + thickness), 3);26 const double shell_volume = M_4PI_3 * cube(radius + thickness); 27 27 f += shell_volume * shell_bes * shell_contrast; 28 28 return f * f * 1.0e-4; -
sasmodels/models/lib/gfn.c
r177c1a1 r3a48772 12 12 { 13 13 // local variables 14 const double pi43=4.0/3.0*M_PI;15 14 const double aa = crmaj; 16 15 const double bb = crmin; … … 20 19 //const double siq = (uq == 0.0 ? 1.0 : 3.0*(sin(uq)/uq/uq - cos(uq)/uq)/uq); 21 20 const double siq = sph_j1c(uq); 22 const double vc = pi43*aa*aa*bb;21 const double vc = M_4PI_3*aa*aa*bb; 23 22 const double gfnc = siq*vc*delpc; 24 23 25 24 const double ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx)); 26 25 const double ut= sqrt(ut2)*qq; 27 const double vt = pi43*trmaj*trmaj*trmin;26 const double vt = M_4PI_3*trmaj*trmaj*trmin; 28 27 //const double sit = (ut == 0.0 ? 1.0 : 3.0*(sin(ut)/ut/ut - cos(ut)/ut)/ut); 29 28 const double sit = sph_j1c(ut); … … 33 32 const double result = tgfn*tgfn; 34 33 35 return (result);34 return result; 36 35 } -
sasmodels/models/linear_pearls.c
r2c74c11 r3a48772 19 19 { 20 20 // Pearl volume 21 double pearl_vol = 4.0 /3.0 * M_PI * pow(radius, 3.0);21 double pearl_vol = M_4PI_3 * cube(radius); 22 22 // Return total volume 23 23 return num_pearls * pearl_vol;; … … 35 35 double contrast_pearl = pearl_sld - solvent_sld; 36 36 //each volume 37 double pearl_vol = 4.0 /3.0 * M_PI * pow(radius, 3.0);37 double pearl_vol = M_4PI_3 * cube(radius); 38 38 //total volume 39 39 double tot_vol = num_pearls * pearl_vol; -
sasmodels/models/mass_fractal.c
ra807206 r3a48772 34 34 double form_volume(double radius){ 35 35 36 return 1.333333333333333*M_PI*radius*radius*radius;36 return M_4PI_3*radius*radius*radius; 37 37 } 38 38 -
sasmodels/models/mass_surface_fractal.c
r30fbe2e r3a48772 37 37 double form_volume(double radius){ 38 38 39 return 1.333333333333333*M_PI*radius*radius*radius;39 return M_4PI_3*radius*radius*radius; 40 40 } 41 41 -
sasmodels/models/multilayer_vesicle.c
r2c74c11 r3a48772 19 19 20 20 // layer 1 21 voli = 4.0*M_PI/3.0*ri*ri*ri;21 voli = M_4PI_3*ri*ri*ri; 22 22 fval += voli*sldi*sph_j1c(ri*q); 23 23 … … 25 25 26 26 // layer 2 27 voli = 4.0*M_PI/3.0*ri*ri*ri;27 voli = M_4PI_3*ri*ri*ri; 28 28 fval -= voli*sldi*sph_j1c(ri*q); 29 29 -
sasmodels/models/parallelepiped.c
ra807206 r3a48772 71 71 double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); 72 72 double mudum = mu * sqrt(1.0-sigma*sigma); 73 double arg1 = 0.5 * mudum * cos( 0.5*M_PI*uu);74 double arg2 = 0.5 * mudum * a_scaled * sin( 0.5*M_PI*uu);73 double arg1 = 0.5 * mudum * cos(M_PI_2*uu); 74 double arg2 = 0.5 * mudum * a_scaled * sin(M_PI_2*uu); 75 75 if(arg1==0.0) { 76 76 tmp1 = 1.0; -
sasmodels/models/pearl_necklace.c
ra807206 r3a48772 23 23 double num_strings = num_pearls - 1.0; 24 24 25 //Pi26 double pi = 4.0*atan(1.0);27 28 25 // center to center distance between the neighboring pearls 29 26 double A_s = edge_sep + 2.0 * radius; … … 36 33 37 34 // each volume 38 double string_vol = edge_sep * pi* thick_string * thick_string / 4.0;39 double pearl_vol = 4.0 / 3.0 * pi* radius * radius * radius;35 double string_vol = edge_sep * M_PI * thick_string * thick_string / 4.0; 36 double pearl_vol = M_4PI_3 * radius * radius * radius; 40 37 41 38 //total volume … … 110 107 double total_vol; 111 108 112 double pi = 4.0*atan(1.0);113 109 double number_of_strings = num_pearls - 1.0; 114 110 115 double string_vol = edge_sep * pi* thick_string * thick_string / 4.0;116 double pearl_vol = 4.0 / 3.0 * pi* radius * radius * radius;111 double string_vol = edge_sep * M_PI * thick_string * thick_string / 4.0; 112 double pearl_vol = M_4PI_3 * radius * radius * radius; 117 113 118 114 total_vol = number_of_strings * string_vol; -
sasmodels/models/rectangular_prism.c
r87bc707 r3a48772 75 75 // The factor 2 appears because the theta integral has been defined between 76 76 // 0 and pi/2, instead of 0 to pi. 77 answer *= (2.0/M_PI); //Form factor P(q)77 answer /= M_PI_2; //Form factor P(q) 78 78 79 79 // Multiply by contrast^2 and volume^2 -
sasmodels/models/sc_paracrystal.c
r0b717c5 r3a48772 55 55 56 56 double integrand = temp2*sc_eval(yy,xx,temp3,temp4,temp5); 57 integrand *= 2.0/M_PI;57 integrand /= M_PI_2; 58 58 59 59 return(integrand); … … 68 68 { 69 69 const double va = 0.0; 70 const double vb = M_PI /2.0; //orientation average, outer integral70 const double vb = M_PI_2; //orientation average, outer integral 71 71 72 72 double summ=0.0; -
sasmodels/models/star_polymer.c
r2c74c11 r3a48772 6 6 { 7 7 8 double u_2 = radius2 * pow(q,2);8 double u_2 = radius2 * q * q; 9 9 double v = u_2 * arms / (3.0 * arms - 2.0); 10 10 11 double term1 = v - 1.0 + exp(-v);12 double term2 = ((arms - 1.0)/2.0) * pow((1.0 - exp(-v)),2.0);11 double term1 = v + expm1(-v); 12 double term2 = ((arms - 1.0)/2.0) * square(expm1(-v)); 13 13 14 return (2.0 * (term1 + term2)) / (arms * pow(v,2.0));14 return (2.0 * (term1 + term2)) / (arms * v * v); 15 15 16 16 } -
sasmodels/models/triaxial_ellipsoid.c
r11ca2ab r3a48772 10 10 double form_volume(double radius_equat_minor, double radius_equat_major, double radius_polar) 11 11 { 12 return 1.333333333333333*M_PI*radius_equat_minor*radius_equat_major*radius_polar;12 return M_4PI_3*radius_equat_minor*radius_equat_major*radius_polar; 13 13 } 14 14 -
sasmodels/models/vesicle.c
r2c74c11 r3a48772 8 8 { 9 9 //note that for the vesicle model, the volume is ONLY the shell volume 10 double volume; 11 volume =4.*M_PI*(radius+thickness)*(radius+thickness)*(radius+thickness)/3; 12 volume -=4.*M_PI*radius*radius*radius/3.; 13 return volume; 10 return M_4PI_3*(cube(radius+thickness) - cube(radius)); 14 11 } 15 12 … … 32 29 // core first, then add in shell 33 30 contrast = sld_solvent-sld; 34 vol = 4.0*M_PI/3.0*radius*radius*radius;35 f = vol *sph_j1c(q*radius)*contrast;31 vol = M_4PI_3*cube(radius); 32 f = vol * sph_j1c(q*radius) * contrast; 36 33 37 34 //now the shell. No volume normalization as this is done by the caller 38 35 contrast = sld-sld_solvent; 39 vol = 4.0*M_PI/3.0*(radius+thickness)*(radius+thickness)*(radius+thickness);40 f += vol *sph_j1c(q*(radius+thickness))*contrast;36 vol = M_4PI_3*cube(radius+thickness); 37 f += vol * sph_j1c(q*(radius+thickness)) * contrast; 41 38 42 39 //rescale to [cm-1]. 43 f2 = volfraction *f*f*1.0e-4;40 f2 = volfraction * f*f*1.0e-4; 44 41 45 return (f2);42 return f2; 46 43 } -
sasmodels/models/vesicle.py
re77872e r3a48772 116 116 ''' 117 117 118 whole = 4. * pi * (radius + thickness) ** 3. / 3.119 core = 4. * pi * radius ** 3. / 3.118 whole = 4./3. * pi * (radius + thickness)**3 119 core = 4./3. * pi * radius**3 120 120 return whole, whole - core 121 121
Note: See TracChangeset
for help on using the changeset viewer.