August 18th, 2011TutorialsJuan Sebastian Totero Gongora 0 Comments

BBMD Tutorial: MD study of a glass transition


In this tutorial we will learn the parallel code BBMD by studying the glass transition of a binary mixture of soft spheres. Details of the parallel structure of BBMD can be found here. In order to start our simulation, cd to <BBMD ROOT>/newsim. The directory contains the following files.

df.m·· makefile· makefile_shaheen··· prof.m· res· res1· show.m··

the *.in are the files we need to modify to run our simulation. We begin with Open it with Emacs or your favorite editor. The file has the same global structure of the of Nanocpp, and it is divided into two main sections: compile-time and run-time parameters. The latter requires to re-compile the code, while the former can be run with the same executable. For every set of parameters, such a division always allows to run an optimized version of BBMD. As in Nanocpp, this is achieved by the use of template metaprogramming and C macros.

The parameters Architecture, Optimizations and Geometry are explained in the file and do not require further comments. Leave them to their original values. We will begin our discussion with the I/O section, which governs the Input/Output of BBMD.

##### I/O
output=raw····················· # (raw) vtk to be implemented

The output keyword specifies the output file format. Version 1.0 of BBMD saves everything in native binary files (raw).

save_data=x+v+a+i······················ # saved in the order x,v,a,i

This keyword specifies what type of data will be saved at the end of each BBMD run. Particles are charactized by positions (x), velocity (v), accelerations (a) and species (i). By using the ‘+’ keyword, you can combine x,v,a,i in any order. However, the final file will contain data saved according to the order x,v,a,i, as specified in the right hand side.

monitor=P+H+K+T+avg············ # P (momentum), H (Hamiltonian), K (kinetic energy), T (temperature); inst (instantaneous) or avg (average). All quantities are x particle

This specifies the quantities that will be displayed during the I/O of BBMD. Several options are possible, including the possibility to measure instantaneous of averaged quantities. For our simulation, since we need to plot the caloric curve (i.e., the potential energy U=H-K versus Temperature), we will measure P+H+K+T.

measure=··········· # UKHT (potential U, kinetic energy K, Hamiltonian H, temperature T), RDF (Radial Distribution Function),
# DSF [Dynamic Structure Factor S(k,w) + S(k)]
# CLT [Longitudinal C_L(k,w) and transverse C_T(k,w) current]

This specifies the quantities that will be· measured after the equilibration of the system. For this simulation, as we are only interested in the caloric curve, we can left this part blank.

The next section:

##### MD
ensemble=canonical············· # microcanonical,canonical
potential=soft_spheres········· # lennard_jones, soft_spheres

concerns the ensemble and the potential chosen for the MD simulation. Check that the default parameters are as above.

Once the compile-time section has been set up, we can compile the code:


if the compilation process ends without errors, the bbmd executable is generated:


bbmd·· build_input.o· definitions.h··········· lattices.o···· line_parser_s.o· makefile.~1.21.~·· my_file.o· prof.m· res1···
build· CVS··········· df.m··········· line_parser.o· makefile········ makefile_shaheen··· p_rand.o·· res···· show.m·

Once this is done, we can set up the run-time parameters.

procs=3 3 3

This rules the parallel cartesian topology Px,Py,Pz and specifies the preferred number of processors to be assigned in each direction x,y,z. If the total number of processors does not match Px*Py*Pz, automatic partitioning will be used.

number_of_cells=10 10 10··············· # x y z number of unit cells
r_cut=1.1856··························· # cut distance

This specifies the number of cells and the cutting distance. Leave these values as above for the moment, we will discuss them after.

##### TIME & I/O
base_dir=./res················· # directory where to save data
sim_type=md···················· # md (standard MD run), in (inherent structure find from chk), he (minimum connectivity analysis, to be done!)
delta_t=1e-3····················· # integration delta t
io_screen=1000··················· # I/O on screen
chkpoint_every=50000············· # checkpoint step
save_parts_data=1················ # if true save particles data in file base_dir/particles.bin

The base_dir keyword specifies the root directory where to save all BBMD data. The directory is created if it does not exist. The sym_type indicates the type of analysis to be done: in this case a standard MD run. The code supports also the ineherent structure (in) analysis (to be covered in another tutorial) and hessian diagonalization (to be implemented). The other parameters are self-explanatory and will not be discussed.

##### MD specifiers
equilibration_steps=3000000·············· # steps to reach equilibrium
measurement_steps=0···················· # steps used for performing final averages (total steps = equilibration + measure)

An MD simulation is composed of two different part: the equilibration and the measurements. For the caloric curve, we will perform 3M steps of equilibration.················ # file containing particle properties

This specifies the file containing the particle properties for the interaction potential (see here for the link between the various quantities in and the expression of the potential). The file implements a binary mixture that is known to possess a glass transition near T=0.25 (click here for more details).


##########PARTICLES PROPERTIES##########

mass list=1. 1.························ #mass list

sigma tensor=1. 0.8 0.8 0.88··········· #1D list in C-style order

epsilon tensor=1. 1.5 1.5 0.5·········· #1D list in C-style order

We now return back to the file, and proceed with the MD section:

particles=bc+random·· # (inputfile/fc,bc,sc/chk + random)

This specifies the input conditions. Three types of input conditions are available: an inputfile (inputfile), a lattice (face centered fc, body centered bc or simple cubic sc) or a checkpoint (chk). Randomness (random) can then be added to all of them, if necessary. For our simulation, we specify a body centered (bc) lattice with randomness (random). The lattice is specified as follows:

# LATTICE specifiers
index_list=1+2+2+2+2·················· # particle species list 1D (torus) | index starts from 1, cannot use 0 | use + as separator
density=1.2··················· # particle density (exact if r_cut=multiple of (atom x cell/density)^1/3)

This models a 20:80 bynary mixtures of particles of species 1 and 2, whose density is 1.2. As written on the right hand side, the value of r_cut that exactly matches the required density is:

r_{cut}=\bigg(\frac{Atom X Cell}{density}\bigg)^{1/3}

The bc lattice has two atoms per unit cell. This gives r_cut=1.1856, which is the value written in the MD section of The total number of atoms is then given by the atom x cell times the total number of cells, and is equal to N=10^3cdot 2=2000 for this simulation. The random specifiers:

# RANDOM specifiers
randomize=v············ # (v=velocity,a=acceleration,x=position) use + to combine them
random_x=0 0.1········· # = mean_value std
random_a=-1 0.3········ # = mean_value std
random_v=0 0.2········· # = mean_value std

For this simulation, we will randomize the velocity (v) with a Gaussian distribution whose mean value is 0 and standard deviation is 0.2. BBMD uses a fast and lightweight implementation of the Mersenne-Twister random number generator, with a very large period 2^{19937}-1. This avoids any problem, even for Billion-body systems. The last part we need to configure is the temperature curve


temp_curve=trapezoidal ··········· # flat,triangular,trapezoidal
temp_peak=3 ··················· # maximum (all)
temp_pk_coord=20000··········· # coordinate of the peak in timestep units (triangular,trapezoidal)
temp_pk2_coord=80000·········· # 2-nd coordinate of the peak in timestep units (trapezoidal)
temp_en_coord=3000000············ # coordinate of the temp_end point in timestep units (triangular,trapezoidal)
temp_sta=0.1···················· # initial temperature (all except flat)
temp_end=1e-3····················· # final temperature (all except flat)
temp_update_every=10000··········· # temperature update interval

We choose a trapezoidal curve, whose parameters match the curve used in our article. In particular, the initial temperature of 0.1 is raised in 20000 steps up to 3, which is maintained for 80000 steps and then slowly cooled down to 1e-3 after 3M steps.

We are now ready to launch our simulation. Just type:

mpiexec -n 27 ./bbmd

to execute BBMD on 27 processors (or use the number you want). The figure below shows the caloric curve (i.e., the potential H-K versus the temperature T) as obtained from the simulation (filled dot markers). Analytic fits (solid lines), are provided as well.


Thanks to Mohammed Shahzad for the BBMD simulations.

Group News


Interested in joining?
Click here!