read a dump file

Hi,

I am trying to write a code where i need to read the dump files i got in
my earlier simulation. I need to fed the data which i am getting from
dump files, in an altogether different program. I am approaching thew
way by which a data file can be read but it is not working. So, how it
can be done?

thanks in advance

best,

The format of a dump file is transparent, so
it's a straightforward exercise in programming to
read one. See the src/read_dump.cpp file in
LAMMPS for some C++ that does it. See
tools/python/pizza/dump.py for some Python
that does it.

Steve

Hi,

I am trying to write a code where i need to read the dump files i got in
my earlier simulation. I need to fed the data which i am getting from
dump files, in an altogether different program. I am approaching thew
way by which a data file can be read but it is not working. So, how it
can be done?

if it "is not working", that means, you are not doing it correctly.
since nobody here can read your mind, we cannot tell you
what is wrong. one important question is, *which* information
is it that you need to read from the dump into your own program?

axel.

Hi,

I am trying to write a code where i need to read the dump files i got
in
my earlier simulation. I need to fed the data which i am getting from
dump files, in an altogether different program. I am approaching thew
way by which a data file can be read but it is not working. So, how it
can be done?

if it "is not working", that means, you are not doing it correctly.

It 'is not working' in the sense that as a dump file starts with some
initial character, i.e step no, boundaries etc. ,general procedure of
reading it like a data file is not working.

since nobody here can read your mind, we cannot tell you
what is wrong. one important question is, *which* information
is it that you need to read from the dump into your own program?

In my simulation I need to draw bonds,which are already defined in my
initial read_data file.So a create/break bond will not suffice my
purpose. Now as time goes i need to look the bond dynamics. that is why
the current position of atoms are required and which I have to read from
the dump files.

Thanks,

if it "is not working", that means, you are not doing it correctly.

It 'is not working' in the sense that as a dump file starts with some
initial character, i.e step no, boundaries etc. ,general procedure of
reading it like a data file is not working.

what does "like a data file" mean?

the format of a dump file is very well defined.
and, as steve wrote, it is fairly straightforward
to implement a reader code for it to import the
data into another program.

since nobody here can read your mind, we cannot tell you
what is wrong. one important question is, *which* information
is it that you need to read from the dump into your own program?

In my simulation I need to draw bonds,which are already defined in my
initial read_data file.So a create/break bond will not suffice my

i don't see the connection.

purpose. Now as time goes i need to look the bond dynamics. that is why

if you use bonds defined in the data file,
how is there going to be bond dynamics?

the current position of atoms are required and which I have to read from
the dump files.

yes, so what. as you were told. the format
of a dump file is easy enough to comprehend.
just skip over the parts you don't care about.

apart from that, it looks that what you describe
can already by done by existing visualization tools.
so why do you need to re-do what those program
can do?

axel.

Alas this is one of the few things missing from a dump file. (I don't
know how hard it would be to add the option to include bond
information in a dump file, but even if Steve did it, I don't know how
long before VMD would support it.) Restart files have this
information but you need to make many of them (one for each moment in
time you wish to examine).

You could use the new "rerun" lammps command to read an existing dump
file. Then (I think) you can use the "restart" command to generate
restart files at regular intervals. (Would that work?) Then, outside
of lammps (using the bash or tcsh shell) you could create a loop which
converts each restart file to a DATA file (using the "restart2data"
utility).

Then you could read each DATA file with your program.

Alternately, if you know how o use VMD, you could start VMD, click on
the "Extensions->Tk Console" menu option, and write a loop to read
each data file using topotools (and render it or process it some other
way).

I hope this gets you started.
Cheers!

Andrew

hi,

i’m sorry to bump in, but doesn’t compute property/local allow you to output bond information into a (second) dump file?..
doc: http://lammps.sandia.gov/doc/compute_property_local.html

having all the necessary information you can either use the pizza.py tollkit or hack together your own scripts to do whatever things you want to your data.

best,

nikita

Hello

I'm reposting my previous methods, with some web page links (in case
it helps). Feel free to ignore.

You could use the new "rerun" lammps command to read an existing dump
file.

http://lammps.sandia.gov/doc/rerun.html

Then (I think) you can use the "restart" command to generate
restart files at regular intervals. (Would that work?)

http://lammps.sandia.gov/doc/restart.html

Then, outside
of lammps (using the bash or tcsh shell) you could create a loop

http://www.cyberciti.biz/faq/linux-unix-applesox-bsd-bash-cstyle-for-loop/

which
converts each restart file to a DATA file (using the "restart2data"
utility).

http://lammps.sandia.gov/doc/Section_tools.html#restart

Then you could read each DATA file with your program.

Alternately, if you know how o use VMD, you could start VMD, click on
the "Extensions->Tk Console" menu option, and write a loop to read
each data file using topotools (and render it or process it some other
way).

I hope this gets you started.

Cheers!

Andrew

purpose. Now as time goes i need to look the bond dynamics. that is why

if you use bonds defined in the data file,
how is there going to be bond dynamics?

Alas this is one of the few things missing from a dump file. (I don't
know how hard it would be to add the option to include bond
information in a dump file, but even if Steve did it, I don't know how
long before VMD would support it.) Restart files have this
information but you need to make many of them (one for each moment in
time you wish to examine).

please remember, that for practically all simulations
that *do* define bonds in a lammps data file, the bonding
information doesn't change over the course of a trajectory.

hence it doesn't really need to be stored in the trajectory.
you can just read it in once, e.g. from the data file, or
even better with additional per-atom non-varying info:
https://sites.google.com/site/akohlmey/software/topotools/topotools-tutorial---various-tips-tricks#TOC-Reconstruct-a-.pdb-.psf-files-from-a-LAMMPS-data-file-for-use-with-visualization-programs

VMD's internal data structure don't support changing
of the topology during a trajectory anyway. so anything
that goes beyond that, would have to be implemented
in add-on scripts that hook into the animation loop.
LAMMPS already supports dumping the bond information
into a special format dump file (for cases using bond/swap,
bond/create and so on).

however, for cases where you would want recompute
bonds dynamically based on a distance criterion (as
indicated by the OP), you can just use one or more of
the "DynamicBonds" representation in VMD and be
done with it

You could use the new "rerun" lammps command to read an existing dump
file. Then (I think) you can use the "restart" command to generate
restart files at regular intervals. (Would that work?) Then, outside
of lammps (using the bash or tcsh shell) you could create a loop which
converts each restart file to a DATA file (using the "restart2data"
utility).

yes, this would work, and it would also be supported by VMD
by reading each data file into a new molecule and then using
the "multimolanim" plugin/extension, which animates the display
by switching individual restart files on and off. but this is needlessly
complicated. it can be even done from within LAMMPS using "shell"
command.

Then you could read each DATA file with your program.

i think there may be a confusion may be about what is
understood by a "data" file. within lammps 'slang' it is
yet another well defined file format, but it seems the
OP expected the dump to just have a list of coordinates
without any additional info or structure.

axel.

I'm reposting my previous methods, with some web page links

oops. I meant "previous message"

i'm sorry to bump in, but doesn't compute property/local allow you to output bond information into a (second) dump file?..

doc: http://lammps.sandia.gov/doc/compute_property_local.html

There is also a nice example how to use it here:
http://lammps.sandia.gov/doc/compute_bond_local.html

Thank you Nikita. I did not know about this command.
It would be much better to print out the bond information this way
than to use the method I suggested.

having all the necessary information you can either use the pizza.py tollkit or hack together your own scripts to do whatever things you want to your data.

I'm glad I posted my message because it was nice to get this reply.

Thanks!

Andrew

if it "is not working", that means, you are not doing it correctly.

It 'is not working' in the sense that as a dump file starts with some
initial character, i.e step no, boundaries etc. ,general procedure of
reading it like a data file is not working.

what does "like a data file" mean?

the format of a dump file is very well defined.
and, as steve wrote, it is fairly straightforward
to implement a reader code for it to import the
data into another program.

Thanks Axel for your suggestion . Actually I just need not to include the
first few lines in my dump file. I want it to dump the atom informations
only without including timestep,boxsize etc. How does it possible ?

Thanks Axel for your suggestion . Actually I just need not to include the

first few lines in my dump file. I want it to dump the atom informations
only without including timestep,boxsize etc. How does it possible ?
>

what difference does it make, if you
don't write it or you don't read it?

absolutely none.

axel.