Ignore:
Timestamp:
Aug 31, 2009 5:25:44 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
5be36bb
Parents:
572beba
Message:

calculation of the effective radius are added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/coreshellsphere.cpp

    r0f5bc9f r5eb9154  
    2828extern "C" { 
    2929        #include "libSphere.h" 
     30        #include "core_shell.h" 
    3031} 
    3132 
     
    113114        return (*this).operator()(q); 
    114115} 
     116/** 
     117 * Function to calculate effective radius 
     118 * @param pars: parameters of the sphere 
     119 * @return: effective radius value 
     120 */ 
     121double CoreShellModel :: calculate_ER() { 
     122        CoreShellParameters dp; 
     123 
     124        dp.radius     = radius(); 
     125        dp.thickness  = thickness(); 
     126 
     127        double rad_out = 0.0; 
     128 
     129        // Perform the computation, with all weight points 
     130        double sum = 0.0; 
     131        double norm = 0.0; 
     132 
     133 
     134        // Get the dispersion points for the major shell 
     135        vector<WeightPoint> weights_thickness; 
     136        thickness.get_weights(weights_thickness); 
     137 
     138        // Get the dispersion points for the minor shell 
     139        vector<WeightPoint> weights_radius ; 
     140        radius.get_weights(weights_radius); 
     141 
     142        // Loop over major shell weight points 
     143        for(int j=0; j< (int)weights_thickness.size(); j++) { 
     144                dp.thickness = weights_thickness[j].value; 
     145                for(int k=0; k< (int)weights_radius.size(); k++) { 
     146                        dp.radius = weights_radius[k].value; 
     147                        sum += weights_thickness[j].weight 
     148                                * weights_radius[k].weight*(dp.radius+dp.thickness); 
     149                        norm += weights_thickness[j].weight* weights_radius[k].weight; 
     150                } 
     151        } 
     152        if (norm != 0){ 
     153                //return the averaged value 
     154                rad_out =  sum/norm;} 
     155        else{ 
     156                //return normal value 
     157                rad_out = (dp.radius+dp.thickness);} 
     158 
     159        return rad_out; 
     160} 
Note: See TracChangeset for help on using the changeset viewer.