Reading multiple text/data from files

Bias's picture
Submitted by Bias on Tue, 10/23/2018 - 09:57

Hi,
I would like to read data of particles from multiple files, is it possible to do this? So right now for example I have a restart file with a "baseline" case that I would like to combine with a text file.

Right now I tried running:
read_data particle_wall.csv
read_restart restart.1

but I get the error when reading the restart file: "ERROR: Cannot read_restart after simulation box is defined". Is there a way to avoid the simulation box definition when running "read_data particle_wall.csv" I know that my particles will "fit" into the box for the restart file.

I guess its not possible then either to "merge" two different restart files?

Or is there another way to solve this? I was thinking maybe If I could use just a insert particles from text file?

Best regards
Tobias

arnom's picture

arnom | Thu, 11/15/2018 - 15:55

What you are doing obviously does not work and won't. So how can you work around it. You could do a read restart and then use and
include "additonal_particles.txt"
where in the addtional_particles.txt you have multiple create_atoms.

DCS team member & LIGGGHTS(R) core developer

Donald Trump | Sun, 09/13/2020 - 15:07

I also met this problem recently, I have a particle generation file and an already existing restart file, I wanted to read both of these two files. Then I met this
ERROR: Cannot read_data after simulation box is defined (../read_data.cpp:140)
I can't use randomly particle generating command, and I really need to read the data file and the restart file together.
Does anyone have suggestions to avoid that "simulation box already defined" problem when the second time I read the data file?
Thank you!

Donald Trump | Sun, 09/13/2020 - 16:09

Also When I tried to read data after I read restart file, I met this problem:
Reading data file ...
112414 atoms
for i= 56207
ERROR on proc 0: Atom from data file uses atom tag that is already used by atom in the simulation (../read_data.cpp:767)
It seems like the atoms in the restart file have the same ID or i number with the data file.
I can understand this error because both these two files came from different LIGGGHTS input file which will start marking the atom from 1.
But when I put them together, they will collide with each other for the tag numbers.
So how can I solve this problem? I want to set the tag numbers of atoms in the data file automatically follow the tag number in the restart file.
Thank you!