Issue in dividing simulation box into two regions

Dear all,

I am creating a simulation in LAMMPS for FCC Nickel system. checkout the command file attached. I am dividing the simulation box into two halves, top and bottom, to do further transformations.

The problem is when I am dividing the box into two halves, I am missing a layer in the top region.


clear
log perfect.lammps
units		metal
dimension	3
boundary	p p p
atom_style	atomic
variable lp equal 3.52395413816153

variable factor equal 8


lattice fcc ${lp} orient x -1 1 0 orient y -1 -1 2 orient z 1 1 1

variable xdim equal ${lp}*sqrt(2)
variable ydim equal ${lp}*sqrt(6)
variable zdim equal (${lp}*sqrt(3)*${factor})+${lp}*sqrt(3)*(2) #This number because this is 6 layers (2 stacks of ABC stacking). Creating Vacuum of this size to make things periodic.

#12.2073353333=a*sqrt(3)*(2) where a is lattice parameter.


variable atoms_end equal ${lp}*sqrt(3)*${factor}

variable length equal  (${atoms_end}/2) #which is ${lp}*sqrt(3)*4


region full_box block 0 ${xdim} 0 ${ydim} 0 ${zdim} units box
region atoms block 0 ${xdim} 0 ${ydim} 0 ${atoms_end} units box


region top block 0 ${xdim} 0 ${ydim} ${length} ${zdim} units box
region bottom block 0 ${xdim} 0 ${ydim} 0 ${length} units box

lattice fcc ${lp} orient x -1 1 0 orient y -1 -1 2 orient z 1 1 1

create_box 1 full_box
create_atoms 1 region atoms

group top_atoms region top
group bottom_atoms region bottom

I hope reason for having the variable atoms_end is intuitive. I am not filling any atoms above it,leaving it as vacuum. Checkout the dump files attached. Is this not the right approach to divide the box?

I have consulted my professor and he asked me to create top and bottom atoms separately to avoid confusion.

But I want to know why my method doesn’t work. Would be very helpful if someone can explain the mistake I am making.

perfect.txt (2.5 KB)

Modified command
perfect_modified.txt (2.6 KB)

(The difference is the change in magnitude of variable “length”)

Dump Files

pefect.dat (1.3 MB)
perfect_bottom.dat (749.7 KB)
perfect_top.dat (635.6 KB)

Modified

pefect.dat (1.3 MB)
perfect_bottom_modified.dat (697.9 KB)
perfect_top_modified.dat (687.3 KB)

Thank You.

PS: If I use variable atoms_end equal ${lp}*sqrt(3)*${factor} - (1/6)(${lp}*sqrt(3)) instead of

variable atoms_end equal ${lp}*sqrt(3)*${factor}, I am able to get ABCABCABCABC in top and bottom layers by some basic mathematics. I have attached their dump files as well below. But I am not convinced with the way the structures were created.

The problem with your approach is that your regions use lattice points as boundaries. That makes assigning atoms to either region ambiguous. For filling the simulation box, LAMMPS takes care of that, but for everything else, you either need to define your regions so that the boundaries are not ambiguous or you shift the origin of the lattice with the corresponding keyword by a small amount.

can you please tell me exactly what should I change? I used the exact same commands for Fe (FCC), but some atoms are missing. I am not getting why? I think the way I am creating box and atoms are wrong. Please go through my commands if possible. Please suggest me how else should I create the structures.

Thanks

Fe (FCC) structure

and here is the command file.

perfect.txt (2.5 KB)

why are some atoms missing if I am defining all dimensions in terms of lattice parameter? Sorry for uploading screenshot, the dump file is 30 MB. So, this was the best I could do.

See lattice command — LAMMPS documentation