Getting started

HAL’s MD package is configured and steered with customisable simulation scripts written in Lua 5. For a quick start refer to one of the “liquid” scripts found in share/doc/halmd/examples in the installation directory. For further details about the simulation scripts, see Simulation Scripts.

Program parameters

HAL’s MD package brings a command line parser which allows one to define script parameters. The possible command line options are described in the help:

halmd script.lua --help

Example: a Lennard-Jones fluid

Let us consider a simple fluid with 20,000 Lennard-Jones particles at density \rho^*=0.8. Equilibration is done with a Boltzmann thermostat at temperature T^*=2 over 10,000 steps:

halmd liquid/lennard_jones_equilibration.lua -v \
  --timestep 0.005 --time 50 \
  --density 0.8 --particles 20000 \
  --temperature 2 \
  --sampling state-vars=100

Many parameters have sensible default values and may be omitted, e.g, the collision rate of the thermostat, 2\tau^{-1}, or the cutoff radius of the potential, r_c=2^{1/6}\sigma, corresponding to a purely repulsive potential. The option -v makes the output more verbose, check that your CUDA device has been detected properly.

The system state is written at the beginning and the end of the simulation if not specified differently. The initial configuration of the particles is an fcc lattice. The default output settings yield an H5MD file with a time stamp in its name, lennard_jones_equilibration_%Y%m%d_%H%M%S.h5 and a corresponding log file.

We may now continue the simulation at constant energy by resuming from the H5MD file using the accompanying script:

halmd liquid/lennard_jones.lua -v \
  --timestep 0.001 --time 100 \
  --input output_from_previous_run.h5 \
  --sampling state-vars=1000

This will continue the simulation over 10⁵ steps and write observables like thermodynamic state variables every 1000 steps (potential energy, instantaneous “temperature”, pressure, …)

Inspection of the results

If the HDF5 tools are properly installed, you may have a quick overview of the output file:

h5ls output.h5

or look at a specific data set:

h5ls -d output.h5/observables/potential_energy | less

For more advanced inspection and analysis of the HDF5 output files, see Plotting the results. You may try the exemplary script:

plotting/ output.h5
plotting/ --no-plot --range 20 100 output.h5

You may also have a look at the H5MD tools, a collection of analysis and plotting scripts.