forked from AmbaPant/mantid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SCgapSwave.py
49 lines (38 loc) · 1.57 KB
/
SCgapSwave.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name, anomalous-backslash-in-string, attribute-defined-outside-init
from mantid.api import IFunction1D, FunctionFactory
import numpy as np
from scipy.constants import k
from scipy.integrate import quad
class SCgapSwave(IFunction1D):
def category(self):
return "Muon\\MuonSpecific"
def init(self):
self.declareParameter("Delta", 1.2, 'Gap Value')
self.declareParameter("Tcritical", 9.0, 'Critical Temperature')
self.addConstraints("Delta >= 0")
self.addConstraints("Tcritical >= 0")
def function1D(self, x):
Ec = 15.0
Delta_0 = self.getParameterValue("Delta")
Tc = self.getParameterValue("Tcritical")
kb = k / (1.6 * 10 ** -22)
Integral = []
def Integrand(E):
DeltaSwave = Delta_0
a = 1.018
c = 1.82
Delta = DeltaSwave * np.tanh(c * (a*Tc / xx - 1.00) ** 0.51)
return 1.00 / np.cosh(np.sqrt((Ec * E) ** 2 + Delta ** 2) / (2 * kb * xx)) ** 2
for xx in x:
if xx > Tc:
Integral.append(1)
else:
Integral.append(quad(Integrand, 0, 1)[0] * Ec / (2 * kb * xx))
return 1.00 - np.array(Integral)
FunctionFactory.subscribe(SCgapSwave)