# Atoms are not created correctly

Dear Lammps users,

I faced a problem while conducting a simulation and found out the problem was caused by incomplete atom creation.

In order to explain, I simplified my code as below;

The code contains two lattice commands (for Ni and Ti atoms) and two basis for each lattice command line. Thus, the number of created atoms for Ni and Ti atoms should be equal. However, in my prism region, the code creates only 15 atoms (8 Ni and 7 Ti). It should be total 16 atoms (8 Ni and 8 Ti).

The missing Ti atom should be at [x,y,z]= [-0.74758, 4.565195, 0 ]. Or, [xs,ys,zs]= [ 0, 0.5, 0 ] in different format.

Can anyone know why this is happening?

====================code============================

#test creating atoms

variable sizef1 equal 2.0
variable sizef2 equal 2.0
variable sizef3 equal 1.0

variable ang_const equal 99.3
variable real_ang equal \${ang_const}*PI/180

variable a_vec equal 2.885
variable b_vec equal 4.626
variable c_vec equal 4.12

variable reala_vec equal {a_vec}*{sizef1}
variable vertb_vec equal {b_vec}*sin({real_ang})
variable real_vertb_vec equal {vertb_vec}*{sizef2}
variable realc_vec equal {c_vec}*{sizef3}

variable xy_ang equal {b_vec}*cos({real_ang})
variable realxy_ang equal {xy_ang}*{sizef2}

units metal
dimension 3
atom_style atomic
boundary p p p

#1 ---------- Create Atoms ---------------------
#Ni

lattice custom 1.0 a1 {a_vec} 0.0 0.0 a2 {xy_ang} {vertb_vec} 0.0 a3 0.0 0.0 {c_vec} &
basis 0.580 0.472 0.0 basis 0.475 0.086 0.5

region supercell prism 0 {reala_vec} 0.0 {real_vertb_vec} 0.0 {realc_vec} {realxy_ang} 0 0 units box
create_box 2 supercell
create_atoms 1 region supercell

#Ti
lattice custom 1.0 a1 {a_vec} 0.0 0.0 a2 {xy_ang} {vertb_vec} 0.0 a3 0.0 0.0 {c_vec} &
basis 0.0 0.0 0.0 basis 0.055 0.558 0.5
create_atoms 2 region supercell

# ---------- Define Interatomic Potential ---------------------

pair_style eam/fs
pair_coeff * * NiTi_Yuan.setfl_rc4_2.fs Ni Ti

dump 2 all cfg 50 dump_half.equi_*.cfg mass type xs ys zs x y z
dump_modify 2 element Ni Ti

thermo 50
timestep 0.002

#====equi 10K======================
velocity all create 10 4928459 dist gaussian
fix 1 all npt temp 10.0 10.0 10 iso 0 0 1000.0

run 50

Dear Lammps users,

I faced a problem while conducting a simulation and found out the problem
was caused by incomplete atom creation.

In order to explain, I simplified my code as below;

The code contains two lattice commands (for Ni and Ti atoms) and two basis
for each lattice command line. Thus, the number of created atoms for Ni and
Ti atoms should be equal. However, in my prism region, the code creates only
15 atoms (8 Ni and 7 Ti). It should be total 16 atoms (8 Ni and 8 Ti).

The missing Ti atom should be at [x,y,z]= [-0.74758, 4.565195, 0 ]. Or,
[xs,ys,zs]= [ 0, 0.5, 0 ] in different format.

Can anyone know why this is happening?

most likely due to numerical instability.
any time, you place an atom *exactly* on a box boundary, it becomes an
ambiguous assignment.
is this atom going to be counted as inside or outside? this becomes a
problem with non-trivial lattices, as the limitations of floating
point math can push any lattice position inside or outside the box.

either shift your box or your atom positions by a small margin and the
ambiguity is resolved.

axel.