1 | /** |
---|
2 | * Scattering intensity for dispersed CCylinderModel |
---|
3 | * |
---|
4 | * WARNING: THIS FILE WAS GENERATED BY IGORGENERATOR.PY |
---|
5 | * DO NOT MODIFY THIS FILE, MODIFY cylinder.h |
---|
6 | * AND RE-RUN THE GENERATOR SCRIPT |
---|
7 | * |
---|
8 | * This code was written as part of the DANSE project |
---|
9 | * http://danse.us/trac/sans/ |
---|
10 | * |
---|
11 | * Copyright 2007: University of Tennessee, for the DANSE project |
---|
12 | */ |
---|
13 | |
---|
14 | #include "cylinder.h" |
---|
15 | #include <math.h> |
---|
16 | #include "libCylinder.h" |
---|
17 | #include "libSphere.h" |
---|
18 | #include "c_disperser.h" |
---|
19 | |
---|
20 | /** |
---|
21 | * Function to evaluate 2D scattering function |
---|
22 | * |
---|
23 | * @param dp: parameters of the function |
---|
24 | * @param q: q-value |
---|
25 | * @param phi: angle of the q-vector in the plane of the detector, relative to q_x |
---|
26 | * @return: function value |
---|
27 | */ |
---|
28 | double oriented_cylinder_2D(double pars[], double q, double phi) { |
---|
29 | CylinderParameters danse_pars; |
---|
30 | |
---|
31 | // List of default parameters: |
---|
32 | // pars[0]: scale = 1.0 |
---|
33 | // pars[1]: radius = 20.0 A |
---|
34 | // pars[2]: length = 400.0 A |
---|
35 | // pars[3]: contrast = 3e-06 A-2 |
---|
36 | // pars[4]: background = 0.0 cm-1 |
---|
37 | // pars[5]: cyl_theta = 1.0 rad |
---|
38 | // pars[6]: cyl_phi = 1.0 rad |
---|
39 | danse_pars.scale = pars[0]; |
---|
40 | danse_pars.radius = pars[1]; |
---|
41 | danse_pars.length = pars[2]; |
---|
42 | danse_pars.contrast = pars[3]; |
---|
43 | danse_pars.background = pars[4]; |
---|
44 | danse_pars.cyl_theta = pars[5]; |
---|
45 | danse_pars.cyl_phi = pars[6]; |
---|
46 | |
---|
47 | return cylinder_analytical_2D(&danse_pars, q, phi); |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * Function to evaluate dispersed 2D scattering function |
---|
52 | * |
---|
53 | * @param dp: parameters of the function |
---|
54 | * @param q: q-value |
---|
55 | * @param phi: angle of the q-vector in the plane of the detector, relative to q_x |
---|
56 | * @return: function value |
---|
57 | * |
---|
58 | // List of default parameters: |
---|
59 | // pars[0]: scale = 1.0 |
---|
60 | // pars[1]: radius = 20.0 A |
---|
61 | // pars[2]: length = 400.0 A |
---|
62 | // pars[3]: contrast = 3e-06 A-2 |
---|
63 | // pars[4]: background = 0.0 cm-1 |
---|
64 | // pars[5]: cyl_theta = 1.0 rad |
---|
65 | // pars[6]: cyl_phi = 1.0 rad |
---|
66 | |
---|
67 | // pars[7]: dispersion of radius |
---|
68 | // pars[8]: dispersion of cyl_theta |
---|
69 | // pars[9]: dispersion of cyl_phi |
---|
70 | // pars[10]: number of points in dispersion curve |
---|
71 | |
---|
72 | */ |
---|
73 | double disperse_cylinder_analytical_2D(double dp[], double q, double phi) { |
---|
74 | int paramList[3]; |
---|
75 | double sigmaList[3]; |
---|
76 | int npts; |
---|
77 | int i; |
---|
78 | double pars[11]; |
---|
79 | |
---|
80 | // radius |
---|
81 | paramList[0] = 1; |
---|
82 | // cyl_theta |
---|
83 | paramList[1] = 5; |
---|
84 | // cyl_phi |
---|
85 | paramList[2] = 6; |
---|
86 | |
---|
87 | sigmaList[0] = dp[7]; |
---|
88 | sigmaList[1] = dp[8]; |
---|
89 | sigmaList[2] = dp[9]; |
---|
90 | |
---|
91 | npts = (int)(floor(dp[10])); |
---|
92 | |
---|
93 | |
---|
94 | // Internal copy of parameters |
---|
95 | for(i=0; i<11; i++ ) { |
---|
96 | pars[i] = dp[i]; |
---|
97 | } |
---|
98 | |
---|
99 | return c_disperser( &oriented_cylinder_2D, pars, 3, |
---|
100 | paramList, sigmaList, npts, q, phi ); |
---|
101 | |
---|
102 | |
---|
103 | } |
---|
104 | |
---|