Changeset 5c1d341 in sasmodels


Ignore:
Timestamp:
Jan 20, 2016 9:38:35 AM (8 years ago)
Author:
piotr
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:
9eaadb3
Parents:
7ed702f
Message:

Converted MassFractalModel?
Refactored lanczos_gamma (gamln) out

Location:
sasmodels/models
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/surface_fractal.c

    r513efc5 r5c1d341  
    1010            double surface_dim, 
    1111            double cutoff_length); 
    12  
    13 static double _gamln(double q) 
    14 { 
    15     // Lanczos approximation to the Gamma function. 
    16     // Should be refactored out to lib/, if used elsewhere. 
    17     double x,y,tmp,ser; 
    18     double coeff[6]= 
    19         {76.18009172947146,     -86.50532032941677, 
    20          24.01409824083091,     -1.231739572450155, 
    21           0.1208650973866179e-2,-0.5395239384953e-5}; 
    22     int j; 
    23  
    24     y=x=q; 
    25     tmp  = x+5.5; 
    26     tmp -= (x+0.5)*log(tmp); 
    27     ser  = 1.000000000190015; 
    28     for (j=0; j<=5; j++) { 
    29         y+=1.0; 
    30         ser += coeff[j]/y; 
    31     } 
    32     return -tmp+log(2.5066282746310005*ser/x); 
    33 } 
    3412 
    3513static double _surface_fractal_kernel(double q, 
     
    4826    //calculate S(q) 
    4927    mmo = 5.0 - surface_dim; 
    50     sq  = exp(_gamln(mmo))*sin(-(mmo)*atan(q*cutoff_length)); 
     28    sq  = exp(lanczos_gamma(mmo))*sin(-(mmo)*atan(q*cutoff_length)); 
    5129    sq *= pow(cutoff_length, mmo); 
    5230    sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0)); 
  • sasmodels/models/surface_fractal.py

    r513efc5 r5c1d341  
    9090 
    9191 
    92 source = ["lib/J1c.c", "surface_fractal.c"] 
     92source = ["lib/J1c.c", "lib/lanczos_gamma.c", "surface_fractal.c"] 
    9393 
    9494demo = dict(scale=1, background=0, 
Note: See TracChangeset for help on using the changeset viewer.