Changeset b4679de in sasview for sansmodels/src/sans/models/c_models


Ignore:
Timestamp:
Aug 4, 2009 1:32:38 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:
fbe5d3e
Parents:
8e91f01
Message:

added 2d and model descpt + correction on polydisp. para.

Location:
sansmodels/src/sans/models/c_models
Files:
3 edited

Legend:

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

    r2cc633b rb4679de  
    6161        dp[3] = radius(); 
    6262        dp[4] = contrast(); 
    63         dp[5] = background(); 
     63        dp[5] = 0.0; 
    6464 
    6565        // Get the dispersion points for the length 
  • sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp

    r34c3020 rb4679de  
    6262        dp[4] = sld_head(); 
    6363        dp[5] = sld_solvent(); 
    64         dp[6] = background(); 
     64        dp[6] = 0.0; 
    6565 
    6666        // Get the dispersion points for the tail length 
     
    8686                        norm += weights_t_length[i].weight* weights_h_thickness[j].weight; 
    8787                } 
    88                                  
     88 
    8989        } 
    9090        return sum/norm + background(); 
     
    9999 
    100100double LamellarFFHGModel :: operator()(double qx, double qy) { 
    101         LamellarFF_HGParameters dp; 
    102  
    103         // Fill parameter array for IGOR library 
    104         // Add the background after averaging 
    105         dp.scale = scale(); 
    106         dp.t_length = t_length(); 
    107         dp.h_thickness = h_thickness(); 
    108         dp.sld_tail = sld_tail(); 
    109         dp.sld_head = sld_head(); 
    110         dp.sld_solvent = sld_solvent(); 
    111         dp.background = background(); 
    112  
    113  
    114         // Get the dispersion points for the tail length 
    115         vector<WeightPoint> weights_t_length; 
    116         t_length.get_weights(weights_t_length); 
    117  
    118         // Get the dispersion points for the head thickness 
    119         vector<WeightPoint> weights_h_thickness; 
    120         h_thickness.get_weights(weights_h_thickness); 
    121  
    122         // Perform the computation, with all weight points 
    123         double sum = 0.0; 
    124         double norm = 0.0; 
    125  
    126         // Loop over detla  weight points 
    127         for(int i=0; i< (int)weights_t_length.size(); i++) { 
    128                 dp.t_length = weights_t_length[i].value; 
    129  
    130                 for(int j=0; j< (int)weights_h_thickness.size(); j++) { 
    131                         dp.h_thickness = weights_h_thickness[j].value; 
    132  
    133                         sum += weights_t_length[i].weight* weights_h_thickness[j].weight 
    134                                 * lamellarFF_HG_analytical_2DXY(&dp, qx, qy); 
    135                         norm += weights_t_length[i].weight* weights_h_thickness[j].weight; 
    136                 } 
    137                                  
    138         } 
    139         return sum/norm + background(); 
     101        double q = sqrt(qx*qx + qy*qy); 
     102        return (*this).operator()(q); 
    140103} 
    141104 
     
    148111 */ 
    149112double LamellarFFHGModel :: evaluate_rphi(double q, double phi) { 
    150         double qx = q*cos(phi); 
    151         double qy = q*sin(phi); 
    152         return (*this).operator()(qx, qy); 
     113        return (*this).operator()(q); 
    153114} 
  • sansmodels/src/sans/models/c_models/lamellarPS.cpp

    r27a0771 rb4679de  
    3535LamellarPSModel :: LamellarPSModel() { 
    3636        scale      = Parameter(1.0); 
    37         spacing    = Parameter(400.0); 
    38         delta     = Parameter(30.0, true); 
     37        spacing    = Parameter(400.0, true); 
     38        spacing.set_min(0.0); 
     39        delta     = Parameter(30.0); 
    3940        delta.set_min(0.0); 
    40         sigma    = Parameter(0.15, true); 
     41        sigma    = Parameter(0.15); 
     42        sigma.set_min(0.0); 
    4143        contrast   = Parameter(5.3e-6); 
    4244        n_plates     = Parameter(20.0); 
     
    6466        dp[5] = n_plates(); 
    6567        dp[6] = caille(); 
    66         dp[7] = background(); 
    67          
     68        dp[7] = 0.0; 
     69 
    6870 
    6971        // Get the dispersion points for (delta) thickness 
    70         vector<WeightPoint> weights_delta; 
    71         delta.get_weights(weights_delta); 
    72          
     72        vector<WeightPoint> weights_spacing; 
     73        spacing.get_weights(weights_spacing); 
     74 
    7375        // Perform the computation, with all weight points 
    7476        double sum = 0.0; 
    7577        double norm = 0.0; 
    76          
     78 
    7779        // Loop over short_edgeA weight points 
    78         for(int i=0; i< (int)weights_delta.size(); i++) { 
    79                 dp[2] = weights_delta[i].value; 
     80        for(int i=0; i< (int)weights_spacing.size(); i++) { 
     81                dp[1] = weights_spacing[i].value; 
    8082 
    81                 sum += weights_delta[i].weight * LamellarPS(dp, q); 
    82                 norm += weights_delta[i].weight; 
    83                                  
     83                sum += weights_spacing[i].weight * LamellarPS(dp, q); 
     84                norm += weights_spacing[i].weight; 
     85 
    8486        } 
    8587        return sum/norm + background(); 
     
    9294 */ 
    9395double LamellarPSModel :: operator()(double qx, double qy) { 
    94         LamellarPSParameters dp; 
    95         // Fill parameter array 
    96         dp.scale      = scale(); 
    97         dp.spacing   = spacing(); 
    98         dp.delta  = delta(); 
    99         dp.sigma = sigma(); 
    100         dp.contrast   = contrast(); 
    101         dp.n_plates = n_plates(); 
    102         dp.caille = caille(); 
    103         dp.background    = background(); 
    104          
    105  
    106         // Get the dispersion points for the delta 
    107         vector<WeightPoint> weights_delta; 
    108         delta.get_weights(weights_delta); 
    109  
    110         // Perform the computation, with all weight points 
    111         double sum = 0.0; 
    112         double norm = 0.0; 
    113  
    114         // Loop over radius weight points 
    115         for(int i=0; i< (int)weights_delta.size(); i++) { 
    116                 dp.delta = weights_delta[i].value; 
    117  
    118                 sum += weights_delta[i].weight *lamellarPS_analytical_2DXY(&dp, qx, qy);         
    119                 norm += weights_delta[i].weight;         
    120         } 
    121          
    122         return sum/norm + background(); 
     96        double q = sqrt(qx*qx + qy*qy); 
     97        return (*this).operator()(q); 
    12398} 
    124  
    12599 
    126100/** 
     
    132106 */ 
    133107double LamellarPSModel :: evaluate_rphi(double q, double phi) { 
    134         double qx = q*cos(phi); 
    135         double qy = q*sin(phi); 
    136         return (*this).operator()(qx, qy); 
     108        return (*this).operator()(q); 
    137109} 
Note: See TracChangeset for help on using the changeset viewer.