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

    rb4679de r5eb9154  
    3030extern "C" { 
    3131        #include "libCylinder.h" 
     32        #include "libStructureFactor.h" 
    3233        #include "flexible_cylinder.h" 
    3334} 
     
    124125        return (*this).operator()(q); 
    125126} 
     127/** 
     128 * Function to calculate effective radius 
     129 * @param pars: parameters of the sphere 
     130 * @return: effective radius value 
     131 */ 
     132double FlexibleCylinderModel :: calculate_ER() { 
     133        FlexibleCylinderParameters dp; 
     134 
     135        dp.radius  = radius(); 
     136        dp.length     = length(); 
     137 
     138        double rad_out = 0.0; 
     139 
     140        // Perform the computation, with all weight points 
     141        double sum = 0.0; 
     142        double norm = 0.0; 
     143 
     144        // Get the dispersion points for the major shell 
     145        vector<WeightPoint> weights_length; 
     146        length.get_weights(weights_length); 
     147 
     148        // Get the dispersion points for the minor shell 
     149        vector<WeightPoint> weights_radius ; 
     150        radius.get_weights(weights_radius); 
     151 
     152        // Loop over major shell weight points 
     153        for(int i=0; i< (int)weights_length.size(); i++) { 
     154                dp.length = weights_length[i].value; 
     155                for(int k=0; k< (int)weights_radius.size(); k++) { 
     156                        dp.radius = weights_radius[k].value; 
     157                        //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 
     158                        sum +=weights_length[i].weight 
     159                                * weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0; 
     160                        norm += weights_length[i].weight* weights_radius[k].weight; 
     161                } 
     162        } 
     163        if (norm != 0){ 
     164                //return the averaged value 
     165                rad_out =  sum/norm;} 
     166        else{ 
     167                //return normal value 
     168                //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 
     169                rad_out = DiamCyl(dp.length,dp.radius)/2.0;} 
     170 
     171        return rad_out; 
     172} 
Note: See TracChangeset for help on using the changeset viewer.