From charlesreid1

No edit summary
No edit summary
Line 18: Line 18:


<pre>
<pre>
import hoomd, hoomd.md
import hoomd, hoomd.md
hoomd.context.initialize()
hoomd.context.initialize()

Revision as of 23:22, 1 December 2017

Overview

What is it?

From the hoomd-blue website:


HOOMD-blue is a general-purpose particle simulation toolkit. It scales from a single CPU core to thousands of GPUs.

You define particle initial conditions and interactions in a high-level python script. Then tell HOOMD-blue how you want to execute the job and it takes care of the rest. Python job scripts give you unlimited flexibility to create custom initialization routines, control simulation parameters, and perform in situ analysis.


How does it work?

The core of Hoomd is written in C++, which is how it is able to utilize GPU hardware in a seamless way. But it also has an API written in Python that plugs into the C++ backend, enabling simpler programs and making the learning curve shallower.

On the main Hoomd-blue website (link above), an example using the Python API is given:

import hoomd, hoomd.md
hoomd.context.initialize()
unitcell=hoomd.lattice.sc(a=2.0, type_name='A')
hoomd.init.create_lattice(unitcell=unitcell, n=10)
nl = hoomd.md.nlist.cell()
lj = hoomd.md.pair.lj(r_cut=3.0, nlist=nl)
lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0)
all = hoomd.group.all();
hoomd.md.integrate.mode_standard(dt=0.005)
hoomd.md.integrate.langevin(group=all, kT=1.2, seed=4)
hoomd.run(10e3)

This can be run in any manner of ways:

Serial (single processing unit):

$ hoomd run.py --mode=cpu    # run on a single cpu
$ hoomd run.py --mode=gpu    # run on a single gpu

Parallel (multiple processing units):

$ mpirun -n 256 hoomd run.py --mode=cpu    # run on 256 cpus
$ mpirun -n 64 hoomd run.py --mode=gpu    # run on 64 gpus