Changeset deb7ee0 in sasmodels for sasmodels/models/parallelepiped.c


Ignore:
Timestamp:
Feb 26, 2016 2:15:38 AM (8 years ago)
Author:
gonzalezm
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:
44bd2be
Parents:
94bd809
Message:

Added four parallelepiped-like models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/parallelepiped.c

    rc5b7d07 rdeb7ee0  
    99    double argA,argB,argC,tmp1,tmp2,tmp3; 
    1010    //handle arg=0 separately, as sin(t)/t -> 1 as t->0 
    11     argA = a*ala/2.0; 
    12     argB = b*alb/2.0; 
    13     argC = c*alc/2.0; 
     11    argA = 0.5*a*ala; 
     12    argB = 0.5*b*alb; 
     13    argC = 0.5*c*alc; 
    1414    if(argA==0.0) { 
    1515        tmp1 = 1.0; 
     
    3131} 
    3232 
     33 
    3334double form_volume(double a_side, double b_side, double c_side) 
    3435{ 
    3536    return a_side * b_side * c_side; 
    3637} 
     38 
    3739 
    3840double Iq(double q, 
     
    4345    double c_side) 
    4446{ 
    45     double tmp1, tmp2, yyy; 
     47    double tmp1, tmp2; 
    4648     
    4749    double mu = q * b_side; 
     
    5052    double a_scaled = a_side / b_side; 
    5153    double c_scaled = c_side / b_side; 
    52      
    53     // outer integral (with 76 gauss points), integration limits = 0, 1 
     54         
     55    //Order of integration 
     56    int nordi=76;                                
     57    int nordj=76; 
     58 
     59    // outer integral (with nordi gauss points), integration limits = 0, 1 
    5460    double summ = 0; //initialize integral 
    5561 
    56     for( int i=0; i<76; i++) { 
     62    for( int i=0; i<nordi; i++) { 
    5763                 
    58         // inner integral (with 76 gauss points), integration limits = 0, 1 
     64        // inner integral (with nordj gauss points), integration limits = 0, 1 
    5965         
    6066        double summj = 0.0; 
    61         double sigma = 0.5 * ( Gauss76Z[i] + 1.0 );              
     67            double sigma = 0.5 * ( Gauss76Z[i] + 1.0 );          
    6268                 
    63         for(int j=0; j<76; j++) { 
     69            for(int j=0; j<nordj; j++) { 
    6470 
    6571            double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); 
    6672            double mudum = mu * sqrt(1.0-sigma*sigma); 
    67             double arg1 = 0.5 * mudum * cos(0.5*M_PI*uu); 
    68             double arg2 = 0.5 * mudum * a_scaled * sin(0.5*M_PI*uu); 
     73                double arg1 = 0.5 * mudum * cos(0.5*M_PI*uu); 
     74                double arg2 = 0.5 * mudum * a_scaled * sin(0.5*M_PI*uu); 
    6975            if(arg1==0.0) { 
    7076                tmp1 = 1.0; 
     
    7783                tmp2 = sin(arg2)*sin(arg2)/arg2/arg2; 
    7884            } 
    79             yyy = Gauss76Wt[j] * tmp1 * tmp2; 
    8085 
    81             summj += yyy; 
     86            summj += Gauss76Wt[j] * tmp1 * tmp2; 
    8287        } 
    8388                 
     
    9297        } 
    9398                 
    94         // sum of outer integral 
    95         yyy = Gauss76Wt[i] * answer; 
    96         summ += yyy; 
     99            // sum of outer integral 
     100        summ += Gauss76Wt[i] * answer; 
    97101         
    98102    }    
    99103    
    100104    const double vd = (sld-solvent_sld) * form_volume(a_side, b_side, c_side); 
     105     
     106    // convert from [1e-12 A-1] to [cm-1] and 0.5 factor for outer integral 
    101107    return 1.0e-4 * 0.5 * vd * vd * summ; 
    102108     
Note: See TracChangeset for help on using the changeset viewer.