Skip to content

Commit

Permalink
add function dipbackground
Browse files Browse the repository at this point in the history
  • Loading branch information
stestoll committed May 17, 2024
1 parent 45bd7a1 commit bd7d606
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 1 deletion.
85 changes: 85 additions & 0 deletions docsrc/dipbackground.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" href="img/eslogo196.png">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="highlight/matlab.css">
<script src="highlight/highlight.min.js"></script>
<script src="highlight/do_highlight.js"></script>
<title>dipkernel</title>
</head>

<body>

<header>
<ul>
<li><img src="img/eslogo42.png">
<li class="header-title">EasySpin
<li><a href="index.html">Documentation</a>
<li><a href="references.html">Publications</a>
<li><a href="http://easyspin.org" target="_blank">Website</a>
<li><a href="http://easyspin.org/academy" target="_blank">Academy</a>
<li><a href="http://easyspin.org/forum" target="_blank">Forum</a>
</ul>
</header>

<section>

<div class="functitle">dipbackground</div>

<p>
Calculate dipolar EPR (DEER) background signal.
</p>

<!-- =================================================================== -->
<div class="subtitle">Syntax</div>

<pre class="matlab">
Vinter = dipbackground(t,conc,lambda)
dipbackground(...)
</pre>

<!-- =================================================================== -->
<div class="subtitle">Description</div>W

<p>
<code>dipbackground</code> calculates the inter-molecular DEER signal for a homogeneous three-dimensional distribution of spins.
</p>

<p>
<code>t</code> is the time vector, in microseconds. <code>conc</code> is the spin concentration, in micromolar (µM). <code>lambda</code> is the modulation depth, between 0 and 1.
</p>

<p>
The output <code>Vinter</code> is the inter-molecular dipolar background decay function, scaled such that it is equal to 1 at time zero.
</p>

<!-- ========================================================== -->
<div class="subtitle">Examples</div>

<p>
Here is a typical application, for a 50 µM spin concentration and a modulation depth of 0.3:
</p>

<pre class="matlab">
t = -0.2:0.020:5; % µs
Vinter = dipbackground(t,100,0.3);
plot(t,Vinter)
</pre>

<!-- =================================================================== -->
<div class="subtitle">See also</div>
<p>
<a class="esf" href="dipkernel.html">dipkernel</a>,
<a class="esf" href="diptensor.html">diptensor</a>,
<a class="esf" href="ham_ee.html">ham_ee</a>
</p>

<hr>
</section>

<footer></footer>

</body>
</html>
3 changes: 2 additions & 1 deletion docsrc/funcsalphabet.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
<tr><td><a href="datasmooth.html">datasmooth</a></td><td>Moving averages: smoothing and differentiation</td></tr>
<tr><td><a href="degree.html">degree</a></td><td>Conversion between radians and degrees</td></tr>
<tr><td><a href="deriv.html">deriv</a></td><td>Numerical differentiation</td></tr>
<tr><td><a href="dipbackground.html">dipbackground</a></td><td>Dipolar EPR background signal (DEER)</td></tr>
<tr><td><a href="dipkernel.html">dipkernel</a></td><td>Dipolar EPR signal (DEER)</td></tr>
<tr><td><a href="diptensor.html">diptensor</a></td><td>Dipolar tensors</td></tr>
<tr><td><a href="diptensor.html">diptensor</a></td><td>Dipolar interaction tensor</td></tr>
<tr><td><a href="easyspin.html">easyspin</a></td><td>Information and tasks regarding EasySpin</td></tr>
<tr><td><a href="echarge.html">echarge</a></td><td>Elementary electric charge</td></tr>
<tr><td><a href="emass.html">emass</a></td><td>Mass of electron</td></tr>
Expand Down
6 changes: 6 additions & 0 deletions docsrc/funcscategory.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<tr><td><a href="dipkernel.html">dipkernel</a></td><td>Dipolar EPR signal (DEER)</td></tr>
<tr><td><a href="photoselect.html">photoselect</a></td><td>Photoselection weights</td></tr>

<tr><td>&nbsp;</td></tr>
<tr><td colspan="2" class="grouptitle">Dipolar EPR</td></tr>
<tr><td><a href="dipbackground.html">dipbackground</a></td><td>Dipolar EPR background signal (DEER)</td></tr>
<tr><td><a href="dipkernel.html">dipkernel</a></td><td>Dipolar EPR signal (DEER)</td></tr>
<tr><td><a href="diptensor.html">diptensor</a></td><td>Dipolar interaction tensor</td></tr>

<tr><td>&nbsp;</td></tr>
<tr><td colspan="2" class="grouptitle">Stochastic simulations</td></tr>

Expand Down
17 changes: 17 additions & 0 deletions docsrc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ <h1>Changes from release to release</h1>
$ReleaseID$
</div>

<p>Major new features</p>
<ul>
<li>New function <a class="esf" href="dipbackground">dipbackground</a> calculates background decays for dipolar EPR (DEER etc.)</li>
</ul>

<p>Major bug fixes</p>
<ul>
</ul>

<p>Incompatible changes</p>
<ul>
</ul>

<div class="subtitle">
6.0
</div>

<p>Major new features</p>
<ul>
<li>Major overhaul of <a class="esf" href="esfit.html">esfit</a>, it now calculates uncertainties of fitted parameters as well as correlations.</li>
Expand Down
47 changes: 47 additions & 0 deletions easyspin/dipbackground.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
% dipbackground Intermolecular dipolar background decay
%
% Vinter = dipbackground(t,conc,lambda)
% dipbackground(...)
%
% Calculates the intermolecular dipolar background decay over the time axis,
% for spin concentration conc (in µM) and modulation depth lambda (between 0 and 1).
%
% Input:
% t time axis (µs)
% conc spin concentration (µM)
% lambda modulation depth
%
% Output:
% Vinter intermolecular background decay function
%
% Example:
% t = linspace(-0.2,5); % µs
% Vinter = dipbackground(t,100,0.3);
% plot(t,Vinter);

function Vinter = dipbackground(t,conc_uM,lambda)

if nargin==0
help(mfilename);
return
end

g1 = gfree;
g2 = gfree;

D = mu0/(4*pi)*g1*g2*bmagn^2/hbar; % rad/s
conc_mM = conc_uM/1e3; % µM -> mM=mol/m^3
conc = conc_mM*avogadro; % mM=mol/m^3 -> m^-3
t = t*1e-6; % µs -> s
k = 8*pi^2/(9*sqrt(3))*D*conc*lambda;
Vinter = exp(-k*abs(t));

% Plotting
if nargout==0
plot(t/1e-6,Vinter)
xlabel('time (µs)')
ylabel('{\it{V}}_{inter}')
grid on
end

end
18 changes: 18 additions & 0 deletions tests/dipbackground_explicit.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function ok = test()

t_us = 1.1; % µs
conc_uM = 100; % µM
lambda = 0.7;

c_mM = conc_uM/1e3; % µM -> mM=mol/m^3
c = c_mM*avogadro; % mol/m^3 -> m^-3

g = gfree;
D = mu0/(4*pi)*g^2*bmagn^2/hbar; % rad/s
k = 8*pi^2/(9*sqrt(3))*D*lambda*c;
Vinter_ref = exp(-k*t_us*1e-6);
Vinter = dipbackground(t_us,conc_uM,lambda);

ok = areequal(Vinter,Vinter_ref,1e-10,'rel');

end

0 comments on commit bd7d606

Please sign in to comment.