Changeset 934f906 in sasmodels


Ignore:
Timestamp:
Mar 18, 2016 11:37:59 AM (9 years ago)
Author:
richardh
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:
292fe08
Parents:
aceac39
Message:

add precision dependent cutoff for low Q expansion in hardsphere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hardsphere.py

    re98c1e0 r934f906  
    7575Iq = """ 
    7676      double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 
     77      // these are c compiler instructions, can also put normal code inside the "if else" structure  
     78      #if FLOAT_SIZE > 4 
     79      // double precision    orig had 0.2, don't call the variable cutoff as PAK already has one called that! Must use UPPERCASE name please. 
     80      //  0.05 better, 0.1 OK 
     81      #define CUTOFFHS 0.05 
     82      #else 
     83      // 0.1 bad, 0.2 OK, 0.3 good, 0.4 better, 0.8 no good 
     84      #define CUTOFFHS 0.4   
     85      #endif 
    7786 
    7887      if(fabs(radius_effective) < 1.E-12) { 
     
    97106      G=0.5*volfraction*A; 
    98107 
    99       if(X < 0.2) { 
    100       // RKH Feb 2016, use Taylor series expansion for small X, IT IS VERY PICKY ABOUT THE X CUT OFF VALUE, ought to be lower in double.  
     108      if(X < CUTOFFHS) { 
     109      // RKH Feb 2016, use Taylor series expansion for small X 
    101110      // else no obvious way to rearrange the equations to avoid needing a very high number of significant figures.  
    102111      // Series expansion found using Mathematica software. Numerical test in .xls showed terms to X^2 are sufficient  
Note: See TracChangeset for help on using the changeset viewer.