Replacement of fix ave/spatial command with fix ave/chunk in LAMMPS for measuring heat flux

Hi,

I am currently working on measuring heat flux using LAMMPS, and I encountered an issue with the fix ave/spatial command in my input script. After researching, I discovered that the “fix ave/spatial” command has been deprecated and replaced by the “fix ave/chunk” command in recent versions of LAMMPS. Here is the error it shows when I ran the script with “fix ave/spatial” command -

ERROR: This fix style is no longer available (src/fix_deprecated.cpp:55)
Last command: fix 4a all ave/spatial 1 1000000 1000000 x lower 10.0 v_atemp file 10Temperature.txt units box

My question is:

*(i) Can I simply replace the “fix ave/spatial” command with “fix ave/chunk” in my input script, or are there additional changes I need to make to ensure smooth execution? *
(ii) I would also like to know if using “fix ave/chunk” will produce the same output as “fix ave/spatial”, as I want to ensure the accuracy and consistency of my results.
(iii) Is there any way to still run input script with this “fix ave/spatial” command without error in LAMMPS?

I would greatly appreciate any expert opinions or insights on this matter. Thank you in advance for your help.

Regards,
Jobayer

(i) There are a few minor tweaks needed, see the documentation: fix ave/chunk command — LAMMPS documentation.
(ii) Yes
(iii) No

The change was implemented in 11 December 2015 version, which was 7 1/2 years ago and thus it is not exactly a “recent” change: 5.15. Removed commands and packages — LAMMPS documentation

You would have to take the source code from before the 11 December 2015 version and port it to the current version of LAMMPS so it can be compiled and used. 4.10. Notes for updating code written for older LAMMPS versions — LAMMPS documentation

The LAMMPS developers do not endorse this approach, as the chunk mechanism can reproduce the behavior of the old code plus offers more flexibility and additional features. Also, any bugs present in the old code are not fixed, unlike those reported for the new version.

Here is an example of a 1D density profile from fix ave/chunk that could previously be done with fix ave/spatial:

compute         xbins all chunk/atom bin/1d x lower ${delbin} units box
fix             rhoprof all ave/chunk ${nevery} ${nrepeat} ${nfreq} xbins density/mass ave one file rhoprof_equil.dat