10.1.4. Multi-replica simulations
Several commands in LAMMPS run multi-replica simulations, meaning that multiple instances (replicas) of your simulation are run simultaneously, with small amounts of data exchanged between replicas periodically.
These are the relevant commands:
hyper for bond boost hyperdynamics (HD)
neb for nudged elastic band calculations (NEB)
neb_spin for magnetic nudged elastic band calculations
prd for parallel replica dynamics (PRD)
tad for temperature accelerated dynamics (TAD)
temper for parallel tempering with fixed volume
temper/npt for parallel tempering extended for NPT
temper/grem for parallel tempering with generalized replica exchange (gREM)
fix pimd/langevin and fix pimd/nvt (and their bosonic variants) for path-integral molecular dynamics (PIMD)
fix alchemy for alchemical transformations between two systems
NEB is a method for finding transition states and barrier potential energies. HD, PRD, and TAD are methods for performing accelerated dynamics to find and perform infrequent events. Parallel tempering or replica exchange runs different replicas at a series of temperature to facilitate rare-event sampling. PIMD runs different replicas whose individual particles in different replicas are coupled together by springs to model a system of ring-polymers which can represent the quantum nature of atom cores. Fix alchemy runs two systems as two replicas and gradually transforms one into the other.
These commands can only be used if LAMMPS was built with the REPLICA package (or the SPIN package in the case of the neb/spin command). See the Build package page for more info.
In all these cases, you must run with one or more processors per replica. The processors assigned to each replica are determined at run-time by using the -partition command-line switch to launch LAMMPS on multiple partitions, which in this context are the same as replicas. E.g. these commands:
mpirun -np 16 lmp -partition 8x2 -in in.temper
mpirun -np 8 lmp -partition 8x1 -in in.neb
would each run 8 replicas, on either 16 or 8 processors. Note the use of the -in command-line switch to specify the input script which is required when running in multi-replica mode.
Also note that with MPI installed on a machine (e.g. your desktop), you can run on more (virtual) processors than you have physical processors. Thus, the above commands could be run on a single-processor (or few-processor) desktop so that you can run a multi-replica simulation on more replicas than you have physical processors. This is useful for testing and debugging, since with most modern processors and MPI libraries, the efficiency of a calculation can severely diminish when oversubscribing processors.
All partitions execute the same input script. This means that commands that write files, e.g. dump, restart, or write_restart, are executed on all partitions, and they will write to the same file at the same time unless the file name is different for each partition. The resulting file may contain the data of just one of the replicas or a garbled mix of data from several replicas. To avoid this, include a variable in the file name that has a different value on each partition, e.g. the replica number:
variable rep world 0 1 2 3 4 5 6 7
dump 1 all atom 1000 dump.replica.${rep}
write_restart restart.replica.${rep}
Instead of a world-style variable, you can also use a universe- or uloop-style variable. The prd and tad commands are an exception: they write a single dump or restart file for all partitions themselves; see their documentation for details. Log files and screen output are separated automatically into one file per partition, see the -log and -screen command-line switches.