Ignore:
Timestamp:
Feb 29, 2016 8:21:55 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:
73860b6
Parents:
deac08c
Message:

Code review from PAK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/flexible_cylinder_ex.c

    r504abee re7678b2  
    1717elliptical_crosssection(double q, double a, double b) 
    1818{ 
    19     double uplim,lolim,Pi,summ,arg,zi,yyy,answer; 
    20     int i,nord=76; 
     19    double summ=0.0; 
    2120 
    22     Pi = 4.0*atan(1.0); 
    23     lolim=0.0; 
    24     uplim=Pi/2.0; 
    25     summ=0.0; 
     21    for(int i=0;i<N_POINTS_76;i++) { 
     22        double zi = ( Gauss76Z[i] + 1.0 )*M_PI/4.0; 
     23        double sn, cn; 
     24        SINCOS(zi, sn, cn); 
     25        double arg = q*sqrt(a*a*sn*sn+b*b*cn*cn); 
     26        double yyy = pow((double)J1c(arg),2); 
     27        yyy *= Gauss76Wt[i]; 
     28        summ += yyy; 
     29    } 
    2630 
    27     for(i=0;i<nord;i++) { 
    28                 zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0; 
    29                 arg = q*sqrt(a*a*sin(zi)*sin(zi)+b*b*cos(zi)*cos(zi)); 
    30                 yyy = pow((2.0 * J1(arg) / arg),2); 
    31                 yyy *= Gauss76Wt[i]; 
    32                 summ += yyy; 
    33     } 
    34     answer = (uplim-lolim)/2.0*summ; 
    35     answer *= 2.0/Pi; 
    36     return(answer); 
     31    summ /= 2.0; 
     32    return(summ); 
    3733 
    3834} 
     
    4743{ 
    4844 
    49         double Pi,flex,crossSect, cont; 
     45    double flex,crossSect, cont; 
    5046 
    51         Pi = 4.0*atan(1.0); 
    52         cont = sld - solvent_sld; 
    53         crossSect = elliptical_crosssection(q,radius,(radius*axis_ratio)); 
     47    cont = sld - solvent_sld; 
     48    crossSect = elliptical_crosssection(q,radius,(radius*axis_ratio)); 
    5449 
    55         flex = Sk_WR(q,length,kuhn_length); 
    56         flex *= crossSect; 
    57         flex *= Pi*radius*radius*axis_ratio*axis_ratio*length; 
    58         flex *= cont*cont; 
    59         flex *= 1.0e-4; 
     50    flex = Sk_WR(q,length,kuhn_length); 
     51    flex *= crossSect; 
     52    flex *= M_PI*radius*radius*axis_ratio*axis_ratio*length; 
     53    flex *= cont*cont; 
     54    flex *= 1.0e-4; 
    6055 
    61         return flex; 
     56    return flex; 
    6257} 
    6358 
     
    7166{ 
    7267 
    73         double result = flexible_cylinder_ex_kernel(q, 
    74                         length, 
    75                         kuhn_length, 
    76                         radius, 
    77                         axis_ratio, 
    78                         sld, 
    79                         solvent_sld); 
     68    double result = flexible_cylinder_ex_kernel(q, 
     69                    length, 
     70                    kuhn_length, 
     71                    radius, 
     72                    axis_ratio, 
     73                    sld, 
     74                    solvent_sld); 
    8075 
    81         return result; 
     76    return result; 
    8277} 
    8378 
     
    9085            double solvent_sld) 
    9186{ 
    92         double q; 
    93         q = sqrt(qx*qx+qy*qy); 
    94         double result = flexible_cylinder_ex_kernel(q, 
    95                         length, 
    96                         kuhn_length, 
    97                         radius, 
    98                         axis_ratio, 
    99                         sld, 
    100                         solvent_sld); 
     87    double q; 
     88    q = sqrt(qx*qx+qy*qy); 
     89    double result = flexible_cylinder_ex_kernel(q, 
     90                    length, 
     91                    kuhn_length, 
     92                    radius, 
     93                    axis_ratio, 
     94                    sld, 
     95                    solvent_sld); 
    10196 
    102         return result; 
     97    return result; 
    10398} 
Note: See TracChangeset for help on using the changeset viewer.