source: sasmodels/sasmodels/models/gel_fit.c @ d507c3a

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d507c3a was 30b4ddf, checked in by piotr, 8 years ago

Converted GelFit? model

  • Property mode set to 100644
File size: 2.2 KB
Line 
1double form_volume(void);
2
3double Iq(double q,
4          double guinier_scale,
5          double lorentzian_scale,
6          double gyration_radius,
7          double fractal_exp,
8          double cor_length);
9
10double Iqxy(double qx, double qy,
11          double guinier_scale,
12          double lorentzian_scale,
13          double gyration_radius,
14          double fractal_exp,
15          double cor_length);
16
17static double _gel_fit_kernel(double q,
18          double guinier_scale,
19          double lorentzian_scale,
20          double gyration_radius,
21          double fractal_exp,
22          double cor_length)
23{
24    // Lorentzian Term
25    ////////////////////////double a(x[i]*x[i]*zeta*zeta);
26    double lorentzian_term = q*q*cor_length*cor_length;
27    lorentzian_term = 1.0 + ((fractal_exp + 1.0)/3.0)*lorentzian_term;
28    lorentzian_term = pow(lorentzian_term, (fractal_exp/2.0) );
29
30    // Exponential Term
31    ////////////////////////double d(x[i]*x[i]*rg*rg);
32    double exp_term = q*q*gyration_radius*gyration_radius;
33    exp_term = exp(-1.0*(exp_term/3.0));
34
35    // Scattering Law
36    double result = lorentzian_scale/lorentzian_term + guinier_scale*exp_term;
37    return result;
38}
39double form_volume(void){
40    // Unused, so free to return garbage.
41    return NAN;
42}
43
44double Iq(double q,
45          double guinier_scale,
46          double lorentzian_scale,
47          double gyration_radius,
48          double fractal_exp,
49          double cor_length)
50{
51    return _gel_fit_kernel(q,
52                          guinier_scale,
53                          lorentzian_scale,
54                          gyration_radius,
55                          fractal_exp,
56                          cor_length);
57}
58
59// Iqxy is never called since no orientation or magnetic parameters.
60double Iqxy(double qx, double qy,
61          double guinier_scale,
62          double lorentzian_scale,
63          double gyration_radius,
64          double fractal_exp,
65          double cor_length)
66{
67    double q = sqrt(qx*qx + qy*qy);
68    return _gel_fit_kernel(q,
69                          guinier_scale,
70                          lorentzian_scale,
71                          gyration_radius,
72                          fractal_exp,
73                          cor_length);
74}
75
Note: See TracBrowser for help on using the repository browser.