source: sasview/src/sas/models/c_extension/c_models/starpolymer.cpp @ 7a04dbb

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 7a04dbb was 79492222, checked in by krzywon, 10 years ago

Changed the file and folder names to remove all SANS references.

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[230f479]1/**
2        This software was developed by Institut Laue-Langevin as part of
3        Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
4
5        Copyright 2012 Institut Laue-Langevin
6
7**/
8
9#include <math.h>
10#include "parameters.hh"
11#include "starpolymer.h"
12
13StarPolymer::StarPolymer() {
14 
15  arms = Parameter(3.0);
16  R2 = Parameter(100.0);
17  scale = Parameter(1.0);
18  background = Parameter(0.0);
19
20}
21
22double StarPolymer::operator()(double q) {
23
24  double d_arms = arms();
25  double d_R2 = R2();
26  double d_scale = scale();
27  double d_background = background();
28
29  double u_2 = d_R2 * pow(q,2);
30  double v = u_2 * d_arms / (3.0 * d_arms - 2.0);
31
32  double term1 = v - 1.0 + exp(-v);
33  double term2 = ((d_arms - 1.0)/2.0)* pow((1.0 - exp(-v)),2.0);
34
35  return 2.0 * d_scale / (d_arms * pow(v,2.0)) * (term1 + term2) + d_background;
36
37}
38
39double StarPolymer::operator()(double qx, double qy) {
40  double q = sqrt(qx*qx + qy*qy);
41  return this->operator()(q);
42}
43
44double StarPolymer::calculate_ER() {
45  // not implemented yet
46  return 0.0;
47}
48
49double StarPolymer::calculate_VR() {
50  return 1.0;
51}
52
53double StarPolymer::evaluate_rphi(double q, double phi) {
54  double qx = q * cos(phi);
55  double qy = q * sin(phi);
56  return this->operator()(qx, qy);
57}
58
59
Note: See TracBrowser for help on using the repository browser.