Changeset 177c1a1 in sasmodels


Ignore:
Timestamp:
Feb 4, 2016 10:17:50 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
3a45c2c
Parents:
eeb8bac
Message:

switch to sph_j1c in core_shell_ellipsoid

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_ellipsoid.py

    r13ed84c r177c1a1  
    112112# pylint: enable=bad-whitespace, line-too-long 
    113113 
    114 source = ["lib/gfn.c", "lib/gauss76.c", "core_shell_ellipsoid.c"] 
     114source = ["lib/sph_j1c.c", "lib/gfn.c", "lib/gauss76.c", "core_shell_ellipsoid.c"] 
    115115 
    116116demo = dict(scale=1, background=0.001, 
  • sasmodels/models/lib/gfn.c

    r13ed84c r177c1a1  
    66//       <OBLATE ELLIPSOID> 
    77// function gfn4 for oblate ellipsoids 
    8 static double 
     8double 
     9gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq); 
     10double 
    911gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq) 
    1012{ 
    11         // local variables 
    12         double aa,bb,u2,ut2,uq,ut,vc,vt,siq,sit,gfnc,gfnt,tgfn,gfn4,pi43,Pi; 
     13    // local variables 
     14    const double pi43=4.0/3.0*M_PI; 
     15    const double aa = crmaj; 
     16    const double bb = crmin; 
     17    const double u2 = (bb*bb*xx*xx + aa*aa*(1.0-xx*xx)); 
     18    const double uq = sqrt(u2)*qq; 
     19    // changing to more accurate sph_j1c since the following inexplicably fails on Radeon Nano. 
     20    //const double siq = (uq == 0.0 ? 1.0 : 3.0*(sin(uq)/uq/uq - cos(uq)/uq)/uq); 
     21    const double siq = sph_j1c(uq); 
     22    const double vc = pi43*aa*aa*bb; 
     23    const double gfnc = siq*vc*delpc; 
    1324 
    14         Pi = 4.0*atan(1.0); 
    15         pi43=4.0/3.0*Pi; 
    16         aa = crmaj; 
    17         bb = crmin; 
    18         u2 = (bb*bb*xx*xx + aa*aa*(1.0-xx*xx)); 
    19         ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx)); 
    20         uq = sqrt(u2)*qq; 
    21         ut= sqrt(ut2)*qq; 
    22         vc = pi43*aa*aa*bb; 
    23         vt = pi43*trmaj*trmaj*trmin; 
    24         if (uq == 0.0){ 
    25                 siq = 1.0/3.0; 
    26         }else{ 
    27                 siq = (sin(uq)/uq/uq - cos(uq)/uq)/uq; 
    28         } 
    29         if (ut == 0.0){ 
    30                 sit = 1.0/3.0; 
    31         }else{ 
    32                 sit = (sin(ut)/ut/ut - cos(ut)/ut)/ut; 
    33         } 
    34         gfnc = 3.0*siq*vc*delpc; 
    35         gfnt = 3.0*sit*vt*delps; 
    36         tgfn = gfnc+gfnt; 
    37         gfn4 = tgfn*tgfn; 
     25    const double ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx)); 
     26    const double ut= sqrt(ut2)*qq; 
     27    const double vt = pi43*trmaj*trmaj*trmin; 
     28    //const double sit = (ut == 0.0 ? 1.0 : 3.0*(sin(ut)/ut/ut - cos(ut)/ut)/ut); 
     29    const double sit = sph_j1c(ut); 
     30    const double gfnt = sit*vt*delps; 
    3831 
    39         return (gfn4); 
     32    const double tgfn = gfnc + gfnt; 
     33    const double result = tgfn*tgfn; 
     34 
     35    return (result); 
    4036} 
Note: See TracChangeset for help on using the changeset viewer.