Changeset 4962519 in sasmodels
- Timestamp:
- Oct 14, 2016 6:49:58 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:
- 14838a3
- Parents:
- a5b6997
- Location:
- sasmodels/models
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/bcc_paracrystal.c
r0b717c5 r4962519 33 33 34 34 const double temp10 = exp((-1.0/8.0)*temp1*(temp7*temp7 + temp8*temp8 + temp9*temp9)); 35 result = pow(1.0-(temp10*temp10),3)*temp635 result = cube(1.0 - (temp10*temp10))*temp6 36 36 / ( (1.0 - 2.0*temp10*cos(0.5*temp3*temp7) + temp10*temp10) 37 37 * (1.0 - 2.0*temp10*cos(0.5*temp3*temp8) + temp10*temp10) -
sasmodels/models/core_shell_sphere.py
r9a4811a r4962519 95 95 """ 96 96 return (1, 1) 97 whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3)98 core = 4.0 * pi / 3.0 * radius * radius * radius97 whole = 4.0/3.0 * pi * (radius + thickness)**3 98 core = 4.0/3.0 * pi * radius**3 99 99 return whole, whole - core 100 100 -
sasmodels/models/dab.py
ra807206 r4962519 59 59 60 60 Iq = """ 61 double numerator = pow(cor_length, 3);62 double denominator = pow(1 + pow(q*cor_length,2), 2);61 double numerator = cube(cor_length); 62 double denominator = square(1 + square(q*cor_length)); 63 63 64 64 return numerator / denominator ; -
sasmodels/models/fcc_paracrystal.c
r0b717c5 r4962519 32 32 33 33 const double temp10 = exp((-1.0/8.0)*temp1*((temp7*temp7)+(temp8*temp8)+(temp9*temp9))); 34 result = pow((1.0-(temp10*temp10)),3)*temp634 result = cube(1.0-(temp10*temp10))*temp6 35 35 / ( (1.0 - 2.0*temp10*cos(0.5*temp3*temp7) + temp10*temp10) 36 36 * (1.0 - 2.0*temp10*cos(0.5*temp3*temp8) + temp10*temp10) -
sasmodels/models/flexible_cylinder_elliptical.c
r3a48772 r4962519 21 21 double sn, cn; 22 22 SINCOS(zi, sn, cn); 23 double arg = q*sqrt(a*a*sn*sn+b*b*cn*cn); 24 double yyy = pow((double)sas_J1c(arg),2); 25 yyy *= Gauss76Wt[i]; 26 summ += yyy; 23 double arg = q*sqrt(a*a*sn*sn + b*b*cn*cn); 24 double yyy = sas_J1c(arg); 25 summ += Gauss76Wt[i] * yyy * yyy; 27 26 } 28 27 -
sasmodels/models/fractal_core_shell.py
ra807206 r4962519 100 100 @param thickness: shell thickness 101 101 """ 102 whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3)103 core = 4.0 * pi / 3.0 * radius * radius * radius102 whole = 4.0/3.0 * pi * (radius + thickness)**3 103 core = 4.0/3.0 * pi * radius**3 104 104 return whole, whole-core 105 105 -
sasmodels/models/hayter_msa.c
r3a48772 r4962519 48 48 Kappa=sqrt(2*Beta*IonSt/Perm); //Kappa calc from Ionic strength 49 49 // Kappa=2/SIdiam // Use to compare with HP paper 50 gMSAWave[5]=Beta*charge*charge/(M_PI*Perm*SIdiam* pow((2.0+Kappa*SIdiam),2));50 gMSAWave[5]=Beta*charge*charge/(M_PI*Perm*SIdiam*square(2.0+Kappa*SIdiam)); 51 51 52 52 // Finally set up dimensionless parameters -
sasmodels/models/lamellar_stack_paracrystal.c
r0bef47b r4962519 67 67 double Snq; 68 68 69 Snq = an/( (double)Nlayers* pow((1.0+ww*ww-2.0*ww*cos(qval*davg)),2) );69 Snq = an/( (double)Nlayers*square(1.0+ww*ww-2.0*ww*cos(qval*davg)) ); 70 70 71 71 return(Snq); -
sasmodels/models/lib/wrc_cyl.c
rba32cdd r4962519 14 14 //return t; 15 15 16 return pow( (1.0 + (x/3.12)*(x/3.12) + 17 (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) ); 16 return pow(1.0+square(x/3.12)+cube(x/8.67), 0.176/3.0); 18 17 } 19 18 … … 23 22 { 24 23 const double r = b/L; 25 return (L*b/6.0) * 26 (1.0 - r*1.5 + 1.5*r*r - 0.75*r*r*r*(1.0 - exp(-2.0/r))); 24 return (L*b/6.0) * (1.0 - r*(1.5 + r*(1.5 + r*0.75*expm1(-2.0/r)))); 27 25 } 28 26 … … 41 39 } 42 40 43 static inlinedouble41 static double 44 42 sech_WR(double x) 45 43 { … … 51 49 { 52 50 double C; 53 const double onehalf = 1.0/2.0;54 51 55 52 if( L/b > 10.0) { … … 86 83 87 84 const double t2 = (2.0*b4*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + 88 Rg02/b2))*((1.0 + onehalf*(((-1.0) -85 Rg02/b2))*((1.0 + 0.5*(((-1.0) - 89 86 tanh((-C4 + Rgb/C5))))))); 90 87 … … 112 109 113 110 const double t9 = (2.0*b4*(((2.0*q0*Rg2)/b - 114 (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*Rg2)/b))*((1.0 + onehalf*(((-1.0) -111 (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*Rg2)/b))*((1.0 + 0.5*(((-1.0) - 115 112 tanh(((-C4) + Rgb)/C5)))))); 116 113 117 114 const double t10 = (8.0*b4*b*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + 118 Rg02/b2))*((1.0 + onehalf*(((-1.0) - tanh(((-C4) +115 Rg02/b2))*((1.0 + 0.5*(((-1.0) - tanh(((-C4) + 119 116 Rgb)/C5)))))); 120 117 … … 131 128 132 129 const double t14 = (2.0*b4*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + 133 Rg02/b2))*((1.0 + onehalf*(((-1.0) - tanh(((-C4) +130 Rg02/b2))*((1.0 + 0.5*(((-1.0) - tanh(((-C4) + 134 131 Rgb)/C5)))))); 135 132 … … 140 137 141 138 double yy = (pow(q0,p1)*(((-((b*M_PI)/(L*q0))) +t1/L +t2/(q04*Rg22) + 142 onehalf*t3*t4)) + (t5*((pow(q0,(p1 - p2))*139 0.5*t3*t4)) + (t5*((pow(q0,(p1 - p2))* 143 140 (((-pow(q0,(-p1)))*(((b2*M_PI)/(L*q02) +t6/L +t7/(2.0*C5) - 144 t8/(C5*q04*Rg22) + t9/(q04*Rg22) -t10/(q05*Rg22) + onehalf*t11*t12)) -141 t8/(C5*q04*Rg22) + t9/(q04*Rg22) -t10/(q05*Rg22) + 0.5*t11*t12)) - 145 142 b*p1*pow(q0,((-1.0) - p1))*(((-((b*M_PI)/(L*q0))) + t13/L + 146 t14/(q04*Rg22) + onehalf*t15*((1.0 + tanh(((-C4) +143 t14/(q04*Rg22) + 0.5*t15*((1.0 + tanh(((-C4) + 147 144 Rgb)/C5))))))))))); 148 145 … … 154 151 { 155 152 double C; 156 const double onehalf = 1.0/2.0;157 153 158 154 if( L/b > 10.0) { … … 201 197 const double t5 = (2.0*b4*(((2.0*q0*Rg2)/b - 202 198 (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*Rg2)/b))* 203 ((1.0 + onehalf*(((-1.0) - tanh(((-C4) +199 ((1.0 + 0.5*(((-1.0) - tanh(((-C4) + 204 200 Rgb)/C5))))))/(q04*Rg22); 205 201 206 202 const double t6 = (8.0*b4*b*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + 207 Rg02/b2))*((1.0 + onehalf*(((-1) - tanh(((-C4) +203 Rg02/b2))*((1.0 + 0.5*(((-1) - tanh(((-C4) + 208 204 Rgb)/C5))))))/(q05*Rg22); 209 205 … … 219 215 220 216 const double t10 = (2.0*b4*(((-1) + pow((double)M_E,(-(Rg02/b2))) + 221 Rg02/b2))*((1.0 + onehalf*(((-1) - tanh(((-C4) +217 Rg02/b2))*((1.0 + 0.5*(((-1) - tanh(((-C4) + 222 218 Rgb)/C5))))))/(q04*Rg22); 223 219 224 220 const double yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*M_PI)/(L*q02) + 225 t2 + t3 - t4 + t5 - t6 + onehalf*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*221 t2 + t3 - t4 + t5 - t6 + 0.5*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))* 226 222 (((-((b*M_PI)/(L*q0))) + t9 + t10 + 227 onehalf*((C3*pow(((Rgb)),((-3.0)/miu)) +223 0.5*((C3*pow(((Rgb)),((-3.0)/miu)) + 228 224 C2*pow(((Rgb)),((-2.0)/miu)) + 229 225 C1*pow(((Rgb)),((-1.0)/miu))))* -
sasmodels/models/linear_pearls.c
r3a48772 r4962519 43 43 double separation = edge_sep + 2.0 * radius; 44 44 45 double x=q*radius;46 47 // Try Taylor on x*xos(x)48 // double out_cos = x - pow(x,3)/2 + pow(x,5)/24 - pow(x,7)/720 + pow(x,9)/40320;49 // psi -= x*out_cos;50 51 45 //sine functions of a pearl 52 double psi = sin(q * radius); 53 psi -= x * cos(x); 54 psi /= pow((q * radius), 3.0); 46 double psi = sph_j1c(q * radius); 55 47 56 48 // N pearls contribution … … 61 53 } 62 54 // form factor for num_pearls 63 double form_factor = n_contrib; 64 form_factor *= pow((m_s*psi*3.0), 2.0); 65 form_factor /= (tot_vol * 1.0e4); 55 double form_factor = 1.0e-4 * n_contrib * square(m_s*psi) / tot_vol; 66 56 67 57 return form_factor; -
sasmodels/models/linear_pearls.py
r40a87fa r4962519 63 63 single = False 64 64 65 source = ["li near_pearls.c"]65 source = ["lib/sph_j1c.c", "linear_pearls.c"] 66 66 67 67 demo = dict(scale=1.0, background=0.0, -
sasmodels/models/pearl_necklace.py
ra807206 r4962519 112 112 """ 113 113 tot_vol = volume(radius, edge_sep, thick_string, num_pearls) 114 rad_out = pow((3.0*tot_vol/4.0/pi), 0.33333)114 rad_out = (tot_vol/(4.0/3.0*pi)) ** (1./3.) 115 115 return rad_out 116 116 -
sasmodels/models/porod.py
r40a87fa r4962519 41 41 """ 42 42 with errstate(divide='ignore'): 43 return power(q, -4)43 return q**-4 44 44 45 45 Iq.vectorized = True # Iq accepts an array of q values -
sasmodels/models/sc_paracrystal.c
r3a48772 r4962519 49 49 double da = d_factor*dnn; 50 50 double temp1 = qq*qq*da*da; 51 double temp2 = pow( 1.0-exp(-1.0*temp1) ,3);51 double temp2 = cube(-expm1(-temp1)); 52 52 double temp3 = qq*dnn; 53 53 double temp4 = 2.0*exp(-0.5*temp1); 54 54 double temp5 = exp(-1.0*temp1); 55 55 56 double integrand = temp2*sc_eval(yy,xx,temp3,temp4,temp5); 57 integrand /= M_PI_2; 56 double integrand = temp2*sc_eval(yy,xx,temp3,temp4,temp5)/M_PI_2; 58 57 59 58 return(integrand); -
sasmodels/models/teubner_strey.py
rb3f2a24 r4962519 71 71 72 72 import numpy as np 73 from numpy import inf, power,pi73 from numpy import inf, pi 74 74 75 75 name = "teubner_strey" … … 93 93 drho2 = (sld-sld_solvent)*(sld-sld_solvent) 94 94 k = 2.0*pi*xi/d 95 a2 = power(1.0+power(k,2.0),2.0)96 c1 = -2.0*xi*xi*power(k,2.0)+2*xi*xi97 c2 = power(xi,4.0)95 a2 = (1.0 + k**2)**2 96 c1 = 2.0*xi**2 * (1.0 - k**2) 97 c2 = xi**4 98 98 prefactor = 8.0*pi*volfraction*(1.0-volfraction)*drho2*c2/xi 99 99 #k2 = (2.0*pi/d)*(2.0*pi/d)
Note: See TracChangeset
for help on using the changeset viewer.