diff --git a/doc/HandWrittenNotes/2024/NotesFebruary9.pdf b/doc/HandWrittenNotes/2024/NotesFebruary9.pdf new file mode 100644 index 00000000..ba2b2b2e Binary files /dev/null and b/doc/HandWrittenNotes/2024/NotesFebruary9.pdf differ diff --git a/doc/pub/week4/ipynb/week4.ipynb b/doc/pub/week4/ipynb/week4.ipynb index 4cd7b633..c63e28ad 100644 --- a/doc/pub/week4/ipynb/week4.ipynb +++ b/doc/pub/week4/ipynb/week4.ipynb @@ -3,9 +3,7 @@ { "cell_type": "markdown", "id": "ce64a9f7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "\n", @@ -15,9 +13,7 @@ { "cell_type": "markdown", "id": "dabd2f3d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "# Week 6: Importance Sampling and Metropolis-Hastings' algorithm\n", "**Morten Hjorth-Jensen Email morten.hjorth-jensen@fys.uio.no**, Department of Physics and Center fo Computing in Science Education, University of Oslo, Oslo, Norway and Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, East Lansing, Michigan, USA\n", @@ -28,9 +24,7 @@ { "cell_type": "markdown", "id": "8e9af184", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Overview of week 6, February 5-9, 2024\n", "**Topics.**\n", @@ -51,9 +45,7 @@ { "cell_type": "markdown", "id": "a3804f2a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling and overview of what needs to be coded, reminder from last week\n", "\n", @@ -64,9 +56,7 @@ { "cell_type": "markdown", "id": "f87b1a38", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial P}{\\partial t} = D\\frac{\\partial }{\\partial x}\\left(\\frac{\\partial }{\\partial x} -F\\right)P(x,t),\n", @@ -76,9 +66,7 @@ { "cell_type": "markdown", "id": "2ff1271c", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where $F$ is a drift term and $D$ is the diffusion coefficient." ] @@ -86,9 +74,7 @@ { "cell_type": "markdown", "id": "2db37bad", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling\n", "The new positions in coordinate space are given as the solutions of the Langevin equation using Euler's method, namely,\n", @@ -98,9 +84,7 @@ { "cell_type": "markdown", "id": "c320fc8a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial x(t)}{\\partial t} = DF(x(t)) +\\eta,\n", @@ -110,9 +94,7 @@ { "cell_type": "markdown", "id": "8fa30830", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "with $\\eta$ a random variable,\n", "yielding a new position" @@ -121,9 +103,7 @@ { "cell_type": "markdown", "id": "b9c42fba", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "y = x+DF(x)\\Delta t +\\xi\\sqrt{\\Delta t},\n", @@ -133,9 +113,7 @@ { "cell_type": "markdown", "id": "ccb6df0f", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where $\\xi$ is gaussian random variable and $\\Delta t$ is a chosen time step. \n", "The quantity $D$ is, in atomic units, equal to $1/2$ and comes from the factor $1/2$ in the kinetic energy operator. Note that $\\Delta t$ is to be viewed as a parameter. Values of $\\Delta t \\in [0.001,0.01]$ yield in general rather stable values of the ground state energy." @@ -144,9 +122,7 @@ { "cell_type": "markdown", "id": "ae927137", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling\n", "The process of isotropic diffusion characterized by a time-dependent probability density $P(\\mathbf{x},t)$ obeys (as an approximation) the so-called Fokker-Planck equation" @@ -155,9 +131,7 @@ { "cell_type": "markdown", "id": "89b696ea", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial P}{\\partial t} = \\sum_i D\\frac{\\partial }{\\partial \\mathbf{x_i}}\\left(\\frac{\\partial }{\\partial \\mathbf{x_i}} -\\mathbf{F_i}\\right)P(\\mathbf{x},t),\n", @@ -167,9 +141,7 @@ { "cell_type": "markdown", "id": "11eba608", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where $\\mathbf{F_i}$ is the $i^{th}$ component of the drift term (drift velocity) caused by an external potential, and $D$ is the diffusion coefficient. The convergence to a stationary probability density can be obtained by setting the left hand side to zero. The resulting equation will be satisfied if and only if all the terms of the sum are equal zero," ] @@ -177,9 +149,7 @@ { "cell_type": "markdown", "id": "7f809761", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial^2 P}{\\partial {\\mathbf{x_i}^2}} = P\\frac{\\partial}{\\partial {\\mathbf{x_i}}}\\mathbf{F_i} + \\mathbf{F_i}\\frac{\\partial}{\\partial {\\mathbf{x_i}}}P.\n", @@ -189,9 +159,7 @@ { "cell_type": "markdown", "id": "7f5694e7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling\n", "The drift vector should be of the form $\\mathbf{F} = g(\\mathbf{x}) \\frac{\\partial P}{\\partial \\mathbf{x}}$. Then," @@ -200,9 +168,7 @@ { "cell_type": "markdown", "id": "38df8785", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial^2 P}{\\partial {\\mathbf{x_i}^2}} = P\\frac{\\partial g}{\\partial P}\\left( \\frac{\\partial P}{\\partial {\\mathbf{x}_i}} \\right)^2 + P g \\frac{\\partial ^2 P}{\\partial {\\mathbf{x}_i^2}} + g \\left( \\frac{\\partial P}{\\partial {\\mathbf{x}_i}} \\right)^2.\n", @@ -212,9 +178,7 @@ { "cell_type": "markdown", "id": "d7960a46", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "The condition of stationary density means that the left hand side equals zero. In other words, the terms containing first and second derivatives have to cancel each other. It is possible only if $g = \\frac{1}{P}$, which yields" ] @@ -222,9 +186,7 @@ { "cell_type": "markdown", "id": "db0508c4", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\mathbf{F} = 2\\frac{1}{\\Psi_T}\\nabla\\Psi_T,\n", @@ -234,9 +196,7 @@ { "cell_type": "markdown", "id": "e13452f5", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "which is known as the so-called *quantum force*. This term is responsible for pushing the walker towards regions of configuration space where the trial wave function is large, increasing the efficiency of the simulation in contrast to the Metropolis algorithm where the walker has the same probability of moving in every direction." ] @@ -244,9 +204,7 @@ { "cell_type": "markdown", "id": "dabf4d7b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling\n", "The Fokker-Planck equation yields a (the solution to the equation) transition probability given by the Green's function" @@ -255,9 +213,7 @@ { "cell_type": "markdown", "id": "55040417", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "G(y,x,\\Delta t) = \\frac{1}{(4\\pi D\\Delta t)^{3N/2}} \\exp{\\left(-(y-x-D\\Delta t F(x))^2/4D\\Delta t\\right)}\n", @@ -267,9 +223,7 @@ { "cell_type": "markdown", "id": "ff312f3b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "which in turn means that our brute force Metropolis algorithm" ] @@ -277,9 +231,7 @@ { "cell_type": "markdown", "id": "2a28ac22", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "A(y,x) = \\mathrm{min}(1,q(y,x))),\n", @@ -289,9 +241,7 @@ { "cell_type": "markdown", "id": "7d3a69db", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "with $q(y,x) = |\\Psi_T(y)|^2/|\\Psi_T(x)|^2$ is now replaced by the [Metropolis-Hastings algorithm](http://scitation.aip.org/content/aip/journal/jcp/21/6/10.1063/1.1699114) as well as [Hasting's article](http://biomet.oxfordjournals.org/content/57/1/97.abstract)," ] @@ -299,9 +249,7 @@ { "cell_type": "markdown", "id": "0067790a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "q(y,x) = \\frac{G(x,y,\\Delta t)|\\Psi_T(y)|^2}{G(y,x,\\Delta t)|\\Psi_T(x)|^2}\n", @@ -311,9 +259,7 @@ { "cell_type": "markdown", "id": "770cc9c6", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Code example for the interacting case with importance sampling\n", "\n", @@ -324,10 +270,7 @@ "cell_type": "code", "execution_count": 1, "id": "38f242bb", - "metadata": { - "collapsed": false, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "# Common imports\n", @@ -362,9 +305,7 @@ { "cell_type": "markdown", "id": "1739b4fb", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "we move on to the set up of the trial wave function, the analytical expression for the local energy and the analytical expression for the quantum force." ] @@ -373,10 +314,7 @@ "cell_type": "code", "execution_count": 2, "id": "f068a564", - "metadata": { - "collapsed": false, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", @@ -427,9 +365,7 @@ { "cell_type": "markdown", "id": "d140a0b6", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "The Monte Carlo sampling includes now the Metropolis-Hastings algorithm, with the additional complication of having to evaluate the **quantum force** and the Green's function which is the solution of the Fokker-Planck equation." ] @@ -438,10 +374,7 @@ "cell_type": "code", "execution_count": 3, "id": "d692717a", - "metadata": { - "collapsed": false, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "# The Monte Carlo sampling with the Metropolis algo\n", @@ -520,9 +453,7 @@ { "cell_type": "markdown", "id": "b56d1285", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "The main part here contains the setup of the variational parameters, the energies and the variance." ] @@ -531,10 +462,7 @@ "cell_type": "code", "execution_count": 4, "id": "5fe47d5a", - "metadata": { - "collapsed": false, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "#Here starts the main program with variable declarations\n", @@ -570,9 +498,7 @@ { "cell_type": "markdown", "id": "38f11438", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -592,9 +518,7 @@ { "cell_type": "markdown", "id": "9b6ae1e9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -607,9 +531,7 @@ { "cell_type": "markdown", "id": "12eb4d17", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "Y_X (t) = f(X, t).\n", @@ -619,9 +541,7 @@ { "cell_type": "markdown", "id": "26e92505", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "The quantity $Y_X (t)$ is called a random function,\n", "or, since $t$ often is time, a stochastic process. A stochastic\n", @@ -633,9 +553,7 @@ { "cell_type": "markdown", "id": "3944168c", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "y(t) = f (x, t),\n", @@ -645,9 +563,7 @@ { "cell_type": "markdown", "id": "15946380", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "is a function of $t$, called a\n", "sample function or realization of the process. In physics one\n", @@ -658,9 +574,7 @@ { "cell_type": "markdown", "id": "aee62e91", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -673,9 +587,7 @@ { "cell_type": "markdown", "id": "f515bb9e", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(y\\rightarrow y')w(y ) = W(y'\\rightarrow y)w_0 (y),\n", @@ -685,9 +597,7 @@ { "cell_type": "markdown", "id": "64881fda", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where $W(y'\\rightarrow y)$ is the probability, per unit time, that the\n", "system changes from a state $|y\\rangle$ , characterized by the value\n", @@ -701,9 +611,7 @@ { "cell_type": "markdown", "id": "3961251e", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -716,9 +624,7 @@ { "cell_type": "markdown", "id": "e596f386", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(0\\rightarrow 1)\\exp{-(\\epsilon_0/kT)} = W(1\\rightarrow 0)\\exp{-(\\epsilon_1/kT)}.\n", @@ -728,9 +634,7 @@ { "cell_type": "markdown", "id": "15b5ecec", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We get then" ] @@ -738,9 +642,7 @@ { "cell_type": "markdown", "id": "9405eab5", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{W(1\\rightarrow 0)}{W(0 \\rightarrow 1)}=\\exp{-(\\Delta E/kT)},\n", @@ -750,9 +652,7 @@ { "cell_type": "markdown", "id": "c8e8faf4", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "which goes to zero when $T$ tends to zero." ] @@ -760,9 +660,7 @@ { "cell_type": "markdown", "id": "eb6fe742", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -774,9 +672,7 @@ { "cell_type": "markdown", "id": "14b84a89", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w_i(0) = \\delta_{i,0},\n", @@ -786,9 +682,7 @@ { "cell_type": "markdown", "id": "b6d47e48", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and its time-development after a given time step $\\Delta t=\\epsilon$ is" ] @@ -796,9 +690,7 @@ { "cell_type": "markdown", "id": "c959168a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w_i(t) = \\sum_{j}W(j\\rightarrow i)w_j(t=0).\n", @@ -808,9 +700,7 @@ { "cell_type": "markdown", "id": "3b55f84f", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "The continuous analog to $w_i(0)$ is" ] @@ -818,9 +708,7 @@ { "cell_type": "markdown", "id": "8b1cf5a3", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x})\\rightarrow \\delta(\\mathbf{x}),\n", @@ -830,9 +718,7 @@ { "cell_type": "markdown", "id": "af9d1ea3", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where we now have generalized the one-dimensional position $x$ to a generic-dimensional \n", "vector $\\mathbf{x}$. The Kroenecker $\\delta$ function is replaced by the $\\delta$ distribution\n", @@ -842,9 +728,7 @@ { "cell_type": "markdown", "id": "c5538edb", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -857,9 +741,7 @@ { "cell_type": "markdown", "id": "59725279", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{y},t+\\Delta t)= \\int W(\\mathbf{y},t+\\Delta t| \\mathbf{x},t)w(\\mathbf{x},t)d\\mathbf{x},\n", @@ -869,9 +751,7 @@ { "cell_type": "markdown", "id": "d46ebfd9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and after $m$ time steps we have" ] @@ -879,9 +759,7 @@ { "cell_type": "markdown", "id": "15131e1b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{y},t+m\\Delta t)= \\int W(\\mathbf{y},t+m\\Delta t| \\mathbf{x},t)w(\\mathbf{x},t)d\\mathbf{x}.\n", @@ -891,9 +769,7 @@ { "cell_type": "markdown", "id": "c08966e7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "When equilibrium is reached we have" ] @@ -901,9 +777,7 @@ { "cell_type": "markdown", "id": "aa8cb364", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{y})= \\int W(\\mathbf{y}|\\mathbf{x}, t)w(\\mathbf{x})d\\mathbf{x},\n", @@ -913,9 +787,7 @@ { "cell_type": "markdown", "id": "71bd3bc0", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "that is no time-dependence. Note our change of notation for $W$" ] @@ -923,9 +795,7 @@ { "cell_type": "markdown", "id": "fd01ca91", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -938,9 +808,7 @@ { "cell_type": "markdown", "id": "0d145c26", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x},t) = \\int_{-\\infty}^{\\infty}d\\mathbf{k} \\exp{(i\\mathbf{kx})}\\tilde{w}(\\mathbf{k},t),\n", @@ -950,9 +818,7 @@ { "cell_type": "markdown", "id": "45659b4a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and using the definition of the \n", "$\\delta$-function" @@ -961,9 +827,7 @@ { "cell_type": "markdown", "id": "c78dbd1b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\delta(\\mathbf{x}) = \\frac{1}{2\\pi} \\int_{-\\infty}^{\\infty}d\\mathbf{k} \\exp{(i\\mathbf{kx})},\n", @@ -973,9 +837,7 @@ { "cell_type": "markdown", "id": "2f11b169", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "we see that" ] @@ -983,9 +845,7 @@ { "cell_type": "markdown", "id": "75abc8fb", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\tilde{w}(\\mathbf{k},0)=1/2\\pi.\n", @@ -995,9 +855,7 @@ { "cell_type": "markdown", "id": "86abb296", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1007,9 +865,7 @@ { "cell_type": "markdown", "id": "cc673061", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial \\tilde{w}(\\mathbf{k},t)}{\\partial t} = -D\\mathbf{k}^2\\tilde{w}(\\mathbf{k},t),\n", @@ -1019,9 +875,7 @@ { "cell_type": "markdown", "id": "f8990bcc", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "with the obvious solution" ] @@ -1029,9 +883,7 @@ { "cell_type": "markdown", "id": "8b878f24", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\tilde{w}(\\mathbf{k},t)=\\tilde{w}(\\mathbf{k},0)\\exp{\\left[-(D\\mathbf{k}^2t)\\right)}=\n", @@ -1042,9 +894,7 @@ { "cell_type": "markdown", "id": "e8300c57", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1054,9 +904,7 @@ { "cell_type": "markdown", "id": "bf60212d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x},t)=\\int_{-\\infty}^{\\infty}d\\mathbf{k} \\exp{\\left[i\\mathbf{kx}\\right]}\\frac{1}{2\\pi}\\exp{\\left[-(D\\mathbf{k}^2t)\\right]}=\n", @@ -1067,9 +915,7 @@ { "cell_type": "markdown", "id": "cecaa195", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "with the normalization condition" ] @@ -1077,9 +923,7 @@ { "cell_type": "markdown", "id": "b5ea8f5a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\int_{-\\infty}^{\\infty}w(\\mathbf{x},t)d\\mathbf{x}=1.\n", @@ -1089,9 +933,7 @@ { "cell_type": "markdown", "id": "57a9ed03", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1109,9 +951,7 @@ { "cell_type": "markdown", "id": "ab00a5a4", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(il-jl,n\\epsilon)\\rightarrow W(\\mathbf{y},t+\\Delta t|\\mathbf{x},t)=\n", @@ -1122,9 +962,7 @@ { "cell_type": "markdown", "id": "e2329412", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and that it satisfies the normalization condition and is itself a solution\n", "to the diffusion equation." @@ -1133,9 +971,7 @@ { "cell_type": "markdown", "id": "55d847e9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1147,9 +983,7 @@ { "cell_type": "markdown", "id": "cf7dcd7d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x},t)= \\int_{-\\infty}^{\\infty} W(\\mathbf{x}.t|\\mathbf{x}'.t')w(\\mathbf{x}',t')d\\mathbf{x}',\n", @@ -1159,9 +993,7 @@ { "cell_type": "markdown", "id": "55774304", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and" ] @@ -1169,9 +1001,7 @@ { "cell_type": "markdown", "id": "ce84af12", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x},t)= \\int_{-\\infty}^{\\infty} W(\\mathbf{x}.t|\\mathbf{x}_0.t_0)w(\\mathbf{x}_0,t_0)d\\mathbf{x}_0,\n", @@ -1181,9 +1011,7 @@ { "cell_type": "markdown", "id": "65a56246", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and" ] @@ -1191,9 +1019,7 @@ { "cell_type": "markdown", "id": "effebe52", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "w(\\mathbf{x}',t')= \\int_{-\\infty}^{\\infty} W(\\mathbf{x}'.t'|\\mathbf{x}_0,t_0)w(\\mathbf{x}_0,t_0)d\\mathbf{x}_0.\n", @@ -1203,9 +1029,7 @@ { "cell_type": "markdown", "id": "ded4bf38", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1215,9 +1039,7 @@ { "cell_type": "markdown", "id": "955cabc9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x}t|\\mathbf{x}_0t_0) = \\int_{-\\infty}^{\\infty} W(\\mathbf{x},t|\\mathbf{x}',t')W(\\mathbf{x}',t'|\\mathbf{x}_0,t_0)d\\mathbf{x}'.\n", @@ -1227,9 +1049,7 @@ { "cell_type": "markdown", "id": "9e5e2006", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We can replace the spatial dependence with a dependence upon say the velocity\n", "(or momentum), that is we have" @@ -1238,9 +1058,7 @@ { "cell_type": "markdown", "id": "14cd8679", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{v},t|\\mathbf{v}_0,t_0) = \\int_{-\\infty}^{\\infty} W(\\mathbf{v},t|\\mathbf{v}',t')W(\\mathbf{v}',t'|\\mathbf{v}_0,t_0)d\\mathbf{x}'.\n", @@ -1250,9 +1068,7 @@ { "cell_type": "markdown", "id": "4dba6fff", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1263,9 +1079,7 @@ { "cell_type": "markdown", "id": "98b7b355", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x},t|\\mathbf{x}_0,t_0) = \\int_{-\\infty}^{\\infty} W(\\mathbf{x},t|\\mathbf{x}',t')W(\\mathbf{x}',t'|\\mathbf{x}_0,t_0)d\\mathbf{x}'.\n", @@ -1275,9 +1089,7 @@ { "cell_type": "markdown", "id": "5e7a7e36", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "Define $s=t'-t_0$, $\\tau=t-t'$ and $t-t_0=s+\\tau$. We have then" ] @@ -1285,9 +1097,7 @@ { "cell_type": "markdown", "id": "126985ee", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x},s+\\tau|\\mathbf{x}_0) = \\int_{-\\infty}^{\\infty} W(\\mathbf{x},\\tau|\\mathbf{x}')W(\\mathbf{x}',s|\\mathbf{x}_0)d\\mathbf{x}'.\n", @@ -1297,9 +1107,7 @@ { "cell_type": "markdown", "id": "fc3b537a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1309,9 +1117,7 @@ { "cell_type": "markdown", "id": "5340c79d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x},s|\\mathbf{x}_0)+\\frac{\\partial W}{\\partial s}\\tau +O(\\tau^2) = \\int_{-\\infty}^{\\infty} W(\\mathbf{x},\\tau|\\mathbf{x}-\\xi)W(\\mathbf{x}-\\xi,s|\\mathbf{x}_0)d\\mathbf{x}'.\n", @@ -1321,9 +1127,7 @@ { "cell_type": "markdown", "id": "6b5a2879", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We assume that $W(\\mathbf{x},\\tau|\\mathbf{x}-\\xi)$ takes non-negligible values only when $\\xi$ is small. This is just another way of stating the Master equation!!" ] @@ -1331,9 +1135,7 @@ { "cell_type": "markdown", "id": "5191088d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1345,9 +1147,7 @@ { "cell_type": "markdown", "id": "66d73948", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x},\\tau|\\mathbf{x}-\\xi)W(\\mathbf{x}-\\xi,s|\\mathbf{x}_0) =\n", @@ -1359,9 +1159,7 @@ { "cell_type": "markdown", "id": "c25b2c7b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1371,9 +1169,7 @@ { "cell_type": "markdown", "id": "b89a6be9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial W}{\\partial s}\\tau=-W(\\mathbf{x},s|\\mathbf{x}_0)+\n", @@ -1385,9 +1181,7 @@ { "cell_type": "markdown", "id": "d603a02d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We have neglected higher powers of $\\tau$ and have used that for $n=0$ \n", "we get simply $W(\\mathbf{x},s|\\mathbf{x}_0)$ due to normalization." @@ -1396,9 +1190,7 @@ { "cell_type": "markdown", "id": "a3cfddd0", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "\n", @@ -1410,9 +1202,7 @@ { "cell_type": "markdown", "id": "0fba931d", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "W(\\mathbf{x},\\tau|\\mathbf{x}-\\xi)W(\\mathbf{x}-\\xi,s|\\mathbf{x}_0) =\n", @@ -1424,9 +1214,7 @@ { "cell_type": "markdown", "id": "43aac8ac", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "We can then rewrite the ESKC equation as" @@ -1435,9 +1223,7 @@ { "cell_type": "markdown", "id": "7713e50e", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial W(\\mathbf{x},s|\\mathbf{x}_0)}{\\partial s}\\tau=-W(\\mathbf{x},s|\\mathbf{x}_0)+\n", @@ -1449,9 +1235,7 @@ { "cell_type": "markdown", "id": "8c23e877", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We have neglected higher powers of $\\tau$ and have used that for $n=0$ \n", "we get simply $W(\\mathbf{x},s|\\mathbf{x}_0)$ due to normalization." @@ -1460,9 +1244,7 @@ { "cell_type": "markdown", "id": "eea965c7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "We simplify the above by introducing the moments" @@ -1471,9 +1253,7 @@ { "cell_type": "markdown", "id": "e604807e", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "M_n=\\frac{1}{\\tau}\\int_{-\\infty}^{\\infty} \\xi^nW(\\mathbf{x}+\\xi,\\tau|\\mathbf{x})d\\xi=\n", @@ -1484,9 +1264,7 @@ { "cell_type": "markdown", "id": "8e44ec9a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "resulting in" ] @@ -1494,9 +1272,7 @@ { "cell_type": "markdown", "id": "8c4e3a9c", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial W(\\mathbf{x},s|\\mathbf{x}_0)}{\\partial s}=\n", @@ -1508,9 +1284,7 @@ { "cell_type": "markdown", "id": "2de8b21e", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "When $\\tau \\rightarrow 0$ we assume that $\\langle [\\Delta x(\\tau)]^n\\rangle \\rightarrow 0$ more rapidly than $\\tau$ itself if $n > 2$. \n", @@ -1524,9 +1298,7 @@ { "cell_type": "markdown", "id": "06378099", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial W(\\mathbf{x},s|\\mathbf{x}_0)}{\\partial s}=\n", @@ -1538,9 +1310,7 @@ { "cell_type": "markdown", "id": "17b08fc7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "In a more compact form we have" @@ -1549,9 +1319,7 @@ { "cell_type": "markdown", "id": "b6fa0329", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{\\partial W}{\\partial s}=\n", @@ -1563,9 +1331,7 @@ { "cell_type": "markdown", "id": "19b0d194", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "which is the Fokker-Planck equation! It is trivial to replace \n", "position with velocity (momentum)." @@ -1574,9 +1340,7 @@ { "cell_type": "markdown", "id": "1fd9cc94", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1591,9 +1355,7 @@ { "cell_type": "markdown", "id": "ae5ebbdd", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1604,9 +1366,7 @@ { "cell_type": "markdown", "id": "1fb546bb", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\xi =6\\pi \\eta a/m\n", @@ -1616,9 +1376,7 @@ { "cell_type": "markdown", "id": "39118f02", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where $\\eta$ is the viscosity of the solvent and a is the radius of the particle .\n", "\n", @@ -1628,9 +1386,7 @@ { "cell_type": "markdown", "id": "7e7e0511", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\mathbf{v}(t)=\\mathbf{v}_{0}e^{-\\xi t}+\\int_{0}^{t}d\\tau e^{-\\xi (t-\\tau )}\\mathbf{F }(\\tau ).\n", @@ -1640,9 +1396,7 @@ { "cell_type": "markdown", "id": "c283a6e0", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1654,9 +1408,7 @@ { "cell_type": "markdown", "id": "052464c7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle \\mathbf{v}(t)\\cdot \\mathbf{v}(t)\\rangle_{\\mathbf{v}_{0}}=v_{0}^{-\\xi 2t}\n", @@ -1667,9 +1419,7 @@ { "cell_type": "markdown", "id": "2a2a42f9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "+\\int_{0}^{t}d\\tau ^{\\prime }\\int_{0}^{t}d\\tau e^{-\\xi (2t-\\tau -\\tau ^{\\prime })}\n", @@ -1680,9 +1430,7 @@ { "cell_type": "markdown", "id": "d0c186bd", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1695,9 +1443,7 @@ { "cell_type": "markdown", "id": "5306ea3b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle \\mathbf{F}(t)\\rangle=0,\n", @@ -1707,9 +1453,7 @@ { "cell_type": "markdown", "id": "22b8a942", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "and" ] @@ -1717,9 +1461,7 @@ { "cell_type": "markdown", "id": "2432446a", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle \\mathbf{F}(t)\\cdot \\mathbf{F}(t^{\\prime })\\rangle_{\\mathbf{v}_{0}}= C_{\\mathbf{v}_{0}}\\delta (t-t^{\\prime }).\n", @@ -1729,9 +1471,7 @@ { "cell_type": "markdown", "id": "8c0590c9", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "We omit the subscript $\\mathbf{v}_{0}$, when the quantity of interest turns out to be independent of $\\mathbf{v}_{0}$. Using the last three equations we get" ] @@ -1739,9 +1479,7 @@ { "cell_type": "markdown", "id": "4089d80f", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle \\mathbf{v}(t)\\cdot \\mathbf{v}(t)\\rangle_{\\mathbf{v}_{0}}=v_{0}^{2}e^{-2\\xi t}+\\frac{C_{\\mathbf{v}_{0}}}{2\\xi }(1-e^{-2\\xi t}).\n", @@ -1751,9 +1489,7 @@ { "cell_type": "markdown", "id": "0ef0c43f", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "For large t this should be equal to 3kT/m, from which it follows that" ] @@ -1761,9 +1497,7 @@ { "cell_type": "markdown", "id": "ba185ec7", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle \\mathbf{F}(t)\\cdot \\mathbf{F}(t^{\\prime })\\rangle =6\\frac{kT}{m}\\xi \\delta (t-t^{\\prime }).\n", @@ -1773,9 +1507,7 @@ { "cell_type": "markdown", "id": "b1fcaf35", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "This result is called the fluctuation-dissipation theorem ." ] @@ -1783,9 +1515,7 @@ { "cell_type": "markdown", "id": "5ef1a930", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1796,9 +1526,7 @@ { "cell_type": "markdown", "id": "a13a5a62", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\mathbf{v}(t)=\\mathbf{v}_{0}e^{-\\xi t}+\\int_{0}^{t}d\\tau e^{-\\xi (t-\\tau )}\\mathbf{F }(\\tau ),\n", @@ -1808,9 +1536,7 @@ { "cell_type": "markdown", "id": "1f40e236", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "we get" ] @@ -1818,9 +1544,7 @@ { "cell_type": "markdown", "id": "64795362", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\mathbf{r}(t)=\\mathbf{r}_{0}+\\mathbf{v}_{0}\\frac{1}{\\xi }(1-e^{-\\xi t})+\n", @@ -1831,9 +1555,7 @@ { "cell_type": "markdown", "id": "d0cfe453", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "from which we calculate the mean square displacement" ] @@ -1841,9 +1563,7 @@ { "cell_type": "markdown", "id": "966e357b", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle ( \\mathbf{r}(t)-\\mathbf{r}_{0})^{2}\\rangle _{\\mathbf{v}_{0}}=\\frac{v_0^2}{\\xi}(1-e^{-\\xi t})^{2}+\\frac{3kT}{m\\xi ^{2}}(2\\xi t-3+4e^{-\\xi t}-e^{-2\\xi t}).\n", @@ -1853,9 +1573,7 @@ { "cell_type": "markdown", "id": "a15727a3", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, Fokker-Planck and Langevin equations\n", "**Langevin equation.**\n", @@ -1866,9 +1584,7 @@ { "cell_type": "markdown", "id": "37b83694", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\langle (\\mathbf{r}(t)-\\mathbf{r}_{0})^{2}\\rangle =\\frac{6kT}{m\\xi }t\n", @@ -1878,9 +1594,7 @@ { "cell_type": "markdown", "id": "8a19caa6", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "from which we get the Einstein relation" ] @@ -1888,9 +1602,7 @@ { "cell_type": "markdown", "id": "991f5999", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "D= \\frac{kT}{m\\xi }\n", @@ -1900,9 +1612,7 @@ { "cell_type": "markdown", "id": "dd908ad8", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "where we have used $\\langle (\\mathbf{r}(t)-\\mathbf{r}_{0})^{2}\\rangle =6Dt$." ] @@ -1910,9 +1620,7 @@ { "cell_type": "markdown", "id": "d0459313", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "## Importance sampling, programming elements\n", "\n", @@ -1922,9 +1630,7 @@ { "cell_type": "markdown", "id": "48febb03", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\frac{1}{\\Psi_C}\\frac{\\partial \\Psi_C}{\\partial x_k} =\n", @@ -1937,9 +1643,7 @@ { "cell_type": "markdown", "id": "2926c6f1", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "However, \n", "with our written in way which can be reused later as" @@ -1948,9 +1652,7 @@ { "cell_type": "markdown", "id": "90d86bc0", - "metadata": { - "editable": true - }, + "metadata": {}, "source": [ "$$\n", "\\Psi_C=\\prod_{i< j}g(r_{ij})= \\exp{\\left\\{\\sum_{i