source: sasmodels/sasmodels/models/core_multi_shell.c @ d42dd4a

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d42dd4a was d42dd4a, checked in by pkienzle, 14 months ago

fix compiler warnings for CUDA

  • Property mode set to 100644
File size: 1.3 KB
Line 
1
2static double
3f_constant(double q, double r, double sld)
4{
5  const double bes = sas_3j1x_x(q * r);
6  const double vol = M_4PI_3 * cube(r);
7  return sld * vol * bes;
8}
9
10static double
11outer_radius(double core_radius, double fp_n, double thickness[])
12{
13  double r = core_radius;
14  int n = (int)(fp_n+0.5);
15  for (int i=0; i < n; i++) {
16    r += thickness[i];
17  }
18  return r;
19}
20
21static double
22form_volume(double core_radius, double fp_n, double thickness[])
23{
24  return M_4PI_3 * cube(outer_radius(core_radius, fp_n, thickness));
25}
26
27static double
28effective_radius(int mode, double core_radius, double fp_n, double thickness[])
29{
30  switch (mode) {
31  default:
32  case 1: // outer radius
33    return outer_radius(core_radius, fp_n, thickness);
34  case 2: // core radius
35    return core_radius;
36  }
37}
38
39static void
40Fq(double q, double *F1, double *F2, double core_sld, double core_radius,
41   double solvent_sld, double fp_n, double sld[], double thickness[])
42{
43  const int n = (int)(fp_n+0.5);
44  double f, r, last_sld;
45  r = core_radius;
46  last_sld = core_sld;
47  f = 0.;
48  for (int i=0; i<n; i++) {
49    f += M_4PI_3 * cube(r) * (sld[i] - last_sld) * sas_3j1x_x(q*r);
50    last_sld = sld[i];
51    r += thickness[i];
52  }
53  f += M_4PI_3 * cube(r) * (solvent_sld - last_sld) * sas_3j1x_x(q*r);
54  *F1 = 1e-2 * f;
55  *F2 = 1e-4 * f * f;
56}
Note: See TracBrowser for help on using the repository browser.