Issue with Formatting Output in fix ave/time in LAMMPS

Hello,
I am trying to compute and output the ensemble-averaged temperature, density, potential energy, and pressure at regular intervals using fix ave/time. Here is my input script setup for this:

variable        Nevery equal 20                      # Interval between samples
variable        Nrepeat equal 50                     # Number of samples per output
variable        Nfreq equal ${Nevery}*${Nrepeat}     # Dump interval in timesteps

variable        PotentialEnergy equal epair          # Intermolecular potential energy
variable        Pressure equal press                 # Pressure
variable        Temperature equal temp               # Instantaneous temperature
variable        Density equal density                # Instantaneous density (constant in NVT)

fix             3 all ave/time ${Nevery} ${Nrepeat} ${Nfreq} v_Temperature v_Density v_PotentialEnergy v_Pressure file ave.dens_22.0molL.out format %.8g

However, the output in ave.dens_22.0molL.out is not correctly formatted, as shown below:

1000420.511150.26300238-18.370889-18.354308
2000424.111450.26300238-16.91667823.93726
3000464.324120.26300238-18.9005488.4650328
4000399.550970.26300238-15.868167-38.686129
5000408.507930.26300238-16.494046-2.7042454
6000381.504730.26300238-15.7896062.7654269
7000480.708520.26300238-16.7811928.5100138
8000398.65490.26300238-17.66598623.739291

It seems that values are concatenated without proper spacing or separation.

I would like the output to be formatted correctly, with each value properly spaced or tab-separated, like:

1000 420.5111 50.2630 0238 -18.370889 -18.354308
2000 424.1114 50.2630 0238 -16.916678 23.93726
3000 464.3241 50.2630 0238 -18.900548 8.4650328

Could someone suggest how to properly format the output in fix ave/time? Is there a specific format string or additional option I should use to ensure correct spacing?

Thank you in advance for your help!

Your format string does not include any space, so you get what you are asking for.
The default format string is " %g" and includes a space for separating columns.

2 Likes

Thank you, this worked.