Printing thermodynamic data in a file using fix ave/time

Hi!

Because I have issues with the supercomputer I’m using to run simulations, where parts of the printed thermodynamic data gets overwritten by itself (as if processor 1 started printing while processor 2 was already printing, resulting in some data getting cropped out of the file generated by using the log function), but not when printing into a separate file (for example a .xyz file using dump), I wanted to know if it was possible to print the thermodynamic data of a simulation into a file with a function such as fix ave/time.

The idea would be that it would, every 1000 timesteps for example, average the last 1000 timesteps and print them in a .results file for example, in the same way it prints data using the thermo_style function. Increasing the accuracy of results as my analysis would be done on the entire timesteps rather than a fraction of them, as log only prints the state at a given timestep.

I have tried doing a fix ave/time on the fix npt I use to run my simulation, but from what I can tell, it’s printing the NPT temperature ramp information, rather than the thermodynamic information, such as the temperature and the enthalpy.

Reading through the documentation I haven’t found a function that would allow this manipulation of data to print it in a file, other than log, which has the issue of getting overwritten by itself. Am I missing something? Thanks!

Any help would be greatly appreciated,
Thanks a lot!
Antoine.

all thermodynamic data keywords are accessible to equal style variables and those can be processed and output by fix ave/time.
please note, that certain data is only available on timesteps where also thermodynamic data is written (e.g. pressure or potential/total energy), as this requires an underlying compute to tell LAMMPS on which timesteps to collect the information. this can be circumvented by issuing those computes directly as fix ave/time will then indicate when it accesses those computes and will then trigger the collection of data. this will also cause some slowdown, as additional computations are required.

axel.

Awesome, thanks! I understand what you mean!

Would there be the same slowdowns if I were to use a fix print to print those thermodynamic data called through equal style variables at the same timesteps as the thermodynamic data gets printed, or would the slowdown be circumvented since LAMMPS would have already had to calculate those values and would then simply print them? Although this wouldn’t have the advantage of the higher accuracy if I understand correctly.

Thanks again!
Antoine.

Awesome, thanks! I understand what you mean!

Would there be the same slowdowns if I were to use a fix print to print those thermodynamic data called through equal style variables at the same timesteps as the thermodynamic data gets printed, or would the slowdown be circumvented since LAMMPS would have already had to calculate those values and would then simply print them?

the latter. how much of a slowdown you see depends very much on the system size and settings as well as the overall computational cost of active styles. e.g. when using fix npt, computation of pressure is “free”, since fix npt already needs it (in every step). when using “expensive” pair styles, the cost of accumulating energy or stress data can be negligible.

it doesn’t matter whether you use fix print or fix ave/time. either will signal to computes the next timestep needed. and you can do the same kind of non-averaged output with fix ave/time as well (just have only one repetition per output).

Although this wouldn’t have the advantage of the higher accuracy if I understand correctly.

“accuracy” is probably not the correct term in this context, as this would refer to the correctness of the model. you either need to talk about “precision” or “statistical convergence”. for the former, you can adjust the output format (but outputting double precision floating point numbers with more than 15 digits (relative) precision is useless), for the latter you have to consider the “statistical relevance”. averaging over data collected from every step is if little statistical meaning, since the data is highly correlated and thus of low statistical relevance. in other words, averaging too frequently does not really improve the statistics. it only makes it look like it does when you assume independent samples.

HTH,
axel.

Awesome thanks, that was really helpful! Have a nice day!
Antoine.