Regarding to data.file combining and box dimension growing

Hello,

I am trying to make my system model, which contains a wall with special thickness and a polymer solution on it. I have made their data files using packmol and moletemplate. Then I used read_data to combine them the data files as follows:

read_data “system1.data” #solution
read_data “system2.data” add append #wall


The size of the new data file in z direction is twice of each of them. Actually, I didn’t get any error but the dump.lammpstrj shows that the wall bead mixed with the solution beads. It looks after adding the wall box has grown in the z direction to the size of the new data file. I would appreciate to know any thoughts to fix it.

King Regards
Katerina

Katerina,

the logic for combining the box boundaries when merging data files makes some assumptions that are not always true.
if you want to avoid issues, you adjust the box boundaries before merging so that box sizes are the same.
this can be tricky, if you have atom positions with image flags != 0. otherwise, it is just a simple editing job with a good text editor.

axel.

Katerina,
the logic for combining the box boundaries when merging data files makes some assumptions that are not always true.
if you want to avoid issues, you adjust the box boundaries before merging so that box sizes are the same.
this can be tricky, if you have atom positions with image flags != 0. otherwise, it is just a simple editing job with a good text editor.

Hi Katerina.
   Alternatively, since you are already using moltemplate, you can
also use it to merge 2 data files together:

   Incidentally, there are also ways to merge data files using
topotools. (Try using two readlammpsdata commands and one
writelammpsdata command.)

Cheers
Andrew

P.S. I would suggest editing the original "system.lt" file so that it
creates both the wall AND the polymer solution. However if the
coordinates for the wall OR the polymer solution were generated with
PACKMOL, then this won't work. Unfortunately moltemplate does not yet
have a way to read coordinates from an external file unless that file
contains the same number of atoms as the entire system.

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

Dear all,

Thank you very much for your reply and help!

Andrew, I had already tried to combine the data files using moltemplate, based on the instructions in the link (using ltemplify.py) that you also mentioned it in the email. Everything went well and it was a quite nice method but the new data file was a mixture of everything together, not a wall-solution interface, and I guess it might be because the x y z of the beads in each data files (system1.data and system2.data) were for unwrapped structure. Because when I opened the new data file with VMD, it somehow showed the wall position and solution position and their interface (not very well-stablished), but after wrapping pbc it went to mixture of everything. I tried to edit data files with x y z of the wrapped structure of each of them but the result was the same. Because of this I was trying read_data, that you had also mentioned in that link .

King Regards
Katerina

Hi Katerina
    I'm curious to know what you mean by "mixed together". Was the
order of the atoms in the combined data file mixed together, or their
positions? (If you send me your data files, I'll take a quick look.)
-Andrew

Hi Katerina
    I'm curious to know what you mean by "mixed together". Was the
order of the atoms in the combined data file mixed together, or their
positions? (If you send me your data files, I'll take a quick look.)
-Andrew

(I forgot to add a reminder: Don't post your files to the list
because it fills up everybody's email. Probably you did not need this
reminder anyway, but I thought I'd mention it.)