Changeset 0da2a01 in sasmodels


Ignore:
Timestamp:
Jan 21, 2016 4:19:48 PM (9 years ago)
Author:
krzywon
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
7d256c8
Parents:
0420af7 (diff), 790bcc4c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master'

Location:
sasmodels/models
Files:
1 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoid.c

    r513efc5 r9c461c7  
    1010    const double u = q*requatorial*sqrt(1.0 
    1111                   + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
    12     const double f = J1c(u); 
     12    const double f = sph_j1c(u); 
    1313 
    1414    return f*f; 
  • sasmodels/models/ellipsoid.py

    r513efc5 r9c461c7  
    152152             ] 
    153153 
    154 source = ["lib/J1.c", "lib/J1c.c", "lib/gauss76.c", "ellipsoid.c"] 
     154source = ["lib/J1.c", "lib/sph_j1c.c", "lib/gauss76.c", "ellipsoid.c"] 
    155155 
    156156def ER(rpolar, requatorial): 
  • sasmodels/models/mass_fractal.c

    r5c1d341 r9c461c7  
    1717          double cutoff_length) 
    1818{ 
    19  
    20     //calculate P(q) for the spherical subunits; not normalized 
    21     //double pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2); 
    22     double pq = J1c(q*radius); 
    23  
    24     //pq = 1.0; 
     19    //calculate P(q) 
     20    double pq = sph_j1c(q*radius); 
     21    pq = pq*pq; 
    2522 
    2623    //calculate S(q) 
     
    3027    sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0)); 
    3128    sq /= q; 
    32  
    33     //sq = 1.0; 
    3429 
    3530    //combine and return 
  • sasmodels/models/mass_fractal.py

    r9eaadb3 r9c461c7  
    8080 
    8181#             ["name", "units", default, [lower, upper], "type","description"], 
    82 parameters = [["radius",        "Ang",  10.0, [0.0, inf], "", 
    83                "Particle radius"], 
    84               ["mass_dim",      "",      1.9, [1.0, 6.0],   "", 
    85                "Mass fractal dimension"], 
    86               ["cutoff_length", "Ang", 100.0, [0.0, inf], "", 
    87                "Cut-off length"], 
     82parameters = [["radius",        "Ang",  10.0, [0.0, inf], "", "Particle radius"], 
     83              ["mass_dim",      "",      1.9, [1.0, 6.0], "", "Mass fractal dimension"], 
     84              ["cutoff_length", "Ang", 100.0, [0.0, inf], "", "Cut-off length"], 
    8885              ] 
    8986 
    9087 
    91 source = ["lib/J1c.c", "lib/lanczos_gamma.c", "mass_fractal.c"] 
     88source = ["lib/sph_j1c.c", "lib/lanczos_gamma.c", "mass_fractal.c"] 
    9289 
    9390demo = dict(scale=1, background=0, 
     
    104101           'mass_dim':      3.3, 
    105102           'cutoff_length': 1.0, 
    106            }, 0.001, 2.68342996226], 
     103           }, 0.5, 1.29016774904], 
    107104 
    108105         [{'radius':        1.0, 
     
    116113           'cutoff_length': 1.0, 
    117114           'scale':        10.0, 
    118            }, 0.051, 11.6258202095], 
     115           }, 0.051, 11.6227966145], 
    119116         ] 
  • sasmodels/models/mass_surface_fractal.py

    r7ed702f r9c461c7  
    9191 
    9292 
    93 source = ["lib/J1c.c", "mass_surface_fractal.c"] 
     93source = ["mass_surface_fractal.c"] 
    9494 
    9595demo = dict(scale=1, background=0, 
  • sasmodels/models/sphere.py

    r513efc5 r9c461c7  
    7878             ] 
    7979 
    80 source = ["lib/J1c.c"] 
     80source = ["lib/sph_j1c.c"] 
    8181 
    8282# No volume normalization despite having a volume parameter 
     
    8888Iq = """ 
    8989    const double qr = q*radius; 
    90     const double bes = J1c(qr); 
     90    const double bes = sph_j1c(qr); 
    9191    const double fq = bes * (sld - solvent_sld) * form_volume(radius); 
    9292    return 1.0e-4*fq*fq; 
  • sasmodels/models/surface_fractal.c

    r5c1d341 r9c461c7  
    2121    //pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2); 
    2222 
    23     pq = J1c(q*radius); 
     23    pq = sph_j1c(q*radius); 
    2424    pq = pq*pq; 
    2525 
  • sasmodels/models/surface_fractal.py

    r5c1d341 r9c461c7  
    9090 
    9191 
    92 source = ["lib/J1c.c", "lib/lanczos_gamma.c", "surface_fractal.c"] 
     92source = ["lib/sph_j1c.c", "lib/lanczos_gamma.c", "surface_fractal.c"] 
    9393 
    9494demo = dict(scale=1, background=0, 
  • sasmodels/models/triaxial_ellipsoid.c

    r7ed702f r9c461c7  
    3636            const double y = 0.5*(Gauss76Z[j] + 1.0); 
    3737            const double t = q*sqrt(acosx2 + bsinx2*(1.0-y*y) + c2*y*y); 
    38             const double fq = J1c(t); 
     38            const double fq = sph_j1c(t); 
    3939            inner += Gauss76Wt[j] * fq * fq ; 
    4040        } 
  • sasmodels/models/triaxial_ellipsoid.py

    r513efc5 r9c461c7  
    117117             ] 
    118118 
    119 source = ["lib/J1.c", "lib/J1c.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 
     119source = ["lib/J1.c", "lib/sph_j1c.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 
    120120 
    121121def ER(req_minor, req_major, rpolar): 
  • sasmodels/models/hollow_cylinder.c

    r07e72e6 r0420af7  
    114114        double norm,volume;     //final calculation variables 
    115115         
     116        if (core_radius >= radius || radius >= length) { 
     117                return NAN; 
     118        } 
     119         
    116120        delrho = solvent_sld - sld; 
    117121        lower = 0.0; 
     
    132136} 
    133137 
    134 //FIXME: Factor of two difference 
    135138double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld, 
    136139        double solvent_sld, double theta, double phi) 
  • sasmodels/models/hollow_cylinder.py

    rd18f8a8 r0420af7  
    6464""" 
    6565 
    66 from numpy import inf 
     66from numpy import pi, inf 
    6767 
    6868name = "hollow_cylinder" 
     
    9292source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 
    9393 
     94def ER(radius, core_radius, length): 
     95    if radius == 0 or length == 0: 
     96        return 0.0 
     97    len1 = radius 
     98    len2 = length/2.0 
     99    term1 = len1*len1*2.0*len2/2.0 
     100    term2 = 1.0 + (len2/len1)*(1.0 + 1/len2/2.0)*(1.0 + pi*len1/len2/2.0) 
     101    ddd = 3.0*term1*term2 
     102    diam = pow(ddd, (1.0/3.0)) 
     103    return diam 
     104 
     105def VR(radius, core_radius, length): 
     106    vol_core = pi*core_radius*core_radius*length 
     107    vol_total = pi*radius*radius*length 
     108    vol_shell = vol_total - vol_core 
     109    return vol_shell, vol_total 
     110 
    94111# parameters for demo 
    95112demo = dict(scale=1.0,background=0.0,length=400.0,radius=30.0,core_radius=20.0, 
     
    97114            radius_pd=.2, radius_pd_n=9, 
    98115            length_pd=.2, length_pd_n=10, 
     116            core_radius_pd=.2, core_radius_pd_n=9, 
    99117            theta_pd=10, theta_pd_n=5, 
    100118            ) 
     
    109127# Parameters for unit tests 
    110128tests = [ 
    111          [{"radius" : 30.0},0.00005,1764.926] 
     129         [{"radius" : 30.0},0.00005,1764.926], 
     130         [{},'VR',1.8], 
     131         [{},0.001,1756.76] 
    112132         ] 
  • sasmodels/models/lib/Si.c

    rdcef2ee r0420af7  
    1 int factorial(int f); 
    21double Si(double x); 
    32 
    4 // integral of sin(x)/x: approximated to w/i 1% 
     3// integral of sin(x)/x Taylor series approximated to w/i 0.1% 
    54double Si(double x) 
    65{ 
    76        int i; 
    8         int nmax=6; 
     7        int nmax=10; 
    98        double out; 
    109        long power; 
     
    1615                out = pi/2.0; 
    1716 
    18                 for (i=0; i<nmax-2; i+=1) { 
    19                         out_cos += pow(-1.0, i) * (double)factorial(2*i) / pow(x, 2*i+1); 
    20                         out_sin += pow(-1.0, i) * (double)factorial(2*i+1) / pow(x, 2*i+2); 
    21                 } 
     17                // Explicitly writing factorial values triples the speed of the calculation 
     18                out_cos = 1/x - 2/pow(x,3) + 24/pow(x,5) - 720/pow(x,7) + 40320/pow(x,9); 
     19                out_sin = 1/x - 6/pow(x,4) + 120/pow(x,6) - 5040/pow(x,8) + 362880/pow(x,10); 
    2220 
    2321                out -= cos(x) * out_cos; 
     
    2624        } 
    2725 
    28         out = 0.0; 
     26        // Explicitly writing factorial values triples the speed of the calculation 
     27        out = x - pow(x, 3)/18 + pow(x,5)/600 - pow(x,7)/35280 + pow(x,9)/3265920; 
    2928 
    30         for (i=0; i<nmax; i+=1) { 
    31                 if (i==0) { 
    32                         out += x; 
    33                         continue; 
    34                 } 
    35  
    36                 power = pow(x,(2 * i + 1)); 
    37                 out += pow(-1.0, i) * power / ((2.0 * (double)i + 1.0) * (double)factorial(2 * i + 1)); 
    38  
    39                 //printf ("Si=%g %g %d\n", x, out, i); 
    40         } 
    41  
     29        //printf ("Si=%g %g\n", x, out); 
    4230        return out; 
    4331} 
    44  
    45 int factorial(int f) 
    46 { 
    47     if ( f == 0 )  
    48         return 1; 
    49     return(f * factorial(f - 1)); 
    50 } 
Note: See TracChangeset for help on using the changeset viewer.