Ignore:
Timestamp:
Aug 31, 2009 3: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/coreshellcylinder.cpp

    r0f5bc9f r5eb9154  
    2929extern "C" { 
    3030        #include "libCylinder.h" 
     31        #include "libStructureFactor.h" 
    3132        #include "core_shell_cylinder.h" 
    3233} 
     
    213214        return (*this).operator()(qx, qy); 
    214215} 
     216/** 
     217 * Function to calculate effective radius 
     218 * @param pars: parameters of the sphere 
     219 * @return: effective radius value 
     220 */ 
     221double CoreShellCylinderModel :: calculate_ER() { 
     222        CoreShellCylinderParameters dp; 
     223 
     224        dp.radius     = radius(); 
     225        dp.thickness  = thickness(); 
     226        dp.length     = length(); 
     227        double rad_out = 0.0; 
     228 
     229        // Perform the computation, with all weight points 
     230        double sum = 0.0; 
     231        double norm = 0.0; 
     232 
     233        // Get the dispersion points for the major shell 
     234        vector<WeightPoint> weights_length; 
     235        length.get_weights(weights_length); 
     236 
     237        // Get the dispersion points for the major shell 
     238        vector<WeightPoint> weights_thickness; 
     239        thickness.get_weights(weights_thickness); 
     240 
     241        // Get the dispersion points for the minor shell 
     242        vector<WeightPoint> weights_radius ; 
     243        radius.get_weights(weights_radius); 
     244 
     245        // Loop over major shell weight points 
     246        for(int i=0; i< (int)weights_length.size(); i++) { 
     247                dp.length = weights_length[i].value; 
     248                for(int j=0; j< (int)weights_thickness.size(); j++) { 
     249                        dp.thickness = weights_thickness[j].value; 
     250                        for(int k=0; k< (int)weights_radius.size(); k++) { 
     251                                dp.radius = weights_radius[k].value; 
     252                                //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 
     253                                sum +=weights_length[i].weight * weights_thickness[j].weight 
     254                                        * weights_radius[k].weight*DiamCyl(dp.length,dp.radius+dp.thickness)/2.0; 
     255                                norm += weights_length[i].weight* weights_thickness[j].weight* weights_radius[k].weight; 
     256                        } 
     257                } 
     258        } 
     259        if (norm != 0){ 
     260                //return the averaged value 
     261                rad_out =  sum/norm;} 
     262        else{ 
     263                //return normal value 
     264                //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 
     265                rad_out = DiamCyl(dp.length,dp.radius+dp.thickness)/2.0;} 
     266 
     267        return rad_out; 
     268} 
Note: See TracChangeset for help on using the changeset viewer.