Storing values inside a loop to a vector

Dear all,

I have a loop in lammps where a minimization is done with each iteration. I would like to be able to save (pe) and (lz) in a vector after each iteration and use the vectors after the loop (to find their minimum for instance). Ideally it would look like this:

variable n loop 5
label loop
minimize 1.0e-8 1.0e-8 100000 100000

variable aa[n] equal (lz)

next n
jump loop

I would appreciate any help with this problem.

Thank you,


The fix vector command will accumulate values to a growing vector.

In your context, you might have to run for 1 step after each

minimize loop to trigger the accumulation. If you don’t have

an integrate fix, like fix nve, defined, then the single step

shouldn’t change the positions of the atoms.