asking for help about creating nanoscaled twin boundaries in lammps: segregation fault and atoms lost

I’m trying to create nanotwinned coherent boundaries(CTBs) by lammps but it doesn’t work for a long time.

To make the twin plane ,ie. the (111) plane in fcc crystal, vertical to a plane of simulation box(such as x-o-y plane), I choose .[a1,a2,a3]=1041E6FC@...4561....jpgas primary vector of original crystal and [a1,a2,a3]=103EE8A2@...4561....jpgas primary vector of twin crystal. However, there’re 2 problem i cannot fix.
1.Atoms on the edge of the simulation box disappeared for no reason.
2.The lammps shuts down unexpectedly when running this script because of the error:segementation fault.

1052E6AA@...4561....jpg103EE916@...4561....jpg
fig. The twin crystal appears to be correct except some atoms are lost for unknown reason at the center of the simulation box,as shown in the left picture. Besides, atoms on the edge of x orientation of the box are all lost, making it aperiodicity on x orientation(It’s periodical on y and z orientation). The aperiodicity will be more obvious when drag atoms around in the box by AtomEye,as showed in the right picture.

-------------------partial lammps script------------

#initiallization
dimension 3
units metal
boundary p p p
atom_style atomic

#create a tilt lattice for twin crystal
variable box_x equal 1.732050807568877293527446341505910#
variable box_y equal 1.2247448713915890490986420373529
20#
variable box_z equal 1.4142135623730950488016887242097*3#

#create box
lattice fcc 3.61
region box block -{box_x} {box_x} 0 {box_y} 0 {box_z}
create_box 1 box

#create atoms
region t1 block -{box_x} 0 0 {box_y} 0 {box_z} region t7 block 0 {box_x} 0 {box_y} 0 {box_z}

lattice custom 3.61 a1 0.57735027 -0.5 0.70710687 a2 0.57735027 -0.5 -0.70710687 a3 0.57735027 0.72474487 0 basis 0 0 0 basis 0.5 0.5 0 basis 0.5 0 0.5 basis 0 0.5 0.5
create_atoms 1 region t1
lattice custom 3.61 a1 -0.57735027 -0.5 0.70710687 a2 -0.57735027 -0.5 -0.70710687 a3 -0.57735027 0.72474487 0 basis 0 0 0 basis 0.5 0.5 0 basis 0.5 0 0.5 basis 0 0.5 0.5
create_atoms 1 region t7

group t1 region t1
group t7 region t7

#calculation
pair_style eam/alloy
pair_coeff * * mg.eam.alloy Mg
neighbor 0.8 bin
neigh_modify every 5 delay 0 check yes
thermo 10
variable N equal atoms
variable E equal pe

timestep 0.01
compute 3 all pe/atom
compute 4 all ke/atom
compute 5 all coord/atom 3.0

dump 1 all cfg 1000 t*.cfg id type xs ys zs c_3 c_4 c_5

min_style sd
minimize 1.0e-30 1.0e-15 10000 100000
print “----------fcc_hcp---------------N=$N E=$E------------------------”

    I'm trying to create nanotwinned coherent boundaries(CTBs) by lammps
but it doesn't work for a long time.
   To make the twin plane ,ie. the (111) plane in fcc crystal, vertical
to a plane of simulation box(such as x-o-y plane), I choose .[a1,a2,a3]=as
primary vector of original crystal and [a1,a2,a3]=as primary vector of
twin crystal. However, there're 2 problem i cannot fix.
1.Atoms on the edge of the simulation box disappeared for no reason.
2.The lammps shuts down unexpectedly when running this script because of
the error:segementation fault.

both have likely the same reason, you have defined your region boundaries
with your lattice points, that makes it ill defined whether an atom is in
or outside the respective reason and what lammps chooses is subject to
floating point truncation errors. move your region definitions by 0.1 units
and it should magically work.

axel.

1052E6AA@...4561....jpg

103EE8A2@...4561....jpg

103EE916@...4561....jpg

1041E6FC@...4561....jpg