It’s possible to give each set of atoms that are read into LAMMPS via the read_data command a group name. Then using that group name, you can move that group of atoms to a new location with displace_atoms GroupID move x y z.
Below is example code from my own simulations combining nylon with graphene. I annotated the code with comments (#) to show what’s going on.
# read in the nylon monomer file
read_data ${data} extra/atom/types 6 extra/bond/types 3 extra/angle/types 4 extra/dihedral/types 3 extra/improper/types 0 extra/bond/per/atom 10 extra/angle/per/atom 20 extra/dihedral/per/atom 50 extra/improper/per/atom 20 extra/special/per/atom 20
# Replicate the nylon monomer to get a certain wt fraction of GNP.
replicate 5 26 5 # 650 nylon molecules, 648 required to get to 0.04 GNP wt frac at 90% polymerization
# Reset the box dimensions so that they go from -l/2 to +l/2 then remap the coordinates of the atoms to this new box.
change_box all x final -(lx/2) (lx/2) y final -(ly/2) (ly/2) z final -(lz/2) (lz/2) remap
# Read in first GNP sheet and give it a group name of GNP1
# The GNP box dimensions go from -lx/2 to +lx/2 and same for the other two dimensions. This is important.
# Both the GNP box and the nylon box have their origins at (0,0,0). When the GNPs are read in, they will be at (0,0,0).
# Knowing where the second data file will be located is the most important part when combining data files with read_data add append
read_data ${gnpdata} add append offset 12 15 29 34 11 group GNP1
# Read in second GNP sheet and give it a group name of GNP2
read_data ${gnpdata} add append offset 15 15 29 34 11 group GNP2
thermo 1000
thermo_style custom step temp press etotal ke pe epair ebond eangle edihed eimp elong lx ly lz pxx pyy pzz vol density
run 0
variable lx_0 equal (lx)
variable ly_0 equal (ly)
variable lz_0 equal $(lz)
# Reset box dimensions
change_box all x final -(v_lx_0/2) (v_lx_0/2) y final -(v_ly_0/2) (v_ly_0/2) z final -(v_lz_0/2) (v_lz_0/2) remap
# Enlarge box
variable delta equal 80
change_box all x delta -(v_delta/2) (v_delta/2) y delta -(v_delta/2) (v_delta/2) # Don’t remap here, I want the extra space because that’s where the GNPs will go
# Move the GNPs into the free regions
variable movex1 equal {delta}/2+{lx_0}/2+28-10
variable movey1 equal 0
variable movex2 equal 0
variable movey2 equal -{delta}/2-{ly_0}/2-28+10
displace_atoms GNP1 move {movex1} {movey1} 0 #{randz1} #-20 -50 0
displace_atoms GNP2 move {movex2} {movey2} 0 #{randz2} #-30 235 60
For debugging, to check if the GNPs moved to the correct locations
write_data ${myid}_check.dat
Hope this helps,
Will