Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barriers #111

Merged
merged 5 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions 08-Placing-Barriers/00-index.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
joaander marked this conversation as resolved.
Show resolved Hide resolved
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Placing barriers\n",
"\n",
"This tutorial explains various methods to place barriers in the simulation box.\n",
"\n",
"**Prerequisites:**\n",
"\n",
"This tutorial assumes you are familiar with the concepts introduced in [Introducing HOOMD-blue](../00-Introducing-HOOMD-blue/00-index.ipynb) and [Introducing Molecular Dynamics](../01-Introducing-Molecular-Dynamics/00-index.ipynb)."
]
},
{
"cell_type": "markdown",
"metadata": {
"editable": true,
"nbsphinx-toctree": {
"maxdepth": 1
},
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Outline\n",
"\n",
"1. [Barriers](01-Barriers.ipynb)\n",
"1. [Fixed particles](02-Fixed-particles.ipynb)\n",
"1. [Wall geometries](03-Wall-geometries.ipynb)\n",
"1. [Wall potential (MD)](04-Wall-potential-MD.ipynb)\n",
"1. [Wall potential (HPMC)](05-Wall-potential-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."
]
}
],
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
},
"record_timing": false
},
"nbformat": 4,
"nbformat_minor": 4
}
99 changes: 99 additions & 0 deletions 08-Placing-Barriers/01-Barriers.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
joaander marked this conversation as resolved.
Show resolved Hide resolved
joaander marked this conversation as resolved.
Show resolved Hide resolved
"cells": [
{
"cell_type": "markdown",
"id": "9a768e9f-d196-4b78-8706-b8a9e32a4109",
"metadata": {},
"source": [
"# Barriers\n",
"\n",
"## Overview\n",
"\n",
"### Questions\n",
"\n",
"* What is a barrier?\n",
"* How do barriers relate to the simulation box?\n",
"* How do I prevent particles from crossing barriers?\n",
"\n",
"### Objectives\n",
"\n",
"* Define **barrier**.\n",
"* Explain that there are no inherent **barriers** in the **periodic box**."
]
},
{
"cell_type": "markdown",
"id": "7fd49325-2972-4964-9315-8acd11d5c0d6",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Barriers and the simulation box\n",
"\n",
"A **barrier** obstructs the motion of particles in a simulation. In typical cases, barriers split space into two regions - one where particles are allowed and one where particles are not.\n",
"\n",
"The simulation's **periodic box** is _always_ periodic. When a **particle's** position leaves the primary image, it is _always_ wrapped back into the box on the other side.\n",
"\n",
"You must ensure that any barriers you place are commensurate with these **periodic boundary conditions**. Otherwise, particles may cross from an allowed to a disallowed region via wrapping:\n",
"\n",
"![Example of an invalid barrier](invalid-barrier.svg)"
]
},
{
"cell_type": "markdown",
"id": "21f928a5-967d-4723-9272-719c60f04a2d",
"metadata": {},
"source": [
"Similarly, HOOMD-blue _always_ applies pairwise interactions accounting for the periodic boundary conditions. When desired, set the box length and width of the disallowed region accordingly to prevent such interactions:\n",
"\n",
"![Example of an invalid barrier](valid-barrier.svg)"
]
},
{
"cell_type": "markdown",
"id": "f50745c8-ab84-43e8-bc01-53cc81fd8c73",
"metadata": {},
"source": [
"## Preventing particles from crossing barriers\n",
"\n",
"To prevent particles from crossing a barrier, you must add **interactions** between particles and the barrier. There are many ways to achieve this goal. See the remaining sections of this tutorial for examples."
]
},
{
"cell_type": "markdown",
"id": "53bc74fc-2de4-44f2-a190-a33daba8f757",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Conclusion\n",
"\n",
"This section introduced the concept of barriers in the simulation box and explain that they must be placed carefully to take the always period box into account. The next section will show you how to make a barrier out of particles."
]
}
],
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading