Delta Lorentz¶
Model of Delta function and Lorentzian with intensities given by the Debye-Waller factor:
$ I = K \exp \left( \frac{-\langle u^2 \rangle Q^2}{3} \right)[A_0 \delta(E) + A_1 L(E, \Gamma)] $,
where $K$ is the scale factor, $\langle u^2 \rangle$ is the mean square displacement, $Q$ is the scattering vector, $A_0$ and $A_1$ are the relative amplitudes of the delta function and Lorentzian, respectively, with the constraint that $A_0+A_1=1$, and $L(E, \Gamma)$ is the Lorentzian function with width $\Gamma$. $A_0$, $A_1$ and the width of the Lorentzian can be the same at all $Q$ or be allowed to vary with $Q$.
In [1]:
Copied!
import matplotlib.pyplot as plt
import numpy as np
from easydynamics.sample_model.diffusion_model.delta_lorentz import DeltaLorentz
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
from easydynamics.sample_model.diffusion_model.delta_lorentz import DeltaLorentz
%matplotlib widget
In [2]:
Copied!
Q = np.linspace(0.5, 2, 7)
energy = np.linspace(-2, 2, 501)
scale = 1.0
mean_u_squared = 0.5
A_0 = 0.2
lorentzian_width = 0.2
diffusion_model = DeltaLorentz(
scale=scale,
mean_u_squared=mean_u_squared,
A_0=A_0,
lorentzian_width=lorentzian_width,
allow_Q_variation={'A_0': True, 'lorentzian_width': True},
Q=Q,
lorentzian_name='Lorentzian',
delta_name='Delta function',
)
Q = np.linspace(0.5, 2, 7)
energy = np.linspace(-2, 2, 501)
scale = 1.0
mean_u_squared = 0.5
A_0 = 0.2
lorentzian_width = 0.2
diffusion_model = DeltaLorentz(
scale=scale,
mean_u_squared=mean_u_squared,
A_0=A_0,
lorentzian_width=lorentzian_width,
allow_Q_variation={'A_0': True, 'lorentzian_width': True},
Q=Q,
lorentzian_name='Lorentzian',
delta_name='Delta function',
)
In [3]:
Copied!
component_collections = diffusion_model.get_component_collections()
cmap = plt.cm.jet
nQ = len(component_collections)
plt.figure()
for Q_index in range(len(component_collections)):
color = cmap(Q_index / (nQ - 1))
y = component_collections[Q_index].evaluate(energy)
plt.plot(energy, y, label=f'Q={Q[Q_index]} Å^-1', color=color)
plt.legend()
plt.show()
plt.xlabel('Energy (meV)')
plt.ylabel('Intensity (arb. units)')
plt.title('Delta-Lorentz Model')
component_collections = diffusion_model.get_component_collections()
cmap = plt.cm.jet
nQ = len(component_collections)
plt.figure()
for Q_index in range(len(component_collections)):
color = cmap(Q_index / (nQ - 1))
y = component_collections[Q_index].evaluate(energy)
plt.plot(energy, y, label=f'Q={Q[Q_index]} Å^-1', color=color)
plt.legend()
plt.show()
plt.xlabel('Energy (meV)')
plt.ylabel('Intensity (arb. units)')
plt.title('Delta-Lorentz Model')
Out[3]:
Text(0.5, 1.0, 'Delta-Lorentz Model')
In [4]:
Copied!
diffusion_model.get_all_variables()
diffusion_model.get_all_variables()
Out[4]:
[<Parameter 'scale': 1.0000 meV, bounds=[0.0:inf]>, <Parameter 'mean_u_squared': 0.5000 Å^2, bounds=[0.0:inf]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_0': 0.2000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'A_1': 0.8000, bounds=[0.0:1.0]>, <Parameter 'Lorentzian area': 0.7674 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1918 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.7284 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1821 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.6772 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1693 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.6166 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1541 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.5498 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1375 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.4802 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1200 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian area': 0.4107 meV, bounds=[0.0:inf]>, <Parameter 'Lorentzian center': 0.0000 meV (fixed), bounds=[-inf:inf]>, <Parameter 'Lorentzian width': 0.2000 meV, bounds=[1e-10:inf]>, <Parameter 'Delta function area': 0.1027 meV, bounds=[0.0:inf]>, <Parameter 'Delta function center': 0.0000 meV (fixed), bounds=[-inf:inf]>]