-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c9083d6
Showing
59 changed files
with
6,421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: c729e624b1d095b2c5341f61d75097ce | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Examples | ||
######## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
Spherical coordinates | ||
##################### | ||
|
||
Spherical coordinate system | ||
=========================== | ||
|
||
.. math:: | ||
x &= r \sin \theta \cos \phi \\ | ||
y &= r \sin \theta \sin \phi \\ | ||
z &= r \cos \theta | ||
where :math:`r \in [0,\infty)`, :math:`\theta \in [0,\pi]` and :math:`\phi \in [0,2\pi)`. | ||
|
||
Furthermore, the volume element is given by | ||
|
||
.. math:: | ||
dV = r^2 \sin \theta dr d\theta d\phi | ||
and the Laplacian is given by | ||
|
||
.. math:: | ||
\nabla^2 &= \frac{1}{r^2} \frac{\partial}{\partial r}\left( r^2 \frac{\partial}{\partial r} \right) + \frac{1}{r^2} \left[\frac{1}{\sin(\theta)}\frac{\partial}{\partial \theta}\left(\sin(\theta) \frac{\partial}{\partial \theta}\right) +\frac{1}{\sin^2(\theta)}\frac{\partial^2}{\partial \phi^2}\right] \\ | ||
&= \frac{1}{r} \frac{\partial^2}{\partial r^2} r - \frac{\hat{L}^2}{r^2} | ||
Wavefunction paramtetrization | ||
============================= | ||
|
||
In spherical coordinates, we parametrize the wavefunction as | ||
|
||
.. math:: | ||
\Psi(\mathbf{r}) = \sum_{l=0}^{l_{max}} \sum_{m=-l}^{l} r^{-1} u_{l,m}(r) Y_{l,m}(\theta, \phi), | ||
where :math:`Y_{l,m}(\theta, \phi)` are the spherical harmonics and :math:`l_{max}` the maximum angular momentum. | ||
|
||
.. math:: | ||
\nabla^2 \Psi(\mathbf{r}) = \sum_{l,m} \frac{1}{r} \left(\frac{d^2 u_{l,m}(r)}{d r^2} - \frac{l(l+1)}{r^2} u_{l,m}(r) \right) Y_{l,m}(\theta, \phi) | ||
The time-independent Schrödinger equation | ||
========================================= | ||
|
||
The time-independent Schrödinger equation | ||
|
||
.. math:: | ||
\left(-\frac{1}{2}\nabla^2 + V(\mathbf{r}) \right) \Psi_k(\mathbf{r}) = E_k \Psi_k(\mathbf{r}), \ \ k=1,2,3,\cdots | ||
For a spherical symmetric potential :math:`V(r)`, the eigenfunctions can be taken as | ||
|
||
.. math:: | ||
\Psi_{n,l,m}(\mathbf{r}) = r^{-1} u_{n,l}(r) Y_{l,m}(\theta, \phi), | ||
and the (radial) TISE becomes | ||
|
||
.. math:: | ||
-\frac{1}{2}\frac{d^2 u_{n,l}(r)}{d r^2}+\frac{l(l+1)}{2 r^2} u_{n,l}(r) + V(r)u_{n,l} = \epsilon_{n,l} u_{n,l}(r). | ||
Gauss-Legendre-Lobatto quadrature is defined on :math:`x \in [-1,1]`. | ||
We need to map the grid/Lobatto points :math:`x_i \in [-1,1]` into radial points :math:`r(x): [-1,1] \rightarrow [0, r_{\text{max}}]`. | ||
In that case, :math:`\psi(r) = \psi(r(x))`. | ||
|
||
The (rational) mapping | ||
|
||
.. math:: | ||
r(x) = L \frac{1+x}{1-x+\alpha}, \ \ \alpha = \frac{2L}{r_{\text{max}}} \label{x_to_r}, | ||
has often been used in earlier work. | ||
The parameters :math:`L` and :math:`\alpha` control the length of the grid and the density of points near :math:`r=0`. | ||
|
||
Another option is to use the linear mapping given by | ||
|
||
.. math:: | ||
r(x) = \frac{r_{\text{max}}(x+1)}{2}. | ||
In order to use the Gauss-Legendre-Lobatto pseudospectral method, we must first formulate | ||
the radial TISE with respecto to :math:`x`. | ||
|
||
By the chain rule we find | ||
|
||
.. math:: | ||
\frac{d \psi}{dr} &= \frac{1}{\dot{r}(x)} \frac{d \psi}{dx}, \\ | ||
\frac{d^2 \psi}{dr^2} &= \frac{1}{\dot{r}(x)^2} \frac{d^2 \psi}{dx^2} - \frac{\ddot{r}(x)}{\dot{r}(x)^3} \frac{d \psi}{dx}, | ||
and the radial TISE becomes | ||
|
||
.. math:: | ||
:name: eq:unsymmetric_radial_TISE | ||
-\frac{1}{2} \left( \frac{1}{\dot{r}(x)^2} \frac{d^2 \psi}{dx^2} - \frac{\ddot{r}(x)}{\dot{r}(x)^3} \frac{d \psi}{dx} \right) + V_l(r(x)) \psi(r(x)) = \epsilon \psi(r(x)), | ||
where we have defined :math:`V_l(r(x)) \equiv V(r(x)) + \frac{l(l+1)}{2 r(x)^2}`. Note that this is, in general, an unsymmetric eigenvalue problem | ||
due to the presence of the term :math:`\frac{\ddot{r}(x)}{\dot{r}(x)^3}`. | ||
|
||
In order to reformulate the above as a symmetric eigenvalue problem, we define the new wavefunction :math:`f(x) = \dot{r}(x)^{1/2} \psi(r(x))`. | ||
Insertion of this into Eq. :ref:`Link title <eq:unsymmetric_radial_TISE>` yields | ||
|
||
.. math:: | ||
\left(-\frac{1}{2} \frac{1}{\dot{r}(x)} \frac{d^2}{dx^2} \frac{1}{\dot{r}(x)} + V_l(r(x))+\tilde{V}(r(x)) \right) f(x) = \epsilon f(x), | ||
:label: symmetric_radial_TISE | ||
where we have introduced the new potential :math:`\tilde{V}(x) \equiv \frac{2\dddot{r}(x)\dot{r}(x)-3\ddot{r}(x)^2}{4\dot{r}(x)^4}`. | ||
|
||
We discretize this equation with the pseudospectral method by expanding :math:`f(x)` and :math:`f(x)/\dot{r}(x)` as | ||
|
||
.. math:: | ||
f(x) &= \sum_{j=0}^N f(x_j) g_j(x), \\ | ||
\frac{f(x)}{\dot{r}(x)} &= \sum_{j=0}^N \frac{f(x_j)}{\dot{r}(x_j)} g_j(x). | ||
Inserting these expansions into Eq. :math:ref:`symmetric_radial_TISE` we have that | ||
|
||
.. math:: | ||
\sum_{j=0}^N \left(-\frac{1}{2} \frac{1}{\dot{r}(x)} \frac{f(x_j)}{\dot{r}(x_j)} g^{\prime \prime}_j(x) + V(r(x)) f(x_j) g_j(x) \right) = \epsilon \sum_{j=0}^N f(x_j) g_j(x) | ||
Next, we multiply through with :math:`g_i(x)` and integrate over :math:`x`, | ||
|
||
.. math:: | ||
\sum_{j=0}^N \left(-\frac{1}{2} \frac{f(x_j)}{\dot{r}(x_j)} \int \frac{g_i(x)}{\dot{r}(x)} g^{\prime \prime}_j(x) dx + f(x_j) \int g_i(x) V(r(x)) g_j(x) dx \right) = \epsilon \sum_{j=0}^N f(x_j) \int g_i(x) g_j(x) dx | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Theory | ||
###### | ||
|
||
The pseudospectral method | ||
========================= | ||
In the pseudospectral method a function :math:`f(x)` is approximated as a linear combination | ||
|
||
.. math:: | ||
f(x) \simeq f_N(x) = \sum_{j=0}^N f(x_j) g_j(x) | ||
of cardinal functions :math:`g_j(x)` where the expansion coefficients are values of | ||
:math:`f(x)` at the grid points :math:`x_j`. For Lobatto-type grids, the interior grid points | ||
:math:`\{ x_j \}_{j=1}^{N-1}` are defined as the zeros of :math:`P_N^\prime(x)`, where :math:`P_N(x)` is a | ||
:math:`N`-th order polynomial [#f1]_, | ||
|
||
.. math:: | ||
P_N^\prime(x_j) = 0, \ \ j=1,\cdots,N-1, | ||
while the end (boundary) points :math:`x_0` and :math:`x_N` are given. | ||
|
||
The cardinal functions :math:`g_j(x)` have the property that | ||
|
||
.. math:: | ||
g_j(x_i) = \delta_{ij}, \label{delta_property_g} | ||
and can be written as | ||
|
||
.. math:: | ||
g_j(x) = -\frac{1}{N(N+1)P_N(x_j)}\frac{(1-x^2)P_N^\prime(x)}{x-x_j}. | ||
The integral of a function is approximated by quadrature | ||
|
||
.. math:: | ||
\int_{x_0}^{x_N} f(x) dx \simeq \sum_{j=0}^N w_j f(x_j), \label{quadrature_rule} | ||
where :math:`w_j` are the quadrature weights. | ||
|
||
.. rubric:: Footnotes | ||
|
||
.. [#f1] Which type of polynomial to choose depends on the problem. Examples include Chebyshev, Legendre, Laguerre or Hermite polynomials. | ||
Gauss-Legendre-Lobatto | ||
======================= | ||
|
||
In the Gauss-Legendre-Lobatto pseudospectral method, :math:`P_N(x)` is taken as the :math:`N`-th | ||
order Legendre polynomial. The end points are :math:`x_0 = -1` and :math:`x_N=1`, while the interior | ||
grid points must be found as the roots | ||
|
||
.. math:: | ||
P_N^\prime(x_i) = 0, | ||
and the quadrature weights are given by | ||
|
||
.. math:: | ||
w_i = \frac{2}{N(N+1)P_N(x_i)^2}. | ||
The grid points and weights can be determined using numpy functions (REF). | ||
Furthermore, | ||
|
||
.. math:: | ||
\frac{d g_j}{dx} \Bigr|_{x=x_i} &= g_j^\prime(x_i) = \tilde{g}_j^\prime(x_i) \frac{P_N(x_i)}{P_N(x_j)}, \\ | ||
\tilde{g}_j(x_i) &= | ||
\begin{cases} | ||
\frac{1}{4}N(N+1), \ \ i=j=0, \\ | ||
-\frac{1}{4}N(N+1), \ \ i=j=N, \\ | ||
0, \ \ i=j \text{ and } 1 \leq j \leq N-1, \\ | ||
\frac{1}{x_i-x_j}, \ \ i \neq j, | ||
\end{cases} | ||
and for :math:`i,j = 1,\cdots,N-1` | ||
|
||
.. math:: | ||
\frac{d^2 g_j}{dx^2} \Bigr|_{x=x_i} &= g_j^{\prime \prime}(x_i) = \tilde{g}_j^{\prime \prime}(x_i) \frac{P_N(x_i)}{P_N(x_j)}, \\ | ||
\tilde{g}_j^{\prime \prime}(x_i) &= | ||
\begin{cases} | ||
-\frac{1}{3} \frac{N(N+1)}{(1-x_i^2)}, & i = j,\\ | ||
-\frac{2}{(x_i-x_j)^2}, & i \neq j. | ||
\end{cases} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. Test documentation master file, created by | ||
sphinx-quickstart on Thu Feb 29 14:38:30 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Pseudospectral TDSE documentation | ||
================================= | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
||
.. Contents | ||
.. ======== | ||
.. toctree:: | ||
:maxdepth: 2 | ||
:numbered: | ||
:hidden: | ||
:caption: Examples | ||
|
||
./doc_pages/examples | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:numbered: | ||
:hidden: | ||
:caption: Theory | ||
|
||
./doc_pages/theory | ||
./doc_pages/spherical_coordinates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* Compatability shim for jQuery and underscores.js. | ||
* | ||
* Copyright Sphinx contributors | ||
* Released under the two clause BSD licence | ||
*/ | ||
|
||
/** | ||
* small helper function to urldecode strings | ||
* | ||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL | ||
*/ | ||
jQuery.urldecode = function(x) { | ||
if (!x) { | ||
return x | ||
} | ||
return decodeURIComponent(x.replace(/\+/g, ' ')); | ||
}; | ||
|
||
/** | ||
* small helper function to urlencode strings | ||
*/ | ||
jQuery.urlencode = encodeURIComponent; | ||
|
||
/** | ||
* This function returns the parsed url parameters of the | ||
* current request. Multiple values per key are supported, | ||
* it will always return arrays of strings for the value parts. | ||
*/ | ||
jQuery.getQueryParameters = function(s) { | ||
if (typeof s === 'undefined') | ||
s = document.location.search; | ||
var parts = s.substr(s.indexOf('?') + 1).split('&'); | ||
var result = {}; | ||
for (var i = 0; i < parts.length; i++) { | ||
var tmp = parts[i].split('=', 2); | ||
var key = jQuery.urldecode(tmp[0]); | ||
var value = jQuery.urldecode(tmp[1]); | ||
if (key in result) | ||
result[key].push(value); | ||
else | ||
result[key] = [value]; | ||
} | ||
return result; | ||
}; | ||
|
||
/** | ||
* highlight a given string on a jquery object by wrapping it in | ||
* span elements with the given class name. | ||
*/ | ||
jQuery.fn.highlightText = function(text, className) { | ||
function highlight(node, addItems) { | ||
if (node.nodeType === 3) { | ||
var val = node.nodeValue; | ||
var pos = val.toLowerCase().indexOf(text); | ||
if (pos >= 0 && | ||
!jQuery(node.parentNode).hasClass(className) && | ||
!jQuery(node.parentNode).hasClass("nohighlight")) { | ||
var span; | ||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); | ||
if (isInSVG) { | ||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); | ||
} else { | ||
span = document.createElement("span"); | ||
span.className = className; | ||
} | ||
span.appendChild(document.createTextNode(val.substr(pos, text.length))); | ||
node.parentNode.insertBefore(span, node.parentNode.insertBefore( | ||
document.createTextNode(val.substr(pos + text.length)), | ||
node.nextSibling)); | ||
node.nodeValue = val.substr(0, pos); | ||
if (isInSVG) { | ||
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); | ||
var bbox = node.parentElement.getBBox(); | ||
rect.x.baseVal.value = bbox.x; | ||
rect.y.baseVal.value = bbox.y; | ||
rect.width.baseVal.value = bbox.width; | ||
rect.height.baseVal.value = bbox.height; | ||
rect.setAttribute('class', className); | ||
addItems.push({ | ||
"parent": node.parentNode, | ||
"target": rect}); | ||
} | ||
} | ||
} | ||
else if (!jQuery(node).is("button, select, textarea")) { | ||
jQuery.each(node.childNodes, function() { | ||
highlight(this, addItems); | ||
}); | ||
} | ||
} | ||
var addItems = []; | ||
var result = this.each(function() { | ||
highlight(this, addItems); | ||
}); | ||
for (var i = 0; i < addItems.length; ++i) { | ||
jQuery(addItems[i].parent).before(addItems[i].target); | ||
} | ||
return result; | ||
}; | ||
|
||
/* | ||
* backward compatibility for jQuery.browser | ||
* This will be supported until firefox bug is fixed. | ||
*/ | ||
if (!jQuery.browser) { | ||
jQuery.uaMatch = function(ua) { | ||
ua = ua.toLowerCase(); | ||
|
||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || | ||
/(webkit)[ \/]([\w.]+)/.exec(ua) || | ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || | ||
/(msie) ([\w.]+)/.exec(ua) || | ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || | ||
[]; | ||
|
||
return { | ||
browser: match[ 1 ] || "", | ||
version: match[ 2 ] || "0" | ||
}; | ||
}; | ||
jQuery.browser = {}; | ||
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; | ||
} |
Oops, something went wrong.