[lammps-users] About read_data and read_restart

Dear LAMMPS users,
After one run, I need add more atoms to my current simulation restarted by a restarting file. But I encountered this problem for my second run.
*Cannot read_data after simulation box is defined*
The read_data command cannot be used after a read_data, read_restart, or create_box command.
*Cannot read_restart after simulation box is defined*
The read_restart command cannot be used after a read_data, read_restart, or create_box command.
I couldn't use "read_data" which is for the information of added atoms and "read_restart" commands simultaneously. How to solve this problem?

Your help would be most appreciated.

Sincerely
Yajie Lei

I couldn't use "read_data" which is for the information of
added atoms and "read_restart" commands simultaneously. How to solve
this problem?

Use restart2data to convert the restart file to a plain text data file, add
the atoms to the data file, and use read_data for the combined data file
in your LAMMPS input script.

Hope this helps,

  Lutz

Dear Lutz,

Thank you very much for your reply.

I tried as you said, unfortunately it didn’t work for my case. Because in my case, I have two styles of atoms. One is the tip4p water molecule (full style) and the other is CH3 group (just Lennard-Jones particles, atomic style).

So when I did my initial run, I generated the CH3 group using create_atoms command in the input file directly, and read in water molecules through read_data command.

But now, if I read in both of them through read_data, the number of atoms and bonds/angles are not match. So I got “ERROR: Bonds assigned incorrectly”

Any idea you have about this problem?

Any help would be most appreciated.

Sincerely
Yajie

Dear Yajie,

Lutz's reply was accurate, but incomplete. No, you can't mix
and match styles of atoms and just plonk the coordinates for
your new atoms at the end of another data file.

What you need to do is combine the data file from the restart
and the data file for your additional atoms into a single
coherent data file. You probably need to convert your
additional atoms to have the full style, update the headers for
the combined file, and update all the topological sections so
they reflect your combined system.

Joanne Budzien

Dear Joanne,

I made the new read-in file right as you said. But I still got problem. The attached is the read-in file. Among these 12448 atoms (3072 newly added), there are 160 atoms are just LJ particles (id from 9217 to 9296 and from 9297 to 9376), but they are still written in full style with the molecule id “0” and charge “0”. Actually it’s included in the initial run, so I got this from the conversion of restarting file directly.

The corresponding information of the newly added water molecules are written from 9399 lines, 18618 lines and 23741 lines in atoms, bonds and angles blocks, respectively.

From the header, we can see the number of bonds and angles are calculated only based on 12448-160 = 12288 water atoms, not the whole atoms. Right this induced the problem. The code seems require the number of bonds and angles must be match with the total atoms number. So I got the following in the log file

atom_style full
read_data tip4p_new2.dat
2 = max bonds/atom
1 = max angles/atom
orthogonal box = (-0.02 0 0) to (63 200 32)
2 by 9 by 1 processor grid
12448 atoms
8300 bonds
ERROR: Bonds assigned incorrectly

Why the bonds number shows as 8300, while the input is indeed 8192 (=12288*2/3)?

Any idea about this? How exactly should I modify the header?

Any help would be most appreciated.

Best
Yajie

tip4p_new2.dat (1.46 MB)

Dear Yajie,

Try sorting by id in your Atoms block. If I recall correctly,
dealing with TIP4P requires the atoms to be in a specific order
(O H H) when read from the data file. Another likely problem
is that I don't think you have all the atoms you think you have
or they are not numbered uniquely. A search for 12448 does not
give any atoms with that id and the last numbered atom that I
can see is 12288. A search for 12289 does not uncover any
atoms with that id.

Joanne Budzien