Skip to content

Commit

Permalink
Merge pull request #76 from glotzerlab/update-dependencies
Browse files Browse the repository at this point in the history
Update Example Dependencies
  • Loading branch information
tommy-waltmann authored Mar 5, 2024
2 parents 18c8489 + 7f2b698 commit b135ea6
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 276 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python-version: ["3.9", "3.10"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0
with:
path: freud-examples
# Important! All steps that use the conda environment should define "shell: bash -l {0}".
Expand All @@ -52,10 +52,10 @@ jobs:
# Install testing requirements
mamba install pytest nbval
# Build freud from source to test the examples on the latest version
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0
with:
path: freud
ref: next
ref: main
repository: glotzerlab/freud
submodules: true
- name: Install freud
Expand All @@ -81,7 +81,7 @@ jobs:
# notify developers if the scheduled check fails
- name: Slack notification
if: ${{ github.event_name == 'schedule' && (failure() || cancelled()) }}
uses: 8398a7/action-slack@v3.15.1
uses: 8398a7/action-slack@v3.16.2
with:
status: ${{ job.status }}
fields: workflow,job,message,commit
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
examples/gb_lattice.gsd
*.ipynb_checkpoints
*__pycache__
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.5.0'
hooks:
- id: end-of-file-fixer
exclude: 'setup.cfg'
- id: trailing-whitespace
exclude: 'setup.cfg'
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
rev: 'v3.3.1'
rev: 'v3.15.1'
hooks:
- id: pyupgrade
args:
- --py36-plus
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
rev: '5.13.2'
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: '23.3.0'
rev: '24.2.0'
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
rev: '7.0.0'
hooks:
- id: flake8
args:
- --max-line-length=100
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.1
hooks:
- id: nbqa-pyupgrade
args:
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ dependencies:
- bokeh
- fresnel>=0.12
- freud
- gsd<3
- hoomd=2.*
- gsd
- hoomd
- ipywidgets>=7
- jupyterlab>=3
- lammps
- matplotlib>=3,<3.7
- matplotlib>=3
- mdanalysis>=2
- mdtraj
- nbconvert>=6
Expand Down
38 changes: 16 additions & 22 deletions examples/Benchmarking RDF against MDAnalysis.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/HOOMD-MC-W6/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
output.log
rdf.csv
w6_data.h5
202 changes: 103 additions & 99 deletions examples/HOOMD-MC-W6/HOOMD-MC-W6.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/Smectic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"import numpy as np\n",
"import rowan\n",
"\n",
"\n",
"def randomize_orientations(orientations, perturbation_magnitude):\n",
" randomized_orientations = []\n",
" for orientation in orientations:\n",
Expand Down Expand Up @@ -71,7 +72,7 @@
" positions.append(position)\n",
" particles_in_layer += 1\n",
"\n",
" return np.array(positions[:num_particles])\n"
" return np.array(positions[:num_particles])"
]
},
{
Expand Down
99 changes: 49 additions & 50 deletions examples/Visualization with fresnel.ipynb

Large diffs are not rendered by default.

93 changes: 50 additions & 43 deletions examples/Visualization with plato.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,62 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HOOMD-blue v2.6.0-151-gea140cffb DOUBLE HPMC_MIXED MPI TBB SSE SSE2 SSE3 SSE4_1 SSE4_2 AVX AVX2 \n",
"Compiled: 09/25/2019\n",
"Copyright (c) 2009-2019 The Regents of the University of Michigan.\n",
"-----\n",
"You are using HOOMD-blue. Please cite the following:\n",
"* J A Anderson, C D Lorenz, and A Travesset. \"General purpose molecular dynamics\n",
" simulations fully implemented on graphics processing units\", Journal of\n",
" Computational Physics 227 (2008) 5342--5359\n",
"* J Glaser, T D Nguyen, J A Anderson, P Liu, F Spiga, J A Millan, D C Morse, and\n",
" S C Glotzer. \"Strong scaling of general-purpose molecular dynamics simulations\n",
" on GPUs\", Computer Physics Communications 192 (2015) 97--107\n",
"-----\n",
"HOOMD-blue is running on the CPU\n"
]
}
],
"outputs": [],
"source": [
"import itertools\n",
"\n",
"import hoomd\n",
"import hoomd.md\n",
"import numpy as np\n",
"from hoomd import md\n",
"\n",
"hoomd.context.initialize(\"\")\n",
"\n",
"# Silence the HOOMD output\n",
"hoomd.util.quiet_status()\n",
"hoomd.option.set_notice_level(0)\n",
"def make_simple_cubic_snapshot(a, n):\n",
" \"\"\"Make a snapshot with a simple cubic lattice.\n",
"\n",
"# Create a 10x10x10 simple cubic lattice of particles with type name A\n",
"system = hoomd.init.create_lattice(\n",
" unitcell=hoomd.lattice.sc(a=1.5, type_name=\"A\"), n=10\n",
")\n",
" Args:\n",
" a (float): Lattice spacing\n",
" n (int): Number of particles\n",
"\n",
" Returns:\n",
" hoomd.Snapshot: The initial system snapshot.\n",
" \"\"\"\n",
" k = int(np.ceil(n ** (1 / 3)))\n",
" L = k * a\n",
" x = np.linspace(-L / 2, L / 2, k, endpoint=False)\n",
" position = list(itertools.product(x, repeat=3))\n",
" position = position[:n]\n",
"\n",
" snap = hoomd.Snapshot()\n",
" snap.particles.N = n\n",
" snap.particles.types = [\"A\"]\n",
" snap.particles.typeid[:] = [0] * n\n",
" snap.particles.position[:] = position\n",
" snap.configuration.box = [L, L, L, 0, 0, 0]\n",
"\n",
" return snap\n",
"\n",
"\n",
"# Create an 8x8x8 simple cubic lattice\n",
"sim = hoomd.Simulation(hoomd.device.CPU())\n",
"sim.create_state_from_snapshot(make_simple_cubic_snapshot(a=1.5, n=1000))\n",
"sim.seed = 42\n",
"\n",
"# Specify Lennard-Jones interactions between particle pairs\n",
"nl = hoomd.md.nlist.cell()\n",
"lj = hoomd.md.pair.lj(r_cut=3.0, nlist=nl)\n",
"lj.pair_coeff.set(\"A\", \"A\", epsilon=1.0, sigma=1.0)\n",
"nl = hoomd.md.nlist.Cell(buffer=0.2)\n",
"lj = hoomd.md.pair.LJ(default_r_cut=3.0, nlist=nl)\n",
"lj.params[(\"A\", \"A\")] = dict(epsilon=1.0, sigma=1.0)\n",
"\n",
"# Integrate at constant temperature\n",
"hoomd.md.integrate.mode_standard(dt=0.005)\n",
"integrator = hoomd.md.integrate.nvt(group=hoomd.group.all(), kT=0.01, tau=0.5)\n",
"integrator.randomize_velocities(seed=42)\n",
"nvt = md.methods.ConstantVolume(\n",
" filter=hoomd.filter.All(), thermostat=md.methods.thermostats.Bussi(kT=0.01, tau=0.5)\n",
")\n",
"integrator = md.Integrator(dt=0.005, methods=[nvt], forces=[lj])\n",
"sim.operations.integrator = integrator\n",
"sim.state.thermalize_particle_momenta(filter=hoomd.filter.All(), kT=0.01)\n",
"\n",
"# Run for 10,000 time steps\n",
"hoomd.run(10e3)\n",
"snap = system.take_snapshot()"
"sim.run(10e3)\n",
"snap = sim.state.get_snapshot()"
]
},
{
Expand Down Expand Up @@ -103,7 +110,7 @@
"outputs": [],
"source": [
"positions = snap.particles.position\n",
"box = freud.Box.from_box(snap.box)\n",
"box = freud.Box.from_box(snap.configuration.box)\n",
"ld = freud.density.LocalDensity(3.0, 1.0)\n",
"ld.compute(system=snap)\n",
"colors = matplotlib.cm.viridis(Normalize()(ld.density))\n",
Expand All @@ -130,7 +137,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c8b319501f594ee185999a85a1cdd55d",
"model_id": "b07937b725fe49aa9c33ba29650b85ec",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -149,7 +156,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -163,7 +170,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.10.13"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down Expand Up @@ -2064,5 +2071,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
40 changes: 16 additions & 24 deletions module_intros/density.CorrelationFunction.ipynb

Large diffs are not rendered by default.

28 changes: 11 additions & 17 deletions module_intros/diffraction.StaticStructureFactor.ipynb

Large diffs are not rendered by default.

0 comments on commit b135ea6

Please sign in to comment.