I need to perform a dynamical simulation where the z-direction forces on particles are sampled using a python function. The python function that I am utilizing reads a tabular data of pre computed z-position and fz-values on a 1D grid, and returns an interpolated value of fz (float) for a given value of z (float). Here is a pseudocode
f = perform_interpolation;
fzval = f(input_zpos);
Now, I want to use this function to create an atom style variable like
compute peratom ION property/atom z
variable samplefz atom interpolated1dfz(v_peratom)
This variable would be used somewhere in addforce fix later in the script.
Ignore the incorrect syntax on the variable command, but is it possible define atom style variable using it this way? Or do I have to update the per atom fz inside of python, by looping over all atoms in the group?