Using FFT library in LAMMPS

Dear LAMMPS users,

I am trying to evaluate the possibility filtering the per atom instantaneous velocity into high-frequency and low-frequency components using FFT from within the atc fix in LAMMPS based on a cut-off frequency. I am trying to do this during the run and not as a post-processing operation. So the rough idea is to do the following:

  1. Store velocity components (v_x,v_y and v_z) for each atom for N time steps in a queue where N is the length of the fft. This queue will be enqueued till size N has been reached. Once it has reached size N, the following will be done for each atom after the latest time step velocity is enqueued and the oldest time step velocity is dequeued:

  2. Forward transform each of the three velocity components from time domain to frequency domain

  3. Separate the high frequency from low frequency based on a cutoff frequency and create two copies of the frequency domain data where the data contained is exclusive of each other.

  4. Inverse transform the high frequency data to obtain the high frequency velocity and correspondingly for the low frequency velocity.

  5. Since I need the instantaneous high frequency and low frequency velocity, only the latest time step velocity is used from the inverse transformed data.

I need some advice on how to implement it using the fft libraries in LAMMPS. I looked through the code and found an fft3d_wrap class in the KSPACE package. Can I use this to do ID fft using kissfft? I am not familiar with the usage (I am confused by the create_plan method parameters). Is there some example for the usage? Any comments about the idea velocity filtering idea itself is greatly appreciated. For now, the test problem will have a small number of atoms (<1000), the fft length will also be small (N=1024) and will be run serially in a single process.

Thank you,
Stephen Thomas.

Dear LAMMPS users,

I am trying to evaluate the possibility filtering the per atom instantaneous
velocity into high-frequency and low-frequency components using FFT from
within the atc fix in LAMMPS based on a cut-off frequency. I am trying to do
this during the run and not as a post-processing operation. So the rough
idea is to do the following:

1) Store velocity components (v_x,v_y and v_z) for each atom for N time
steps in a queue where N is the length of the fft. This queue will be
enqueued till size N has been reached. Once it has reached size N, the
following will be done for each atom after the latest time step velocity is
enqueued and the oldest time step velocity is dequeued:
2) Forward transform each of the three velocity components from time domain
to frequency domain
3) Separate the high frequency from low frequency based on a cutoff
frequency and create two copies of the frequency domain data where the data
contained is exclusive of each other.
4) Inverse transform the high frequency data to obtain the high frequency
velocity and correspondingly for the low frequency velocity.
5) Since I need the instantaneous high frequency and low frequency velocity,
only the latest time step velocity is used from the inverse transformed
data.

I need some advice on how to implement it using the fft libraries in LAMMPS.
I looked through the code and found an fft3d_wrap class in the KSPACE
package. Can I use this to do ID fft using kissfft? I am not familiar with
the usage (I am confused by the create_plan method parameters). Is there
some example for the usage? Any comments about the idea velocity filtering
idea itself is greatly appreciated. For now, the test problem will have a
small number of atoms (<1000), the fft length will also be small (N=1024)
and will be run serially in a single process.

if all you want to do are local 1d-FFTs, you can just call kissfft
directly. that will likely be easier than going through fft3d_wrap.
which parameters about create_plan are you confused about?

axel.

Hi Axel,

I wasn’t sure what the parameters nfast, nmid and nslow meant.

When I tried to include fft3d_wrap in my lib classes, I realized that it will be easier to just call the original kissfft library instead. So, I copied the kissfft files into the libary folder to call the kissfft functions directly.

Thank you,
Stephen Thomas.

Hi Axel,

I wasn't sure what the parameters nfast, nmid and nslow meant.

these are the grid dimensions in the 3 directions. since the whole set
of grid values is stored in one large contiguous chunk (i.e. fortran
style), you have the slowest, middle and fastest moving index to do
the nested loops over all grid points.

When I tried to include fft3d_wrap in my lib classes, I realized that it
will be easier to just call the original kissfft library instead. So, I
copied the kissfft files into the libary folder to call the kissfft
functions directly.

yup.

good luck with your project,

axel.