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

Update Example Dependencies #76

Merged
merged 9 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v3
with:
path: freud
ref: next
ref: main
repository: glotzerlab/freud
submodules: true
- name: Install freud
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__
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
50 changes: 27 additions & 23 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
226 changes: 126 additions & 100 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.

89 changes: 53 additions & 36 deletions examples/Visualization with plato.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,70 @@
"metadata": {},
tommy-waltmann marked this conversation as resolved.
Show resolved Hide resolved
"outputs": [
{
"name": "stdout",
"name": "stderr",
"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"
"/home/tomwalt/mambaforge/envs/freud-examples/lib/python3.10/site-packages/numpy/core/getlimits.py:542: UserWarning: Signature b'\\x00\\xd0\\xcc\\xcc\\xcc\\xcc\\xcc\\xcc\\xfb\\xbf\\x00\\x00\\x00\\x00\\x00\\x00' for <class 'numpy.longdouble'> does not match any known type: falling back to type probe function.\n",
"This warnings indicates broken support for the dtype!\n",
" machar = _get_machar(dtype)\n"
]
}
],
"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 +120,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 +147,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c8b319501f594ee185999a85a1cdd55d",
"model_id": "2396d797743d4ba295183bb636e0b7b9",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -149,7 +166,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -163,7 +180,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 +2081,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.

Loading