[82c11d3] | 1 | /** |
---|
| 2 | This software was developed by the University of Tennessee as part of the |
---|
| 3 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 4 | project funded by the US National Science Foundation. |
---|
| 5 | |
---|
| 6 | If you use DANSE applications to do scientific research that leads to |
---|
| 7 | publication, we ask that you acknowledge the use of the software with the |
---|
| 8 | following sentence: |
---|
| 9 | |
---|
| 10 | "This work benefited from DANSE software developed under NSF award DMR-0520547." |
---|
| 11 | |
---|
| 12 | copyright 2008, University of Tennessee |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <math.h> |
---|
| 16 | #include "parameters.hh" |
---|
| 17 | #include <stdio.h> |
---|
| 18 | using namespace std; |
---|
| 19 | #include "lorentzian.h" |
---|
| 20 | |
---|
| 21 | Lorentzian :: Lorentzian() { |
---|
| 22 | scale = Parameter(1.0, true); |
---|
| 23 | gamma = Parameter(1.0, true); |
---|
| 24 | center = Parameter(0.0, true); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * Function to evaluate 1D scattering function |
---|
[101065a] | 29 | * @param q: q-value |
---|
[82c11d3] | 30 | * @return: function value |
---|
| 31 | */ |
---|
| 32 | double Lorentzian :: operator()(double q) { |
---|
| 33 | double delta2 = pow( (q-center()), 2); |
---|
| 34 | return scale() / acos(-1.0) * 0.5*gamma() / |
---|
[101065a] | 35 | (delta2 + 0.25*gamma()*gamma()); |
---|
[82c11d3] | 36 | } |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * Function to evaluate 2D scattering function |
---|
| 40 | * @param q_x: value of Q along x |
---|
| 41 | * @param q_y: value of Q along y |
---|
| 42 | * @return: function value |
---|
| 43 | */ |
---|
| 44 | double Lorentzian :: operator()(double qx, double qy) { |
---|
| 45 | return (*this).operator()(qx) * (*this).operator()(qy); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | /** |
---|
| 49 | * Function to evaluate 2D scattering function |
---|
| 50 | * @param q: q-value |
---|
| 51 | * @param phi: angle phi |
---|
| 52 | * @return: function value |
---|
| 53 | */ |
---|
| 54 | double Lorentzian :: evaluate_rphi(double q, double phi) { |
---|
| 55 | double qx = q*cos(phi); |
---|
| 56 | double qy = q*sin(phi); |
---|
| 57 | return (*this).operator()(qx, qy); |
---|
| 58 | } |
---|
| 59 | /** |
---|
| 60 | * Function to calculate effective radius |
---|
| 61 | * @return: effective radius value |
---|
| 62 | */ |
---|
| 63 | double Lorentzian :: calculate_ER() { |
---|
| 64 | //NOT implemented yet!!! |
---|
| 65 | return 0.0; |
---|
| 66 | } |
---|
[e08bd5b] | 67 | double Lorentzian :: calculate_VR() { |
---|
| 68 | return 1.0; |
---|
| 69 | } |
---|