Slicing arrays

Dear all,

Sorry to reiterate the question, I don't know whether it went unnoticed or the answer is too obvious. The ave/chunk command returns global arrays (with multiple columns), I would like to extract one (or more) column(s) to perform operations such as slope(x) with the variable command. With what syntax can I do this?
Thank you.

Best regards.
Jonathan Severin

sorry, don’t remember this Q.

From the variable doc page:

Special functions take specific kinds of arguments, meaning their arguments cannot be formulas themselves.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.

Steve

Steve,

I’m confused, I use chunk/atom + ave/chunk to calculate the temperature in 12 parallel layers. I think the ouput of ave/chunk should be a global array with 12 rows and 3 columns since I’m using bin/1d. So if I understand your answer correctly, a syntax such as f_ID[N] should give me the Nth column of my output array?
Yet when I apply the slice compute on f_ID[3], it only works if Nstart=Nstop=1. What did I do wrong?
Here’s the relevant part of my input script (which returns an “accessed out-of-range” message for compute slice):

compute myKe all ke/atom
variable myTemp atom c_myKe/1.5/8.61733e-5
variable Nlayers equal 12
variable thick equal 1.0/{Nlayers}+1.0e-15 compute cc1 all chunk/atom bin/1d z 0.0 {thick} units reduced
fix 3 all ave/chunk 10 50 500 cc1 v_myTemp file profile_myTemp.heat
compute mySlice all slice 4 9 1 f_3[3]
variable pente equal slope(c_mySlice)
thermo 500
thermo_style custom step temp pe ke press fnorm c_Thot c_Tcold v_pente
fix 1 all nve
run 5000

The issue is probably that fix ave/chunk doesn’t know
how many chunks there are and thus the number of
rows at step 0. Not until it starts computing something,
So if you try to do your slice on step 0 for thermo output
on step 0, there is only 1 row in the array (the dummy size).

Try running for 500 steps w/out the slice output, then
re-define your thermo_style with the slice output,
and continue running, and see if that works.

Steve