about variable max() function

Dear lammps users:

compute 1 all pe/atom
variable maxpe equal max(c_1)

I use “compute pe/atom command” for calculating per-atom potential energy.

Next,I would like to use “variable max() function” to get the largetest energy and let it to be a variable output.

But I got error message about “Mismatched compute in variable formula”

I went to lammps homepage and got a explanation about max() function:

"The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions each take 1 argument which is of the form “c_ID” or “c_ID[N]” or “f_ID” or “f_ID[N]”. The first two are computes and the second two are fixes; the ID in the reference should be replaced by the ID of a compute or fix defined elsewhere in the input script. The compute or fix must produce either a global vector or array. If it produces a global vector, then the notation without “[N]” should be used. If it produces a global array, then the notation with “[N]” should be used, when N is an integer, to specify which column of the global array is being referenced.

These functions operate on the global vector of inputs and reduce it to a single scalar value. This is analagous to the operation of the compute reduce command, which invokes the same functions on per-atom and local vectors."

So,i couldn’t put a per-atom compute in max() for getting the largest energy value.

Is there other way that I can let the largetest energy value to be a output variable?

Dear lammps users:

compute 1 all pe/atom
variable maxpe equal max(c_1)

I use “compute pe/atom command” for calculating per-atom potential energy.

Next,I would like to use “variable max() function” to get the largetest energy and let it to be a variable output.

But I got error message about “Mismatched compute in variable formula”

I went to lammps homepage and got a explanation about max() function:

"The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions each take 1 argument which is of the form “c_ID” or “c_ID[N]” or “f_ID” or “f_ID[N]”. The first two are computes and the second two are fixes; the ID in the reference should be replaced by the ID of a compute or fix defined elsewhere in the input script. The compute or fix must produce either a global vector or array. If it produces a global vector, then the notation without “[N]” should be used. If it produces a global array, then the notation with “[N]” should be used, when N is an integer, to specify which column of the global array is being referenced.

These functions operate on the global vector of inputs and reduce it to a single scalar value. This is analagous to the operation of the compute reduce command, which invokes the same functions on per-atom and local vectors."

So,i couldn’t put a per-atom compute in max() for getting the largest energy value.

Is there other way that I can let the largetest energy value to be a output variable?

The text you quoted above mentioned it: compute reduce

Axel

And you should read Section 6.15 of the manual to better
understand global vs per-atom quantities, which is
why you need to use compute reduce and not max().

Steve