diff --git a/debugging.ipynb b/V_dump.ipynb similarity index 88% rename from debugging.ipynb rename to V_dump.ipynb index 5952fb2..d484697 100644 --- a/debugging.ipynb +++ b/V_dump.ipynb @@ -1,13 +1,5 @@ { "cells": [ - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Debugging V values" - ] - }, { "cell_type": "code", "execution_count": 2, diff --git a/V_verify.ipynb b/V_verify.ipynb new file mode 100644 index 0000000..88babbd --- /dev/null +++ b/V_verify.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from itertools import chain\n", + "import numpy as np\n", + "import math\n", + "from scipy import sparse\n", + "from scipy.sparse.linalg import eigsh\n", + "\n", + "#sample potential\n", + "def V_gauss(dr_sqr):\n", + " return -4*math.exp(-dr_sqr/4)\n", + "\n", + "n=3 # no of particles\n", + "L=14\n", + "N=6 # no of lattice points\n", + "mu=1/2 # reduced mass\n", + "\n", + "DOF=(n-1)*3 # degrees of freedom after excluding CM\n", + "\n", + "s=np.arange(N**DOF) # matrix index\n", + "\n", + "# k index for each particle and each dimension\n", + "k=np.empty((n-1,3),dtype=np.dtype)\n", + "for dof in range(DOF):\n", + " k[dof//3,dof%3]=(s%N**(DOF-dof))//N**(DOF-1-dof)-N//2\n", + "\n", + "x=k*(L/N) # x coordinate from k index\n", + "\n", + "# adding up all non-local interactions\n", + "V_local=np.zeros(N**DOF)\n", + "\n", + "# 2-body interactions\n", + "V2=np.vectorize(V_gauss)\n", + "dxs=chain((x[i,:] for i in range(n-1)), (x[i,:]-x[j,:] for (i,j) in np.ndindex((n-1,n-1)) if i