Changeset b4679de in sasview for sansmodels
- Timestamp:
- Aug 4, 2009 3:32:38 PM (15 years ago)
- 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
- Location:
- sansmodels/src/sans/models
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/LamellarFFHGModel.py
r34c3020 rb4679de 52 52 self.name = "LamellarFFHGModel" 53 53 ## Model description 54 self.description =""" 55 NOTE: The total bilayer thickness = 2(h_thickness + t_length) 56 The meaning of the multiplicative scale factor is not well-defined, but should be on the 57 order of the volume fraction of solution occupied by the lamellar crystallites. Please see 58 the original references for clarification.""" 54 self.description =""" Parameters: t_length = tail length, h_thickness = head thickness, 55 scale = Scale factor, 56 background = incoherent Background 57 sld_tail = tail scattering length density , 58 sld_solvent = solvent scattering length density. 59 NOTE: The total bilayer thickness 60 = 2(h_thickness+ t_length). 61 """ 59 62 60 63 ## Parameter details [units, min, max] -
sansmodels/src/sans/models/LamellarModel.py
r34c3020 rb4679de 50 50 self.name = "LamellarModel" 51 51 ## Model description 52 self.description =""" I(q)= 2*pi*P(q)/(delta *q^(2)) 53 where: 54 P(q)=2*(contrast/q)^(2)*(1-cos(q*delta)*e^(1/2*(q*sigma)^(2))""" 52 self.description ="""[Dilute Lamellar Form Factor](from a lyotropic lamellar phase) 53 I(q)= 2*pi*P(q)/(delta *q^(2)), where 54 P(q)=2*(contrast/q)^(2)*(1-cos(q*delta) 55 *e^(1/2*(q*sigma)^(2)). 56 delta = bilayer thickness 57 sigma = variation in bilayer thickness 58 = delta*polydispersity 59 contrast = SLD_solvent - SLD_bilayer 60 Note: the polydispersity in delta is included.""" 55 61 56 62 ## Parameter details [units, min, max] … … 63 69 64 70 ## fittable parameters 65 self.fixed=[ 'delta.width']71 self.fixed=[] 66 72 67 73 ## parameters with orientation -
sansmodels/src/sans/models/VesicleModel.py
r2c4b289 rb4679de 51 51 self.name = "VesicleModel" 52 52 ## Model description 53 self.description =""" 54 Model parameters: 55 scale : scale factor 56 core_radius : Core radius of the vesicle 53 self.description ="""Model parameters: core_radius : Core radius of the vesicle 57 54 thickness: shell thickness 58 55 core_sld: core scattering length density 59 56 shell_sld: shell scattering length density 60 background: incoherent background""" 57 background: incoherent background 58 scale : scale factor""" 61 59 62 60 ## Parameter details [units, min, max] … … 70 68 71 69 ## fittable parameters 72 self.fixed=['core_radius.width' ]70 self.fixed=['core_radius.width', 'thickness.width'] 73 71 74 72 ## parameters with orientation -
sansmodels/src/sans/models/c_extensions/lamellarFF_HG.c
r34c3020 rb4679de 19 19 double lamellarFF_HG_analytical_1D(LamellarFF_HGParameters *pars, double q) { 20 20 double dp[7]; 21 21 22 22 // Fill paramater array 23 23 dp[0] = pars->scale; … … 28 28 dp[5] = pars->sld_solvent; 29 29 dp[6] = pars->background; 30 30 31 31 // Call library function to evaluate model 32 return LamellarFF_HG(dp, q); 32 return LamellarFF_HG(dp, q); 33 33 } 34 34 35 35 double lamellarFF_HG_analytical_2D(LamellarFF_HGParameters *pars, double q, double phi){ 36 return 1.0;36 return lamellarFF_HG_analytical_1D(pars,q); 37 37 } 38 38 double lamellarFF_HG_analytical_2DXY(LamellarFF_HGParameters *pars, double qx, double qy){ 39 return 1.0;39 return lamellarFF_HG_analytical_1D(pars,sqrt(qx*qx+qy*qy)); 40 40 } 41 double lamellarFF_HG_analytical_2D_scaled(LamellarFF_HGParameters *pars, double q, double q_x, double q_y){42 return 1.0;43 }44 -
sansmodels/src/sans/models/c_extensions/lamellarFF_HG.h
r34c3020 rb4679de 4 4 * [PYTHONCLASS] = LamellarFFHGModel 5 5 * [DISP_PARAMS] = t_length, h_thickness 6 [DESCRIPTION] = <text> 7 NOTE: The total bilayer thickness = 2(h_thickness + t_length) 8 The meaning of the multiplicative scale factor is not well-defined, but should be on the 9 order of the volume fraction of solution occupied by the lamellar crystallites. Please see 10 the original references for clarification. 11 </text> 6 [DESCRIPTION] = <text> Parameters: t_length = tail length, h_thickness = head thickness, 7 scale = Scale factor, 8 background = incoherent Background 9 sld_tail = tail scattering length density , 10 sld_solvent = solvent scattering length density. 11 NOTE: The total bilayer thickness 12 = 2(h_thickness+ t_length). 13 14 </text> 12 15 [FIXED]= t_length.width, h_thickness.width 13 [ORIENTATION_PARAMS]= 16 [ORIENTATION_PARAMS]= 14 17 **/ 15 18 typedef struct { … … 20 23 // [DEFAULT]=t_length=15.0 [A] 21 24 double t_length; 22 /// head thickness 25 /// head thickness 23 26 // [DEFAULT]=h_thickness=10.0 [A] 24 27 double h_thickness; 25 /// tail scrattering density length[1/A²]28 /// tail scrattering length density[1/A²] 26 29 // [DEFAULT]=sld_tail=4e-7 [1/A²] 27 30 double sld_tail; 28 /// head group scrattering density length[1/A²]31 /// head group scrattering length density[1/A²] 29 32 // [DEFAULT]=sld_head=3e-6 [1/A²] 30 33 double sld_head; 31 /// solvent scrattering density length[1/A²]34 /// solvent scrattering length density[1/A²] 32 35 // [DEFAULT]=sld_solvent=6e-6 [1/A²] 33 36 double sld_solvent; … … 35 38 // [DEFAULT]=background=0.0 [1/cm] 36 39 double background; 37 40 38 41 } LamellarFF_HGParameters; 39 42 … … 46 49 double lamellarFF_HG_analytical_2D(LamellarFF_HGParameters *pars, double q, double phi); 47 50 double lamellarFF_HG_analytical_2DXY(LamellarFF_HGParameters *pars, double qx, double qy); 48 double lamellarFF_HG_analytical_2D_scaled(LamellarFF_HGParameters *pars, double q, double q_x, double q_y);49 51 50 52 #endif -
sansmodels/src/sans/models/c_extensions/lamellarPS.c
r27a0771 rb4679de 19 19 double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q) { 20 20 double dp[8]; 21 21 22 22 // Fill paramater array 23 23 dp[0] = pars->scale; … … 31 31 32 32 // Call library function to evaluate model 33 return LamellarPS(dp, q); 33 return LamellarPS(dp, q); 34 34 } 35 35 /** … … 42 42 double q; 43 43 q = sqrt(qx*qx+qy*qy); 44 return lamellarPS_analytical_ 2D_scaled(pars, q, qx/q, qy/q);45 } 44 return lamellarPS_analytical_1D(pars, q); 45 } 46 46 47 47 … … 54 54 */ 55 55 double lamellarPS_analytical_2D(LamellarPSParameters *pars, double q, double phi) { 56 return lamellarPS_analytical_ 2D_scaled(pars, q, cos(phi), sin(phi));57 } 58 56 return lamellarPS_analytical_1D(pars,q); 57 } 58 59 59 /** 60 60 * Function to evaluate 2D scattering function … … 65 65 * @return: function value 66 66 */ 67 double lamellarPS_analytical_2D_scaled(LamellarPSParameters *pars, double q, double q_x, double q_y) {68 69 return 1.0;70 }71 72 67 68 -
sansmodels/src/sans/models/c_extensions/lamellarPS.h
r27a0771 rb4679de 7 7 /** Structure definition for concentrated lamellar form factor parameters 8 8 * [PYTHONCLASS] = LamellarPSModel 9 * [DISP_PARAMS] = delta 10 [DESCRIPTION] = <text> Calculates the scattered intensity from a lyotropic lamellar phase</text> 11 [FIXED]= delta.with 12 [ORIENTATION_PARAMS]= 9 * [DISP_PARAMS] = spacing 10 [DESCRIPTION] = <text>Calculates the scattered intensity from a lyotropic lamellar phase. 11 The intensity (form factor and structure factor) 12 calculated is for lamellae of uniform scattering 13 length density that are randomly distributed in 14 solution (a powder average). The lamellae 15 thickness is polydisperse. The model can also 16 be applied to large, multi-lamellar vesicles. 17 No resolution smeared version is included 18 in the structure factor of this model. 19 *Parameters: spacing = repeat spacing, 20 delta = bilayer thickness, 21 sigma = variation in bilayer thickness 22 contrast = SLD_solvent - SLD_bilayer 23 n_plate = # of Lamellar plates 24 caille = Caille parameter (<0.8 or <1) 25 background = incoherent bgd 26 scale = scale factor 27 </text> 28 [FIXED]= spacing.with 29 [ORIENTATION_PARAMS]= 13 30 14 31 **/ … … 35 52 // [DEFAULT]=caille=0.1 36 53 double caille; 37 /// Incoherent Background [1/cm] 54 /// Incoherent Background [1/cm] 38 55 // [DEFAULT]=background=0.0 [1/cm] 39 56 double background; 40 57 41 58 } LamellarPSParameters; 42 59 … … 49 66 double lamellarPS_analytical_2D(LamellarPSParameters *pars, double q, double phi); 50 67 double lamellarPS_analytical_2DXY(LamellarPSParameters *pars, double qx, double qy); 51 double lamellarPS_analytical_2D_scaled(LamellarPSParameters *pars, double q, double q_x, double q_y);52 68 53 69 #endif -
sansmodels/src/sans/models/c_models/flexiblecylinder.cpp
r2cc633b rb4679de 61 61 dp[3] = radius(); 62 62 dp[4] = contrast(); 63 dp[5] = background();63 dp[5] = 0.0; 64 64 65 65 // Get the dispersion points for the length -
sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp
r34c3020 rb4679de 62 62 dp[4] = sld_head(); 63 63 dp[5] = sld_solvent(); 64 dp[6] = background();64 dp[6] = 0.0; 65 65 66 66 // Get the dispersion points for the tail length … … 86 86 norm += weights_t_length[i].weight* weights_h_thickness[j].weight; 87 87 } 88 88 89 89 } 90 90 return sum/norm + background(); … … 99 99 100 100 double 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); 140 103 } 141 104 … … 148 111 */ 149 112 double 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); 153 114 } -
sansmodels/src/sans/models/c_models/lamellarPS.cpp
r27a0771 rb4679de 35 35 LamellarPSModel :: LamellarPSModel() { 36 36 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); 39 40 delta.set_min(0.0); 40 sigma = Parameter(0.15, true); 41 sigma = Parameter(0.15); 42 sigma.set_min(0.0); 41 43 contrast = Parameter(5.3e-6); 42 44 n_plates = Parameter(20.0); … … 64 66 dp[5] = n_plates(); 65 67 dp[6] = caille(); 66 dp[7] = background();67 68 dp[7] = 0.0; 69 68 70 69 71 // 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 73 75 // Perform the computation, with all weight points 74 76 double sum = 0.0; 75 77 double norm = 0.0; 76 78 77 79 // 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; 80 82 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 84 86 } 85 87 return sum/norm + background(); … … 92 94 */ 93 95 double 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); 123 98 } 124 125 99 126 100 /** … … 132 106 */ 133 107 double 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); 137 109 }
Note: See TracChangeset
for help on using the changeset viewer.