Changeset 82c11d3 in sasview for sansmodels/src/c_models/lamellarPC.cpp
- Timestamp:
- Jan 5, 2012 4:24:51 PM (13 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:
- 20d91bd
- Parents:
- 98fdccd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/c_models/lamellarPC.cpp
r67424cd r82c11d3 20 20 21 21 #include <math.h> 22 #include "models.hh"23 22 #include "parameters.hh" 24 23 #include <stdio.h> 25 24 using namespace std; 25 #include "lamellarPC.h" 26 26 27 27 extern "C" { 28 #include "libCylinder.h" 29 #include "lamellarPC.h" 28 #include "libCylinder.h" 30 29 } 31 30 32 31 LamellarPCrystalModel :: LamellarPCrystalModel() { 33 34 35 36 37 38 39 40 41 42 32 scale = Parameter(1.0); 33 thickness = Parameter(33.0, true); 34 thickness.set_min(0.0); 35 Nlayers = Parameter(20.0, true); 36 Nlayers.set_min(0.0); 37 spacing = Parameter(250); 38 pd_spacing = Parameter(0.0); 39 sld_layer = Parameter(1.0e-6); 40 sld_solvent = Parameter(6.34e-6); 41 background = Parameter(0.0); 43 42 44 43 } … … 51 50 */ 52 51 double LamellarPCrystalModel :: operator()(double q) { 53 52 double dp[8]; 54 53 55 56 57 58 59 60 61 62 63 64 54 // Fill parameter array for IGOR library 55 // Add the background after averaging 56 dp[0] = scale(); 57 dp[1] = thickness(); 58 dp[2] = Nlayers(); 59 dp[3] = spacing(); 60 dp[4] = pd_spacing(); 61 dp[5] = sld_layer(); 62 dp[6] = sld_solvent(); 63 dp[7] = 0.0; // Do not apply background here. 65 64 66 67 68 65 // Get the dispersion points for the head thickness 66 vector<WeightPoint> weights_thickness; 67 thickness.get_weights(weights_thickness); 69 68 70 71 72 73 69 // Let's provide from the func which is more accurate especially for small q region. 70 // Get the dispersion points for the tail length 71 //vector<WeightPoint> weights_spacing; 72 //spacing.get_weights(weights_spacing); 74 73 75 76 77 74 // Perform the computation, with all weight points 75 double sum = 0.0; 76 double norm = 0.0; 78 77 79 80 81 82 83 84 85 86 87 88 89 78 // Loop over thickness and spacing weight points 79 for(int i=0; i< (int)weights_thickness.size(); i++) { 80 dp[1] = weights_thickness[i].value; 81 //for (int j=0; j< (int)weights_spacing.size(); j++){ 82 //dp[3] = weights_spacing[j].value; 83 sum += weights_thickness[i].weight*Lamellar_ParaCrystal(dp, q); 84 norm += weights_thickness[i].weight; 85 //} 86 } 87 //apply norm and background 88 return sum/norm + background(); 90 89 } 91 90 … … 98 97 99 98 double LamellarPCrystalModel :: operator()(double qx, double qy) { 100 101 99 double q = sqrt(qx*qx + qy*qy); 100 return (*this).operator()(q); 102 101 } 103 102 … … 110 109 */ 111 110 double LamellarPCrystalModel :: evaluate_rphi(double q, double phi) { 112 111 return (*this).operator()(q); 113 112 } 114 113 /** … … 117 116 */ 118 117 double LamellarPCrystalModel :: calculate_ER() { 119 //NOT implemented yet!!!120 118 //NOT implemented yet!!! 119 return 0.0; 121 120 }
Note: See TracChangeset
for help on using the changeset viewer.