Changeset 6fd8de0 in sasmodels


Ignore:
Timestamp:
Mar 22, 2016 3:28:16 AM (8 years ago)
Author:
wojciech
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
Message:

Updated polydispersity loop documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/developer/calculator.rst

    r48fbd50 r6fd8de0  
    77- KERNEL declares a function to be available externally 
    88- 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] 
    1010- NPARS is the number of parameters in the kernel 
    1111- PARAMETER_TABLE is the declaration of the parameters to the kernel:: 
     
    3030        double sld_solvent 
    3131 
    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:: 
    3333 
    3434    Cylinder: 
     
    7272    BarBell: 
    7373 
    74         #define INVALID(var) (var.bell_radius > var.radius) 
     74        #define INVALID(var) (var.bell_radius < var.radius) 
    7575 
    7676    Model with complicated constraints: 
     
    9090    0: scale        {scl = constant} 
    9191    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} 
    9696 
    9797This generates the following call to the kernel (where x stands for an 
     
    100100    NPARS = 4  // scale and background are in all models 
    101101    problem { 
    102         pd_par = {5, 4, x, x}         // parameters *radius* and *length* vary 
     102        pd_par = {3, 2, x, x}         // parameters *radius* and *length* vary 
    103103        pd_length = {30, 10, 0, 0}    // *length* has more, so it is first 
    104104        pd_offset = {10, 0, x, x}     // *length* starts at index 10 in weights 
    105105        pd_stride = {1, 30, 300, 300} // cumulative product of pd length 
    106         pd_isvol = {1, 1, x, x}       // true if weight is a volume weight 
     106        pd_isvol = {True, True, x, x}       // true if weight is a volume weight 
    107107        par_offset = {2, 3, 303, 313}  // parameter offsets 
    108108        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 
    110110        fast_coord_count = 2  // two parameters vary with *length* distribution 
    111111        theta_var = -1   // no spherical correction 
     
    113113    } 
    114114 
    115     weight = { l0, .., l29, r0, .., r9} 
     115    weight = { l0, .., l29, r0, .., r9} //length comes first as the longest vec 
    116116    pars = { scl, bkg, l0, ..., l29, r0, r1, ..., r9, 
    117117             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 
    118119 
    119120    nq = 130 
     
    125126indices, one for each polydisperse parameter, stored in pd_par[n]. 
    126127Non-polydisperse parameters do not appear in this array. Each polydisperse 
    127 parameter has a weight vector whose length is stored in pd_length[n], 
     128parameter has a weight vector whose length is stored in pd_length[n]. 
    128129The weights are stored in a contiguous vector of weights for all 
    129130parameters, with the starting position for the each parameter stored 
     
    150151parameter are arranged contiguously in a vector, with offset[k] giving the 
    151152starting location of parameter k in the vector.  Each parameter defines 
    152 coord[k] as a bit mask indicating which polydispersity parameters the 
     153par_coord[k] as a bit mask indicating which polydispersity parameters the 
    153154parameter depends upon. Usually this is zero, indicating that the parameter 
    154155is independent, but for the cylinder example given, the bits for the 
     
    207208in order to preserve the 'surface area' of the weight distribution. 
    208209 
    209 TODO: cutoff 
     210cutoff parameter limits integration area within polydispersity hypercude, 
     211which speeds calculations 
    210212 
    211213For accuracy we may want to introduce Kahan summation into the integration:: 
Note: See TracChangeset for help on using the changeset viewer.