Changeset 3c97ff0 in sasmodels


Ignore:
Timestamp:
Jan 6, 2016 9:23:47 PM (8 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:
3f832f9
Parents:
74667d3
Message:

code tidying

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/barbell.c

    rc138211 r3c97ff0  
    11double form_volume(double bell_radius, double radius, double length); 
    2 double Iq(double q, double sld, double solvent_sld, double bell_radius, double radius, double length); 
     2double Iq(double q, double sld, double solvent_sld, 
     3        double bell_radius, double radius, double length); 
    34double Iqxy(double qx, double qy, double sld, double solvent_sld, 
    4     double bell_radius, double radius, double length, double theta, double phi); 
     5        double bell_radius, double radius, double length, 
     6        double theta, double phi); 
    57 
    68//barbell kernel - same as dumbell 
    79double _bell_kernel(double q, double h, double bell_radius, 
    8     double length, double sin_alpha, double cos_alpha); 
     10        double length, double sin_alpha, double cos_alpha); 
    911double _bell_kernel(double q, double h, double bell_radius, 
    10     double length, double sin_alpha, double cos_alpha) 
     12        double length, double sin_alpha, double cos_alpha) 
    1113{ 
    1214    const double upper = 1.0; 
     
    1618    for (int i = 0; i < 76; i++){ 
    1719        const double t = 0.5*(Gauss76Z[i]*(upper-lower)+upper+lower); 
    18             const double arg1 = q*cos_alpha*(bell_radius*t+h+length*0.5); 
    19             const double arg2 = q*bell_radius*sin_alpha*sqrt(1.0-t*t); 
    20  
     20        const double arg1 = q*cos_alpha*(bell_radius*t+h+length*0.5); 
     21        const double arg2 = q*bell_radius*sin_alpha*sqrt(1.0-t*t); 
    2122        const double be = (arg2 == 0.0 ? 0.5 :J1(arg2)/arg2); 
    22  
    23             const double Fq = cos(arg1)*(1.0-t*t)*be; 
    24  
    25             total += Gauss76Wt[i] * Fq; 
     23        const double Fq = cos(arg1)*(1.0-t*t)*be; 
     24        total += Gauss76Wt[i] * Fq; 
    2625    } 
    2726    const double integral = 0.5*(upper-lower)*total; 
     
    4443 
    4544double Iq(double q, double sld, 
    46     double solvent_sld, 
    47     double bell_radius, 
    48     double radius, 
    49     double length) 
     45        double solvent_sld, 
     46        double bell_radius, 
     47        double radius, 
     48        double length) 
    5049{ 
    5150    double sn, cn; // slots to hold sincos function output 
     
    8483 
    8584double Iqxy(double qx, double qy, 
    86     double sld, 
    87     double solvent_sld, 
    88     double bell_radius, 
    89     double radius, 
    90     double length, 
    91     double theta, 
    92     double phi) 
     85        double sld, 
     86        double solvent_sld, 
     87        double bell_radius, 
     88        double radius, 
     89        double length, 
     90        double theta, 
     91        double phi) 
    9392{ 
    9493     double sn, cn; // slots to hold sincos function output 
  • sasmodels/models/cylinder.c

    ref2861b r3c97ff0  
    3333        // translate a point in [-1,1] to a point in [lower,upper] 
    3434        //const double alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0; 
    35         const double alpha = 0.5*(Gauss76Z[i]*M_PI_2 + M_PI_2); 
     35        const double alpha = M_PI_4*(Gauss76Z[i] + 1.0); 
    3636        double sn, cn; 
    3737        SINCOS(alpha, sn, cn); 
    3838        // For a bit of efficiency, we are moving the 2 V delta rho constant 
    39         // factor, 2Vd, out of the loop, so this is fq/2Vd rather than fq. 
     39        // factor, 2Vdrho, out of the loop, so this is fq/2Vdrho rather than fq. 
    4040        const double fq = _cyl(qr*sn, qh*cn); 
    4141        total += Gauss76Wt[i] * fq * fq * sn; 
     
    4343    // translate dx in [-1,1] to dx in [lower,upper] 
    4444    //const double form = (upper-lower)/2.0*total; 
    45     const double twovd = 2.0*(sld-solvent_sld)*form_volume(radius, length); 
    46     return 1.0e-4 * twovd * twovd * total * M_PI_4; 
     45    const double twoVdrho = 2.0*(sld-solvent_sld)*form_volume(radius, length); 
     46    return 1.0e-4 * twoVdrho * twoVdrho * total * M_PI_4; 
    4747} 
    4848 
Note: See TracChangeset for help on using the changeset viewer.