Ignore:
Timestamp:
Feb 29, 2016 6: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/core_shell_ellipsoid_xt.c

    r81bb668 re7678b2  
    3030                   double x_polar_shell) 
    3131{ 
    32         double equat_shell, polar_shell; 
    33     equat_shell = equat_core + t_shell; 
    34     polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
     32    const double equat_shell = equat_core + t_shell; 
     33    const double polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
    3534    double vol = 4.0*M_PI/3.0*equat_shell*equat_shell*polar_shell; 
    3635    return vol; 
     
    4746          double solvent_sld) 
    4847{ 
    49         double delpc,delps; 
    50         double uplim,lolim;             //upper and lower integration limits 
    51         double summ,zi,yyy,answer; //running tally of integration 
    52         double polar_core, equat_shell, polar_shell; 
     48    const double lolim = 0.0; 
     49    const double uplim = 1.0; 
    5350 
    54         lolim = 0.0; 
    55         uplim = 1.0; 
     51    double summ = 0.0;   //initialize intergral 
    5652 
    57         summ = 0.0;      //initialize intergral 
    58  
    59         delpc = core_sld - shell_sld; //core - shell 
    60         delps = shell_sld - solvent_sld; //shell - solvent 
     53    const double delpc = core_sld - shell_sld; //core - shell 
     54    const double delps = shell_sld - solvent_sld; //shell - solvent 
    6155 
    6256 
    63     polar_core = equat_core*x_core; 
    64     equat_shell = equat_core + t_shell; 
    65     polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
     57    const double polar_core = equat_core*x_core; 
     58    const double equat_shell = equat_core + t_shell; 
     59    const double polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
    6660 
    67         for(int i=0;i<76;i++) { 
    68                 zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0; 
    69                 yyy = Gauss76Wt[i] * gfn4(zi, 
    70                                           equat_core, 
     61    for(int i=0;i<N_POINTS_76;i++) { 
     62        double zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0; 
     63        double yyy = Gauss76Wt[i] * gfn4(zi, 
     64                                  equat_core, 
    7165                                  polar_core, 
    7266                                  equat_shell, 
    7367                                  polar_shell, 
    74                                           delpc, 
    75                                           delps, 
    76                                           q); 
    77                 summ += yyy; 
    78         } 
     68                                  delpc, 
     69                                  delps, 
     70                                  q); 
     71        summ += yyy; 
     72    } 
    7973 
    80         answer = (uplim-lolim)/2.0*summ; 
     74    double answer = (uplim-lolim)/2.0*summ; 
     75    //convert to [cm-1] 
     76    answer *= 1.0e-4; 
    8177 
    82         //convert to [cm-1] 
    83         answer *= 1.0e-4; 
    84  
    85         return answer; 
     78    return answer; 
    8679} 
    8780 
     
    9891          double phi) 
    9992{ 
    100     double cyl_x, cyl_y; 
    101     double cos_val; 
    102     double answer; 
    103     double sldcs,sldss; 
    104         double polar_core, equat_shell, polar_shell; 
    105  
    10693    //convert angle degree to radian 
    107     theta = theta * M_PI/180.0; 
    108     phi = phi * M_PI/180.0; 
    109  
     94    theta = theta * M_PI_180; 
     95    phi = phi * M_PI_180; 
    11096 
    11197    // ellipsoid orientation, the axis of the rotation is consistent with the ploar axis. 
    112     cyl_x = cos(theta) * cos(phi); 
    113     cyl_y = sin(theta); 
     98    const double cyl_x = cos(theta) * cos(phi); 
     99    const double cyl_y = sin(theta); 
    114100 
    115     sldcs = core_sld - shell_sld; 
    116     sldss = shell_sld- solvent_sld; 
     101    const double sldcs = core_sld - shell_sld; 
     102    const double sldss = shell_sld- solvent_sld; 
    117103 
    118104    // Compute the angle btw vector q and the 
    119105    // axis of the cylinder 
    120     cos_val = cyl_x*q_x + cyl_y*q_y; 
     106    const double cos_val = cyl_x*q_x + cyl_y*q_y; 
    121107 
    122     polar_core = equat_core*x_core; 
    123     equat_shell = equat_core + t_shell; 
    124     polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
     108    const double polar_core = equat_core*x_core; 
     109    const double equat_shell = equat_core + t_shell; 
     110    const double polar_shell = equat_core*x_core + t_shell*x_polar_shell; 
    125111 
    126112    // Call the IGOR library function to get the kernel: 
    127113    // MUST use gfn4 not gf2 because of the def of params. 
    128     answer = gfn4(cos_val, 
     114    double answer = gfn4(cos_val, 
    129115                  equat_core, 
    130116                  polar_core, 
Note: See TracChangeset for help on using the changeset viewer.