Changeset 6fd8de0 in sasmodels
- Timestamp:
- Mar 22, 2016 5:28:16 AM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 69aa451
- Parents:
- fec69dd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/developer/calculator.rst
r48fbd50 r6fd8de0 7 7 - KERNEL declares a function to be available externally 8 8 - KERNEL_NAME is the name of the function being declared 9 - MAX_PD is the maximum depth of the polydispersity loop 9 - MAX_PD is the maximum depth of the polydispersity loop [model specific] 10 10 - NPARS is the number of parameters in the kernel 11 11 - PARAMETER_TABLE is the declaration of the parameters to the kernel:: … … 30 30 double sld_solvent 31 31 32 - CALL_IQ(q, i, pars) is the declaration of a call to the kernel::32 - CALL_IQ(q, i, var) is the declaration of a call to the kernel:: 33 33 34 34 Cylinder: … … 72 72 BarBell: 73 73 74 #define INVALID(var) (var.bell_radius >var.radius)74 #define INVALID(var) (var.bell_radius < var.radius) 75 75 76 76 Model with complicated constraints: … … 90 90 0: scale {scl = constant} 91 91 1: background {bkg = constant} 92 5: length {l = vector of 30pts}93 4: radius {r = vector of 10pts}94 3: sld {s = constant/(radius**2*length)}95 2: sld_solvent {s2 = constant}92 2: length {l = vector of 30pts} 93 3: radius {r = vector of 10pts} 94 4: sld {s = constant/(radius**2*length)} 95 5: sld_solvent {s2 = constant} 96 96 97 97 This generates the following call to the kernel (where x stands for an … … 100 100 NPARS = 4 // scale and background are in all models 101 101 problem { 102 pd_par = { 5, 4, x, x} // parameters *radius* and *length* vary102 pd_par = {3, 2, x, x} // parameters *radius* and *length* vary 103 103 pd_length = {30, 10, 0, 0} // *length* has more, so it is first 104 104 pd_offset = {10, 0, x, x} // *length* starts at index 10 in weights 105 105 pd_stride = {1, 30, 300, 300} // cumulative product of pd length 106 pd_isvol = { 1, 1, x, x} // true if weight is a volume weight106 pd_isvol = {True, True, x, x} // true if weight is a volume weight 107 107 par_offset = {2, 3, 303, 313} // parameter offsets 108 108 par_coord = {0, 3, 2, 1} // bitmap of parameter dependencies 109 fast_coord_index = { 5, 3, x, x}109 fast_coord_index = {3, 5, x, x} // radius and sld have fast index 110 110 fast_coord_count = 2 // two parameters vary with *length* distribution 111 111 theta_var = -1 // no spherical correction … … 113 113 } 114 114 115 weight = { l0, .., l29, r0, .., r9} 115 weight = { l0, .., l29, r0, .., r9} //length comes first as the longest vec 116 116 pars = { scl, bkg, l0, ..., l29, r0, r1, ..., r9, 117 117 s[l0,r0], ... s[l0,r9], s[l1,r0], ... s[l29,r9] , s2} 118 //where s[x,y] stands for material sld, s2 = solvent sld 118 119 119 120 nq = 130 … … 125 126 indices, one for each polydisperse parameter, stored in pd_par[n]. 126 127 Non-polydisperse parameters do not appear in this array. Each polydisperse 127 parameter has a weight vector whose length is stored in pd_length[n] ,128 parameter has a weight vector whose length is stored in pd_length[n]. 128 129 The weights are stored in a contiguous vector of weights for all 129 130 parameters, with the starting position for the each parameter stored … … 150 151 parameter are arranged contiguously in a vector, with offset[k] giving the 151 152 starting location of parameter k in the vector. Each parameter defines 152 coord[k] as a bit mask indicating which polydispersity parameters the153 par_coord[k] as a bit mask indicating which polydispersity parameters the 153 154 parameter depends upon. Usually this is zero, indicating that the parameter 154 155 is independent, but for the cylinder example given, the bits for the … … 207 208 in order to preserve the 'surface area' of the weight distribution. 208 209 209 TODO: cutoff 210 cutoff parameter limits integration area within polydispersity hypercude, 211 which speeds calculations 210 212 211 213 For accuracy we may want to introduce Kahan summation into the integration::
Note: See TracChangeset
for help on using the changeset viewer.