Hi all,
I seem to be misunderstanding the use of read_data with the “add append” keywords, and I can’t figure out where I’m going wrong. I’m trying to create a simulation of a LJ fluid over a substrate. The fluid atoms are created with the create_atoms command, then the substrate is added via a “read_data filename add append” command.
My test input file is:
#----
units metal
dimension 3
boundary p p f
lattice sc 3.840
region liquidbox block 0 7.680 0 7.680 1.920 5.760 units box
region simbox block 0 7.680 0 7.680 -5.702 5.760 units box
create_box 2 simbox
create_atoms 1 region liquidbox
mass 1 5.0
read_data substrate.data add append group S
set group S type 2
mass 2 1.0
dump test all custom 25 “substrate.lammpstrj” id type mass xu yu zu
dump_modify test sort id
run 0
#----
The file substrate.data contains the positions of 16 atoms, all assigned type 1.
I expected this input to create four type 1 atoms with mass 5, then add 16 atoms from the data file as type 2 atoms, since my understanding is that “add append” should increment the atom type found in the data file by 1 (since there is 1 atom type in the current system when the read_data command is reached). Instead, I get 20 atoms, all of type 1.
I can manually assign the 16 substrate atoms to type 2 by uncommenting the “set group S type 2” line, but that has the problem that the read_data command resets the mass of the type 1 atoms.
Clearly I’m misunderstanding something fundamental. Thanks for your time and assistance. The text of the substrate.data file is below.
LAMMPS data file. atom_style atomic generated by CGG on Thu 18 Sep 2025, 02:41 PM
16 atoms
1 atom types
0 7.680 xlo xhi
0 7.680 ylo yhi
-5.431 0 zlo zhi
Masses
1 28.0855 # SI
Atoms # atomic
1 1 1.920 0.000 -4.073 # SI
2 1 0.001 0.000 0.000 # SI
3 1 3.840 0.000 0.000 # SI
4 1 1.920 1.920 -2.715 # SI
5 1 0.000 1.920 -1.358 # SI
6 1 0.000 3.840 0.000 # SI
7 1 5.761 0.000 -4.073 # SI
8 1 3.841 1.920 -1.358 # SI
9 1 5.761 3.840 -4.073 # SI
10 1 5.761 1.921 -2.715 # SI
11 1 3.841 3.840 0.000 # SI
12 1 5.761 5.760 -2.715 # SI
13 1 1.920 3.840 -4.073 # SI
14 1 0.001 5.760 -1.358 # SI
15 1 3.840 5.760 -1.358 # SI
16 1 1.920 5.761 -2.715 # SI