How to dump cputime and simulation time in a file ?

Hi all,

I would like to plot the curve cpu time vs simulation time. Therefore, I would like to dump the cpu time and simulation time (cpu and time in thermo_style) but I can’t find the way to dump these quantities in a file. LAMMPS complains that they are not atom-style variables.

Could anyone help me please ? Many thanks in advance.
Christophe

Hi all,

I would like to plot the curve cpu time vs simulation time. Therefore, I
would like to dump the cpu time and simulation time (cpu and time in
thermo_style) but I can't find the way to dump these quantities in a file.
LAMMPS complains that they are not atom-style variables.

​yes. that is the expected behavior. there is currently no way to encode
additional per timestep data into a dump,
but you can easily print such properties to a file using fix print, for
example. or just post-process the thermo output.
please note that there are also the parameters tpcpu and spcpu, which
directly output a performance measure as simulation time per walltime
second and number of timesteps per walltime second.

axel.​

It is possible to coerce LAMMPS into writing arbitrary global quantities to a dump file, by copying the global quantity into an vector of per-atom quantities. There are many disadvantages to doing this, including duplicated I/O and general confusion, but it can be done. For example, to get CPU time and temperature in the dump file, you could do:

variable cpucopy atom cpu
variable tempcopy atom temp
dump xyzcpu all custom 100 dump.melt id type x y z v_cpucopy v_tempcopy

ITEM: ATOMS id type x y z v_cpucopy v_tempcopy
1 1 16.6769 0.0616027 16.7796 0.21425 1.64584
2 1 0.477023 0.989436 0.10456 0.21425 1.64584

One wrinkle is that cpucopy remains zero until after the second thermo output.

Aidan

It is possible to coerce LAMMPS into writing arbitrary global quantities
to a dump file, by copying the global quantity into an vector of per-atom
quantities. There are many disadvantages to doing this, including
duplicated I/O and general confusion, but it can be done. For example, to
get CPU time and temperature in the dump file, you could do:

variable cpucopy atom cpu
variable tempcopy atom temp
dump xyzcpu all custom 100 dump.melt id type x y z v_cpucopy
v_tempcopy

​yeah, that is indeed brutal. i was thinking more along the lines of having
and additional section in the files, e.g. where then global variables (and
vectors?) could be added

ITEM: METADATA​
cpu: 0.21425
time: 0.012
temp: 1.64584

....

and so on. well written tools for reading native LAMMPS dump files should
skip over unkown sections like this. tools with support for such metadata
could be educated to look for compatible info in this.

axel.

Dear Axel and Aidan,

Thank you very much for your advices. I will try your suggestions.

With best regards,
Christophe