A problem in ave/spatial source code?!

Hi lammps community,
I was looking into modifying fix ave/spatial in order to adapt it to my needs but I think there is part of the code which can incorrect or maybe I’m not understanding it well.
Here is the problem:
In line numbers 74 through 77 of the “fix_ave_spatial.cpp” unless the input origin is “upper” the else part would change the value of originalflag[ndim] to 3 (COORD) where after that the “if” in line 78 will be valid to set the value for “origin[ndim]” however since there is nothing for that in the input it will set it to 0. But that would work fine if the origin is “upper” in the input file as it won’t go into the “else” part.

Would you please take a look and let me know your opinion?

Best,
Kasra.

yes it should be

if (strcmp(arg[iarg+1],"lower") == 0) originflag[ndim] = LOWER;
    else if (strcmp(arg[iarg+1],"center") == 0) originflag[ndim] = CENTER;
    else if (strcmp(arg[iarg+1],"upper") == 0) originflag[ndim] = UPPER;
    else originflag[ndim] = COORD;
    if (originflag[ndim] == COORD) origin[ndim] = atof(arg[iarg+1]);

I'll post a patch.

Thanks,
Steve