Problem on "ERROR: Invalid atom type 2 in Masses section of data file: 1 12.011"

Dear all,
I am currently using LAMMPS 64-bit 21Nov2023 version.

I am restarting a file that has been relaxed in p p p boundaries. I restarted this to change the boundary conditions.
I also want to read a data file into this, but keep getting “ERROR: Invalid atom type 2 in Masses section of data file: 1 12.011”

If I set the offset to 0 0 0 0 0, this works. However, what I want is to have two different particle types, one for the atoms from the restart and the other from the read_data file.

###The start of the code is like this:

read_restart restart_relaxed.equil
change_box all x final 0 39.27 y final 0 39.27 z final 0 70 boundary p p f units box
read_data add append offset 1 0 0 0 0

###my file is like this:

LAMMPS data file via write_data, version 21 Nov 2023, timestep = 0, units = metal

383 atoms
1 atom types

0 39.27 xlo xhi
0 39.27 ylo yhi
0 70 zlo zhi


1 12.011

Atoms # atomic

1 1 18.7425 13.3875 63.3675 0 0 0
2 1 22.3125 13.3875 63.3675 0 0 0
3 1 14.28 16.064999999999998 62.474999999999994 0 0 0
4 1 16.064999999999998 14.28 62.474999999999994 0 0 0

I tried to read the document about read_data command, but I cannot fully understand how to load the data file as separate particle type apart from the ones from the restart.

Thank you.

The problem originates with your “read_restart” command. The number of total atom types (and bond types, angle types etc.) is locked in when the simulation box is created. That happens during read_restart and you cannot change that.

The only way to change the number of atom types is by converting the restart file to a data file and then use the read_data command with the suitable extra/* commands to add the necessary types for the second data file, e.g. “extra/atom/types 1”.

Thank you sir for the detailed reply. I used extra/atom/types 1 and now it is working.

I guess my previous relaxation is usuless and have to relax all over again after read_data

Thank you