find maximum value in vector

Hello everybody,

I searched the manual and the maillinglist for that, but I couldn't find an answer, so sorry, for that simple question:

How can I access the maximum value of an vector, e.g. I have the command

compute kinE all ke/atom

and I'd like to find the highest kinetic energy of all the atoms...

Thanks in advance,

kind regards,

Sebastian

see the compute reduce command

Steve

Thanks Steve, that's what I was looking for!

But now I get an error message, I don't understand. I use these commands:

compute kinE all ke/atom
compute max_kinE all reduce max c_kinE
variable max_kinE equal c_max_kinE
print ${max_kinE}

ERROR: Compute used in variable between runs is not current

(actually I'd like to calculate the maximal velocity of a bulk of granular particles at a different place in the input-script by
variable max_v equal sqrt(c_max_kinE/mass*2)
)

I tried to use this sequence at various places in my input-script but the error message doesn't change...
What is the reason for that error?

Thanks in advance,

Sebastian

The "Variable Accuracy" section of the variable doc page discusses this.
Basically, you need to insure that the compute was evaluated at
the last timestep of the previous run, before you try to print
its value between runs. You could do this by dumping ke/atom
or printing that variable with thermo output.

Otherwise LAMMPS has no assurance that the compute's values
are current.

Steve