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/hollowcylinder.cpp

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