Skip to content

Commit

Permalink
Remove deprecated code (#131)
Browse files Browse the repository at this point in the history
* Fix typo.

* Remove unused file.

* Add jupytext configuration.

* Clean up README.

* Use InverseVolumeRamp

* Reinstate deprecation warnings.

* Execute all notebooks in tests.

* Use InverseVolumeRamp in rigid body tutorial.

* Use InverseVolumeRamp in Barrier tutorial.

* Apply ruff-format to jupyter notebooks.

* pre-commit

* Rewrite Kern-Frenkel tutorial with builtin commands.

* Allow deprecation warnings again.

* Fix small typos.

* Apply suggestions from code review.

* Fix broken link.
  • Loading branch information
joaander authored Jul 11, 2024
1 parent 5c9ff02 commit a4a8c29
Show file tree
Hide file tree
Showing 15 changed files with 1,972 additions and 1,330 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ jobs:
run: |
for i in */
do
# Skip CPPPotential examples until they are rewritten.
if [[ $i == "07-Modelling-Patchy-Particles"* ]]; then
echo "Skipping notebooks in $i"
else
echo "Running notebooks in: $i" && jupyter nbconvert --execute --inplace $i/*.ipynb || exit 1
fi
echo "Running notebooks in: $i" && jupyter nbconvert --execute --inplace $i/*.ipynb || exit 1
done
working-directory: notebooks

Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ repos:
rev: v0.5.0
hooks:
- id: ruff-format
types_or: [ python, jupyter ]
- id: ruff
types_or: [ python, jupyter ]
1,625 changes: 1,237 additions & 388 deletions 01-Introducing-Molecular-Dynamics/03-Compressing-the-System.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"When this **workflow step** is executed, it stores the trial move sizes `a`, `d` and the current timestep in the job document as well as the the state of the simulation in `restart.gsd`.\n",
"When this **workflow step** is executed, it stores the trial move sizes `a`, `d` and the current timestep in the job document as well as the state of the simulation in `restart.gsd`.\n",
"It reads these when starting again to continue from where the previous execution stopped.\n",
"This is a large code block, see the comments for more details on how this **workflow step** can **continue** from where it stopped.\n",
"\n",
Expand Down
156 changes: 108 additions & 48 deletions 06-Modelling-Rigid-Bodies/01-Introduction-to-Rigid-Bodies.ipynb

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions 06-Modelling-Rigid-Bodies/02-Running-Rigid-Body-Simulations.ipynb

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions 07-Modelling-Patchy-Particles/00-index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Modelling Patchy Particles\n",
"\n",
"In this tutorial you will implement the Kern–Frenkel potential as a model for patchy particle interactions. To do so, you will use the `hpmc.pair.user` module, which enables the addition of user-defined, arbitrary, pairwise energetic interactions to a HPMC simulation.\n",
"In this tutorial you will implement the Kern–Frenkel potential as a model for patchy particle interactions.\n",
"\n",
"**Prerequisites:**\n",
"\n",
Expand All @@ -23,19 +23,23 @@
"source": [
"## Outline\n",
"\n",
"1. [Kern–Frenkel Model](01-Kern-Frenkel-Model.ipynb)\n",
"1. [Simulating a System of Patchy Particles](02-Simulating-a-System-of-Patchy-Particles.ipynb)"
"1. [The Kern–Frenkel Model](01-Kern-Frenkel-Model.ipynb)\n",
"1. [Simulating a System of Patchy Particles with HPMC](02-Simulating-a-System-of-Patchy-Particles-with-HPMC.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This tutorial is written with [jupyter](https://jupyter.org/). You can download the source from the [hoomd-examples](https://github.com/glotzerlab/hoomd-examples) repository."
"This tutorial is written with [jupyter](https://jupyter.org/).\n",
"You can download the source from the [hoomd-examples](https://github.com/glotzerlab/hoomd-examples) repository."
]
}
],
"metadata": {
"jupytext": {
"notebook_metadata_filter": "-all"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -46,7 +50,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.4"
},
"record_timing": false
},
Expand Down
34 changes: 18 additions & 16 deletions 07-Modelling-Patchy-Particles/01-Kern-Frenkel-Model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "0",
"metadata": {},
"source": [
"# Kern–Frenkel Model\n",
"# The Kern–Frenkel Model\n",
"\n",
"## Overview\n",
"\n",
Expand All @@ -25,44 +25,46 @@
"source": [
"## Patchy Particles\n",
"In the [Introducing Molecular Dynamics](../01-Introducing-Molecular-Dynamics/00-index.ipynb) tutorial, you simulated a system of particles interacting through the Lennard-Jones pair potential.\n",
"The Lennard-Jones pair potential is spherically symmetric, that is, the pair potential does not depend on the relative orientation of the interacting particles.\n",
"\n",
"Some systems are better represented by anisotropic pair potentials, where there is a dependence on the relative orientation of particles.\n",
"The hard octahedra you simulated in [Intoducing HOOMD-blue](../00-Introducing-HOOMD-blue/00-index.ipynb) interacted through a purely repulsive anisotropic pair potential.\n",
"Particles that interact with anisotropic pair potentials where some relative orientations are more attractive than others are known as **patchy particles**, since we can imagine that there are attractive **patches** on the surface of the particles.\n",
"The Lennard-Jones pair potential is spherically symmetric.\n",
"In other words, the pair potential does not depend on the relative orientation of the interacting particles.\n",
"\n",
"Some systems are better represented by anisotropic pair potentials that depend on relative particle orientations. \n",
"For example, **patchy particles** interact via anisotropic pair potentials where some relative orientations are more attractive than others.\n",
"\n",
"## The Kern–Frenkel Model\n",
"\n",
"One of the simplest patchy particle models is the Kern–Frenkel model, which was introduced in a [2003 Journal of Chemical Physics paper](https://doi.org/10.1063/1.1569473).\n",
"The Kern–Frenkel model contains directional pairwise energetic interactions in addition to hard sphere-like volume exclusion.\n",
"The pair potential $u_{ij}(r_{ij}, \\Omega_i, \\Omega_j)$ between particles $i$ and $j$ at a center-to-center distance $r_{ij}$ and orientations $\\Omega_i$ and $\\Omega_j$ is of the form\n",
"The Kern–Frenkel model, introduced in a [2003 Journal of Chemical Physics paper](https://doi.org/10.1063/1.1569473), models particles with a single patch.\n",
"It consists of a directional pairwise energetic interaction in addition to hard sphere volume exclusion.\n",
"The pair potential $U_{ij}(\\vec{r}_{ij}, \\mathbf{q}_i, \\mathbf{q}_j)$ between particles $i$ and $j$ at a center-to-center separation $\\vec{r}_{ij}$ and orientations $\\mathbf{q}_i$ and $\\mathbf{q}_j$ is of the form\n",
"$$\n",
"\\beta u_{ij} = \n",
"U_{ij} = \n",
"\\begin{cases}\n",
"\\infty & r_{ij} < \\sigma_{ij} \\\\\n",
"-\\beta\\varepsilon\\cdot f(\\Omega_1, \\Omega_2) & \\sigma_{ij} \\leq r_{ij} < \\lambda_{ij}\\sigma_{ij} \\\\\n",
"-\\varepsilon\\cdot f(\\vec{r}_{ij}, \\mathbf{q}_i, \\mathbf{q}_j) & \\sigma_{ij} \\leq r_{ij} < \\lambda_{ij}\\sigma_{ij} \\\\\n",
"0 & r_{ij} \\geq \\lambda_{ij}\\sigma_{ij}\n",
"\\end{cases}\n",
"$$\n",
"where $\\beta = 1/k_BT$, $\\varepsilon$ is the strength of the patchy interaction, $\\sigma_{ij}$ is sum of the radii of particles $i$ and $j$, $\\lambda$ is the range of the square well attraction, and $f(\\Omega_i, \\Omega_j)$ is an orientational masking function given by\n",
"where $\\varepsilon$ is the strength of the patchy interaction, $\\sigma_{ij}$ is sum of the radii of particles $i$ and $j$, $\\lambda_{ij}$ is the range of the square well attraction, and $f$ is an orientational masking function given by\n",
"$$\n",
"f(\\Omega_1, \\Omega_2) = \n",
"f(\\vec{r}_{ij}, \\mathbf{q}_i, \\mathbf{q}_j) = \n",
"\\begin{cases}\n",
"1 & \\hat{e}_i \\cdot \\hat{r}_{ij} > \\cos \\delta \\mathrm{~~and~~} \\hat{e}_j \\cdot \\hat{r}_{ji} > \\cos \\delta \\\\\n",
"1 & \\hat{e}_i \\cdot \\hat{r}_{ij} \\ge \\cos \\delta \\land \\hat{e}_j \\cdot \\hat{r}_{ji} \\ge \\cos \\delta \\\\\n",
"0 & \\mathrm{otherwise}\n",
"\\end{cases}\n",
"$$\n",
"where $\\hat{e}_i$ is the **director** of the patch on particle $i$ and $\\delta$ is the half-opening angle of the patch.\n",
"\n",
"Graphically, this pair potential corresponds to the following criterion: two particles interact with energy $\\infty$ if the gray shaded regions on the two particles overlap at all, $-\\varepsilon$ if the blue shaded regions on the two particles overlap, and zero otherwise.\n",
"Graphically, this pair potential corresponds to the following: two particles interact with energy $\\infty$ if the gray shaded regions on the two particles overlap at all, $-\\varepsilon$ if the blue shaded regions on the two particles overlap, and zero otherwise.\n",
"\n",
"![Kern–Frenkel](kern-frenkel-schematic.svg)"
]
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"jupytext": {
"notebook_metadata_filter": "-all"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -73,7 +75,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit a4a8c29

Please sign in to comment.