[lammps-users] How to create 2 lattice structures, one over the other


I am trying to create 2 lattices where one lattice structure lies on top of the other. I am able to simulate and visualize the 2 lattices separately but am having a hard time putting both of them in a single code. Below is a simplified input file which is giving me the following error “Cannot create_box after simulation box is defined”. Could someone let me know how to create two or more lattices?


units metal
dimension 3
atom_style atomic

lattice diamond 5.43
region box block 0 5 0 5 0 5
create_box 1 box
create_atoms 1 box
mass 1 1.0

velocity all create 300 25674 mom yes rot yes dist gaussian

pair_style tersoff
pair_coeff * * Si.tersoff Si

lattice diamond 3.2
region box1 block 0 5 0 5 5 10
create_box 1 box1
create_atoms 1 box1
mass 1 1.0

velocity all create 300 25674 dist uniform

pair_style tersoff
pair_coeff * * X.tersoff X
neighbor 2 bin
neigh_modify delay 10

timestep 0.001
run_style verlet

fix 1 all npt 300 300 0.1 xyz 0.0 0.0 0.1

thermo_style custom temp ke etotal vol press enthalpy
thermo 50

dump 1 all custom 100 Hetero_data300.out id type xs ys zs

run 20000

Hi Mihir,

The command ‘create_box’ defines the global
simulation box of your system together with the number
of all the atom types to be defined. So it should come
only once in a single code.
For the ‘lattice’ command, it deals with the regions
(not the global box) you have defined. So just use the
region ‘box1’ to create the 2nd lattice.
It seems that there are two atom types in your simulation.
The way you specify the masses and pair_coeff should
adjusted accordingly. The doc pages of these commands
should help.

L. Wan

2009/10/30 Mihir Tungare <mihirt999@…24…>

Use create_box once. Use create_atoms as many times
as you want. Use lattice as many times as you want. Whenever
create_atoms operates it uses values from the most recent lattice


1 Like

Thanks for your responses. I am now able to create 2 lattices but am getting an “Invalid args for pair_coeff” error. I have 2 tersoff files, one associated with the lower lattice consisting of 1 type of atoms and another associated with the upper lattice consisting of another type of atoms. This has been written as,

pair_style tersoff
pair_coeff 1 1 Si.tersoff Si
pair_coeff 2 2 Si2.tersoff Si2

I am not able to figure out how to correct this. Could you let me know what errors I am making in defining the pair coefficients?


You can't use 2 Tersoff files, nor even 2 pair_coeff commands with Tersoff.
The doc page is clear on this. You can use one Tersoff and some other
potential (by using pair_style hybrid). Or you can combine the 2 files
into one file, e.g. with different atom types, and define the cross
interactions in some way. You can use multiple atom types in your
LAMMPS model and map them to different "elements" in the single
Tersoff file, however you wish.