06: Draft ugh
This commit is contained in:
@ -20,13 +20,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 1,
|
||||||
"id": "b388fbcf",
|
"id": "b388fbcf",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"NAME = \"\"\n",
|
"NAME = \"Kees van Kempen\"\n",
|
||||||
"NAMES_OF_COLLABORATORS = \"\""
|
"NAMES_OF_COLLABORATORS = \"Bart Steeman\""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 2,
|
||||||
"id": "cb41d2a1",
|
"id": "cb41d2a1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"deletable": false,
|
"deletable": false,
|
||||||
@ -219,7 +219,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"YOUR ANSWER HERE"
|
"The condition for detailed balance is $$\\frac{P(s\\rightarrow s')}{P(s'\\rightarrow s)}=\\frac{\\pi(s')}{\\pi(s)}.$$\n",
|
||||||
|
"Let's work to that expression by following the idea of the proof for the Ising model proof.\n",
|
||||||
|
"\n",
|
||||||
|
"Starting from the left-hand side, consider the same cluster from the same seed and unit vector $\\hat{n}$ but from different states $s$ and $s'$. Flipping between $s$ and $s'$ is done by the same cluster $C$. The probability of this happening is given by the boundaries of the clusters, namely that they are not added to the cluster, with probability $1 - p_{add}$ per boundary site. Again, like in the Ising model proof, we take the boundary of $C$ to be of $m + n$ length with $m$ the number of aligned sites and $n$ the number of anti-aligned sites. This gives a ratio $$\\frac{P(s\\rightarrow s')}{P(s'\\rightarrow s)} = (1-p_{add})^{m-n}.$$\n",
|
||||||
|
"\n",
|
||||||
|
"For the right-hand side, $$\\frac{\\pi(s')}{\\pi(s)} = e^{\\beta \\left[H_{XY}(s)-H_{XY}(s')\\right]}$$ just from the definition of $\\pi$.\n",
|
||||||
|
"This difference in energy we can write as\n",
|
||||||
|
"$$\n",
|
||||||
|
"H_{XY}(s)-H_{XY}(s') = \\sum_{<i,j> \\in boundary} \\left[ s_i \\cdot s_j - s'_i \\cdot s_j \\right]\n",
|
||||||
|
" = \\sum_{<i,j> \\in boundary} 2(s_i \\cdot \\hat{n})(s_j \\cdot \\hat{n})\n",
|
||||||
|
"$$\n",
|
||||||
|
"by summing over all pairs $i, j$ on the boundary of $C$, with $i \\in C$ and $j$ an outside neigbour, as pairs not across the boundary do not give rise to an energy change. The last step is due to"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -245,7 +256,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"id": "6e4a6d63",
|
"id": "6e4a6d63",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"deletable": false,
|
"deletable": false,
|
||||||
@ -269,8 +280,17 @@
|
|||||||
"def xy_cluster_flip(state,seed,nhat,beta):\n",
|
"def xy_cluster_flip(state,seed,nhat,beta):\n",
|
||||||
" '''Perform a cluster move with specified seed and vector nhat on the state at temperature beta.'''\n",
|
" '''Perform a cluster move with specified seed and vector nhat on the state at temperature beta.'''\n",
|
||||||
" w = len(state)\n",
|
" w = len(state)\n",
|
||||||
" # YOUR CODE HERE\n",
|
" spin = state[seed]\n",
|
||||||
" raise NotImplementedError()\n",
|
" state[seed] = state[seed] - 2*np.dot(state[seed], nhat)*nhat\n",
|
||||||
|
" cluster_size = 1\n",
|
||||||
|
" unvisited = deque([seed]) # use a deque to efficiently track the unvisited cluster sites\n",
|
||||||
|
" while unvisited: # while unvisited sites remain\n",
|
||||||
|
" site = unvisited.pop() # take one and remove from the unvisited list\n",
|
||||||
|
" for nbr in neighboring_sites(site,w):\n",
|
||||||
|
" if state[nbr] == spin and rng.uniform() < p_add:\n",
|
||||||
|
" state[nbr] = -spin\n",
|
||||||
|
" unvisited.appendleft(nbr)\n",
|
||||||
|
" cluster_size += 1\n",
|
||||||
" return cluster_size\n",
|
" return cluster_size\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def xy_cluster_move(state,beta):\n",
|
"def xy_cluster_move(state,beta):\n",
|
||||||
@ -666,7 +686,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3 (ipykernel)",
|
"display_name": "Python 3",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user