source: sasview/sansmodels/src/sans/models/c_extensions/lamellar.c @ 9f391af

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 9f391af was c1c29b6, checked in by Jae Cho <jhjcho@…>, 15 years ago

some corrections and removed polydispersity from inside of function and set dQ =0

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[34c3020]1/**
[42f193a]2 * Scattering model for dilute lamellar model: polydipsersion in thickness (delta) included
[34c3020]3 * @author: Gervaise B. Alina / UTK
4 */
5
6#include "lamellar.h"
7#include <math.h>
[c1c29b6]8//#include "libCylinder.h"
[34c3020]9#include <stdio.h>
10#include <stdlib.h>
11
[0cfeff4]12/*      LamellarFFX  :  calculates the form factor of a lamellar structure - no S(q) effects included
13                                                -NO polydispersion included
14*/
15double lamellar_kernel(double dp[], double q){
16        double scale,del,sld_bi,sld_sol,contr,bkg;              //local variables of coefficient wave
17        double inten, qval,Pq;
18        double Pi;
19
20
21        Pi = 4.0*atan(1.0);
22        scale = dp[0];
23        del = dp[1];
24        sld_bi = dp[2];
25        sld_sol = dp[3];
26        bkg = dp[4];
27        qval = q;
28        contr = sld_bi -sld_sol;
29
30        Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del));
31
32        inten = 2.0*Pi*scale*Pq/(qval*qval);            //this is now dimensionless...
33
34        inten /= del;                   //normalize by the thickness (in A)
35
36        inten *= 1.0e8;         // 1/A to 1/cm
37
38        return(inten+bkg);
39}
[34c3020]40
41/**
42 * Function to evaluate 1D scattering function
43 * @param pars: parameters of the lamellar
44 * @param q: q-value
45 * @return: function value
46 */
47double lamellar_analytical_1D(LamellarParameters *pars, double q) {
48        double dp[5];
[42f193a]49
[34c3020]50        // Fill paramater array
51        dp[0] = pars->scale;
[975ec8e]52        dp[1] = pars->bi_thick;
53        dp[2] = pars->sld_bi;
54        dp[3] = pars->sld_sol;
[34c3020]55        dp[4] = pars->background;
[42f193a]56
57
[34c3020]58        // Call library function to evaluate model
[975ec8e]59        return lamellar_kernel(dp, q);
[34c3020]60}
[975ec8e]61
62
[42f193a]63/**
64 * Function to evaluate 2D scattering function
65 * @param pars: parameters of the lamellar
66 * @param q: q-value
67 * @return: function value
68 */
69
[34c3020]70
71double lamellar_analytical_2D(LamellarParameters *pars, double q, double phi){
[42f193a]72        return lamellar_analytical_1D(pars,q);
[34c3020]73}
74double lamellar_analytical_2DXY(LamellarParameters *pars, double qx, double qy){
[42f193a]75        return lamellar_analytical_1D(pars,sqrt(qx*qx+qy*qy));
[34c3020]76}
77
Note: See TracBrowser for help on using the repository browser.