Particle Simulations with HOOMD-blue Joshua A. Anderson S6256 NVIDIA GTC April 7, 2016 9:00-9:50am T HE G LOTZER G ROUP
HOOMD-blue General purpose particle simulation toolkit Molecular dynamics, hard particle Monte Carlo Executes simulations fast on GPUs (also runs on CPUs) Open source >127 peer-reviewed articles 2 T HE G LOTZER G ROUP
History 2007-02 - CUDA public beta 2007-03 - APS March meeting 2007-09 - Paper submitted 2008-02 - v0.6 : C++ benchmarks only, lj and harmonic bonds only 2008-08 - v0.7: Python job scripts 2008-12 - v0.8: First external contribution - FENE bonds, Langevin dynamics 3 T HE G LOTZER G ROUP
History 2015-09 - v1.2: Bounding volume hierarchy neighbor list 2015-12 - v1.3: Anisotropic particle integrators, wall potentials, load balancing 2016-?? - v2.0: Hard particle Monte Carlo 4 T HE G LOTZER G ROUP
Research using HOOMD Microspheres Shape allophiles Quasicrystal formation Active particles Digital alchemy Hexatic phases 5 T HE G LOTZER G ROUP
Molecular dynamics v i ( t ) r i ( t ) ~ ~ q i ( t ) ~ ! i ( t ) ~ Compute interactions r i ( t + � t ) v i ( t + � t ) ~ ~ q i ( t + � t ) ! i ( t + � t ) ~ ~ 6 T HE G LOTZER G ROUP
Hard particle Monte Carlo (HPMC) q i ( A ) ~ r i ( A ) ~ Random trial move Accept or reject r i ( B ) q i ( B ) ~ ~ Joshua A Anderson, M Eric Irrgang, Sharon C Glotzer (2016) Scalable Metropolis Monte Carlo for simulation of hard shapes, Computer Physics Communications 7 T HE G LOTZER G ROUP
HPMC Shape overlap checks + See GTC 2014 talk 8 T HE G LOTZER G ROUP
HPMC block level queue (a) Initialization Trial move Circumsphere check Overlap check Overlap divergence Early exit divergence Thread Time (0.5 ms total) (b) Time 9 T HE G LOTZER G ROUP
HPMC on P100 10 T HE G LOTZER G ROUP
GPU strategy in HOOMD Perform all computations on the GPU (see GTC 2010-2013 talks) Keep data on the GPU all the time Run multiple threads per particle and warp-level reduction/scan Auto-tune launch parameters during run time (see GTC 2015 talk) 11 T HE G LOTZER G ROUP
Architecture User's python script HOOMD python library matplotlib scipy mpi4py ... HOOMD C++ library CUDA MPI Hardware 12 T HE G LOTZER G ROUP
Installing binaries with conda http:// conda.pydata.org/miniconda.html 13 T HE G LOTZER G ROUP
Compile from source Requirements: C++ compiler Python Numpy Boost C++ library CMake Optional: CUDA MPI git sphinx 14 T HE G LOTZER G ROUP
Compile from source 15 T HE G LOTZER G ROUP
Example: DPD polymers import hoomd from hoomd import md hoomd.context.initialize(); hoomd.init.read_gsd(filename='polymers.gsd') nl = hoomd.md.nlist.cell() dpd = md.pair.dpd(r_cut=1.0, T=1.0, nlist=nl) nl.reset_exclusions() dpd.pair_coeff.set('A', 'A', A=25.0, gamma = 4.5) dpd.pair_coeff.set('A', 'B', A=80.0, gamma = 4.5) dpd.pair_coeff.set('B', 'B', A=25.0, gamma = 4.5) harmonic = hoomd.md.bond.harmonic() harmonic.bond_coeff.set('polymer', k=330.0, r0=0.84) md.integrate.mode_standard(dt=0.02) md.integrate.nve(group=hoomd.group.all()) hoomd.run(10000) 16 T HE G LOTZER G ROUP
Running the example 17 T HE G LOTZER G ROUP
T HE G LOTZER G ROUP
Example: Active matter import hoomd, numpy from hoomd import md hoomd.context.initialize() hoomd.init.read_gsd('active.gsd') all = hoomd.group.all() N = len(all) nl = hoomd.md.nlist.cell() lj = md.pair.lj(r_cut=1.0, nlist=nl) lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0/2**(1.0/6.0)) activity = [ (((numpy.random.rand(3) - 0.5) * 2.0)) for i in range(N)] for i in range(N): activity[i][2] = 0; activity[i] = tuple(activity[i]) active_force = md.force.active(group=all, seed=123, f_lst=activity, rotation_diff=0.005, orientation_link= False ) md.integrate.mode_standard(dt=0.001) bd = md.integrate.brownian(group=all, T=0.0, seed=123, dscale=1.0) hoomd.run(100000) 19 T HE G LOTZER G ROUP
20 T HE G LOTZER G ROUP
BVH tree overview BVH trees are common in ray tracing HOOMD uses them for neighbor searches (optional) Generate and query on the GPU M. P. Howard, J. A. Anderson, A. Nikoubashman, S. C. Glotzer, and A. Z. Panagiotopoulos, Comput. Phys. Commun. , Mar. 2016. 21 T HE G LOTZER G ROUP
Example: Large and small particles import hoomd, numpy from hoomd import md hoomd.context.initialize() hoomd.init.read_gsd('bigsmall.gsd') nl = md.nlist.tree() lj = md.pair.slj(r_cut=2**(1.0/6.0), nlist=nl) lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0) md.integrate.mode_standard(dt=0.005) lvn = md.integrate.langevin(group=hoomd.group.all(), T=1.0, seed=123) lvn.set_gamma('A', 1.0) hoomd.run(3000000) 22 T HE G LOTZER G ROUP
23 T HE G LOTZER G ROUP
Example: Hard Hexagons import hoomd from hoomd import hpmc hoomd.context.initialize(); hoomd.init.read_gsd(filename='hexagons.gsd') hexagon = [[0.5,0], [0.25,0.433012701892219], [-0.25,0.433012701892219], [-0.5,0], [-0.25,-0.433012701892219], [0.25,-0.433012701892219]]; mc = hpmc.integrate.convex_polygon(seed=123, d=0.15, a=1); mc.shape_param.set('A', vertices=hexagon); hoomd.run(200) 24 T HE G LOTZER G ROUP
25 T HE G LOTZER G ROUP
Example: Jupyter notebook 26 T HE G LOTZER G ROUP
Additional features Integration: NVE, NVT, NPT, NPH, langevin, brownian, • Berendsen, DPD, FIRE minimization Orientational degrees of freedom • Pair potentials: CGCMM, DPD, LJ, Gaussian, Mie, • Moliere, Morse, Yukawa, ZBL, table Bond: FENE, Harmonic, table, OPLS • Anisotropic potentials: Gay-berne, dipole • Wall potentials • PPPM electrostatics • HPMC shapes: convex polygon, simple polygon, • convex spheropolygon, convex polyhedron, convex spheropolyhedron, general polyhedron, ellipsoid, differences of spheres, unions of spheres, faceted spheres 27 T HE G LOTZER G ROUP
Software engineering Object oriented design Template functors Code review / pull requests Unit testing Validation testing Conda recipes Read the docs 28 T HE G LOTZER G ROUP
T HE G LOTZER G ROUP
T HE G LOTZER G ROUP
Read The Docs 31 T HE G LOTZER G ROUP
Acknowledgements HOOMD-blue + HPMC: codeblue.umich.edu/hoomd-blue/ 2.0 will be available soon..... Thanks to all HOOMD-blue users and contributors! Research supported by the National Science Foundation, Division of Materials Research Award # DMR 1409620. 32 T HE G LOTZER G ROUP
Recommend
More recommend