| 1 | //---------------------------------------------------------------------- |
|---|
| 2 | // Includes |
|---|
| 3 | //---------------------------------------------------------------------- |
|---|
| 4 | #include "Muon_Abragam.h" |
|---|
| 5 | #include <cmath> |
|---|
| 6 | |
|---|
| 7 | namespace Mantid |
|---|
| 8 | { |
|---|
| 9 | namespace CurveFitting |
|---|
| 10 | { |
|---|
| 11 | |
|---|
| 12 | using namespace Kernel; |
|---|
| 13 | using namespace API; |
|---|
| 14 | |
|---|
| 15 | DECLARE_FUNCTION(Muon_Abragam) |
|---|
| 16 | |
|---|
| 17 | void Muon_Abragam::init() |
|---|
| 18 | { |
|---|
| 19 | declareParameter("A", 0.2); |
|---|
| 20 | declareParameter("omiga", 0.5); |
|---|
| 21 | declareParameter("phi", 1); |
|---|
| 22 | declareParameter("sigma", 1); |
|---|
| 23 | declareParameter("tao",1); |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | void Muon_Abragam::functionLocal(double* out, const double* xValues, const int& nData)const |
|---|
| 28 | { |
|---|
| 29 | const double& A = abs(getParameter("A")); |
|---|
| 30 | const double& w = abs(getParameter("omiga")); |
|---|
| 31 | const double& phi = abs(getParameter("phi")); |
|---|
| 32 | const double& sig = abs(getParameter("sigma")); |
|---|
| 33 | const double& t = abs(getParameter("tao")); |
|---|
| 34 | |
|---|
| 35 | for (int i = 0; i < nData; i++) { |
|---|
| 36 | double A1=A*cos(w*xValues[i]+phi); |
|---|
| 37 | double A2=-(sig*sig*t*t)*(exp(-xValues[i]/t)-1+(xValues[i]/t)); |
|---|
| 38 | double A3=exp(A2); |
|---|
| 39 | |
|---|
| 40 | out[i] = A1*A3; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | void Muon_Abragam::functionDerivLocal(API::Jacobian* out, const double* xValues, const int& nData) |
|---|
| 44 | { |
|---|
| 45 | calNumericalDeriv(out, xValues, nData); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | } // namespace CurveFitting |
|---|
| 52 | } // namespace Mantid |
|---|