[lammps-users] Precision of output from fix-type commands

Hi everyone,

Is there a default value for the precision of fix-type commands? If so, what is it? Is there a manual entry for that information? I searched for it, but couldn’t find it.

Thank you beforehand for the assistance provided,

I don’t quite understand what you are asking for. Can you please elaborate some more? And perhaps provide an example of what you are looking for? And what you get instead?

Hi Axel,

I’m referring to the precision of the values output by fix-type commands, meaning if there’s a default number of decimal places or significant figures with which they output data. For example, does fix ave/time always output values with 6 decimal places or 6 significant figures by default? Or 4 or 8? Could the precision with which a different fix (like fix ave/chunk) outputs data be different from fix ave/time’s output precision or are all fixes set to output data with the same precision by default?

Please let me know if I still wasn’t able to clarify my question.



First off, it would be helpful if you stick with the nomenclature used in the manual. That will make it significantly easier to be understood.
There is no mention of “fix-type commands”; it either mentions “fix styles” or “fixes”.

Second, each fix that creates output uses its own code to write out the data, so you have to look at the documentation of the individual fix command.
Taking your fix ave/time example. It supports the “format” keyword and here is what the docs for fix ave/time say about using the format keyword:

The format keyword sets the numeric format of each value when it is printed to a file via the file keyword. Note that all values are floating point quantities. The default format is %g. You can specify a higher precision if desired, e.g. %20.16g.

The default is that of the stdio library’s fprintf() %g format, which is indeed six digit precision. Mind you, for most properties that you’ll typically output with fix ave/time the statistical error will be larger, not to mention any systematic errors. So producing larger files with more digits precision is not necessarily giving you more accurate results. Of course, there are exceptions, otherwise there would be no “format” keyword. :wink:


Hi Axel,

Great! Thanks for the information! I’ll try to pay more attention to the language in the manual next time!

All the best,