Changeset fd7291e in sasmodels for doc/guide/plugin.rst
- Timestamp:
- Mar 6, 2019 6:05:52 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c11d09f
- Parents:
- 21c93c3 (diff), 9150036 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/guide/plugin.rst
r9d8a027 r9150036 302 302 303 303 **Note: The order of the parameters in the definition will be the order of the 304 parameters in the user interface and the order of the parameters in Iq(),305 Iqac(), Iqabc() and form_volume(). And** *scale* **and** *background*306 **parameters are implicit to all models, so they do not need to be included 307 in the parameter table.**304 parameters in the user interface and the order of the parameters in Fq(), Iq(), 305 Iqac(), Iqabc(), form_volume() and shell_volume(). 306 And** *scale* **and** *background* **parameters are implicit to all models, 307 so they do not need to be included in the parameter table.** 308 308 309 309 - **"name"** is the name of the parameter shown on the FitPage. … … 374 374 scattered intensity. 375 375 376 - "volume" parameters are passed to Iq(), Iqac(), Iqabc() and form_volume(),377 and have polydispersity loops generated automatically.376 - "volume" parameters are passed to Fq(), Iq(), Iqac(), Iqabc(), form_volume() 377 and shell_volume(), and have polydispersity loops generated automatically. 378 378 379 379 - "orientation" parameters are not passed, but instead are combined with … … 503 503 used. 504 504 505 Hollow shapes, where the volume fraction of particle corresponds to the 506 material in the shell rather than the volume enclosed by the shape, must 507 also define a *shell_volume(par1, par2, ...)* function. The parameters 508 are the same as for *form_volume*. The *I(q)* calculation should use 509 *shell_volume* squared as its scale factor for the volume normalization. 510 The structure factor calculation needs *form_volume* in order to properly 511 scale the volume fraction parameter, so both functions are required for 512 hollow shapes. 513 514 Note: Pure python models do not yet support direct computation of the 515 average of $F(q)$ and $F^2(q)$. 516 505 517 Embedded C Models 506 518 ................. … … 514 526 This expands into the equivalent C code:: 515 527 516 #include <math.h>517 528 double Iq(double q, double par1, double par2, ...); 518 529 double Iq(double q, double par1, double par2, ...) … … 523 534 *form_volume* defines the volume of the shape. As in python models, it 524 535 includes only the volume parameters. 536 537 *form_volume* defines the volume of the shell for hollow shapes. As in 538 python models, it includes only the volume parameters. 525 539 526 540 **source=['fn.c', ...]** includes the listed C source files in the … … 559 573 The INVALID define can go into *Iq*, or *c_code*, or an external C file 560 574 listed in *source*. 575 576 Structure Factors 577 ................. 578 579 Structure factor calculations may need the underlying $<F(q)>$ and $<F^2(q)>$ 580 rather than $I(q)$. This is used to compute $\beta = <F(q)>^2/<F^2(q)>$ in 581 the decoupling approximation to the structure factor. 582 583 Instead of defining the *Iq* function, models can define *Fq* as 584 something like:: 585 586 double Fq(double q, double *F1, double *F2, double par1, double par2, ...); 587 double Fq(double q, double *F1, double *F2, double par1, double par2, ...) 588 { 589 // Polar integration loop over all orientations. 590 ... 591 *F1 = 1e-2 * total_F1 * contrast * volume; 592 *F2 = 1e-4 * total_F2 * square(contrast * volume); 593 return I(q, par1, par2, ...); 594 } 595 596 If the volume fraction scale factor is built into the model (as occurs for 597 the vesicle model, for example), then scale *F1* by $\surd V_f$ so that 598 $\beta$ is computed correctly. 599 600 Structure factor calculations are not yet supported for oriented shapes. 601 602 Note: only available as a separate C file listed in *source*, or within 603 a *c_code* block within the python model definition file. 561 604 562 605 Oriented Shapes … … 862 905 - \frac{\sin(x)}{x}\left(\frac{1}{x} - \frac{3!}{x^3} + \frac{5!}{x^5} - \frac{7!}{x^7}\right) 863 906 864 For small arguments 907 For small arguments, 865 908 866 909 .. math:: … … 1023 1066 "radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 1024 1067 0.2, 0.228843], 1025 [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, "ER", 120.], 1026 [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, "VR", 1.], 1068 [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 1069 0.1, None, None, 120., None, 1.], # q, F, F^2, R_eff, V, form:shell 1070 [{"@S": "hardsphere"}, 0.1, None], 1027 1071 ] 1028 1072 1029 1073 1030 **tests=[[{parameters}, q, result], ...]** is a list of lists.1074 **tests=[[{parameters}, q, Iq], ...]** is a list of lists. 1031 1075 Each list is one test and contains, in order: 1032 1076 … … 1040 1084 - input and output values can themselves be lists if you have several 1041 1085 $q$ values to test for the same model parameters. 1042 - for testing *ER* and *VR*, give the inputs as "ER" and "VR" respectively; 1043 the output for *VR* should be the sphere/shell ratio, not the individual 1044 sphere and shell values. 1086 - for testing effective radius, volume and form:shell volume ratio, use the 1087 extended form of the tests results, with *None, None, R_eff, V, V_r* 1088 instead of *Iq*. This calls the kernel *Fq* function instead of *Iq*. 1089 - for testing F and F^2 (used for beta approximation) do the same as the 1090 effective radius test, but include values for the first two elements, 1091 $<F(q)>$ and $<F^2(q)>$. 1092 - for testing interaction between form factor and structure factor, specify 1093 the structure factor name in the parameters as *{"@S": "name", ...}* with 1094 the remaining list of parameters defined by the *P@S* product model. 1045 1095 1046 1096 .. _Test_Your_New_Model:
Note: See TracChangeset
for help on using the changeset viewer.