Reading multiple text/data from files

Submitted by Bias on
arnom

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.

Thu, 15 Nov 2018 - 15:55 Permalink
Donald Trump

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!

Sun, 13 Sep 2020 - 15:07 Permalink
Donald Trump

In reply to by Donald Trump

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!

Sun, 13 Sep 2020 - 16:09 Permalink
richti83

I hit this problem a couple of times in the past, so I've written a small tool to convert the last dump file of a simulation to a read_data file AND to apply an offset to the atom id's:
https://fmbcloud.ovgu.de/s/H44o7T9kRkwMXMk
compile with g++ -o dump2read dump2read.cpp
usage: dump2read infile outfile Density ID_offset
please read the comments in the code and adjust to your dump file format.

Thu, 8 Oct 2020 - 22:29 Permalink

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