Dear All,

I want to do FFT on one of the variables in parallel MD simulation and then compute its time average.

Do I need to write my own code and add it to LAMMPS ? If so, Is there any existing function that I can use?

Thanks!

Wei

Dear All,

I want to do FFT on one of the variables in parallel MD simulation and then compute its time average.

Do I need to write my own code and add it to LAMMPS ? If so, Is there any existing function that I can use?

Thanks!

Wei

Dear All,

I want to do FFT on one of the variables in parallel MD simulation and then

compute its time average.

Do I need to write my own code

yes, most likely.

and add it to LAMMPS ?

not necessarily. it might be easier to write out

the data you want to transform and then post-process it.

If so, Is there any existing function that I can use?

not really. the only generic FFT interface that LAMMPS

has is a 3d-FFT class that is part of the KSPACE package.

axel.

What quantity do you want to take an FFT of?

It wouldn't be hard to create a compute fft command

that operated on what LAMMPS calls global variables,

e.g. a vector or column of an array. It could use

the KISSFFT library that comes with LAMMPS that

Axel added. The results of the FFT would then

be available via the compute for time averaging

or output.

Steve

Thanks, Steve. I hope to compute the FFT of z direction displacement of atoms.

Could you tell me more details about how to create a compute FFT command?

Wei

If you mean you want to compute an FFT where each

atom contributes a quantity, then that is different that

taking an FFT of a global quantity (meaning every processor

has a copy of it), that I mentioned in my previous email.

There are 2 issues with a per-atom quantity:

a) it implies either a parallel FFT or some kind of gather

of all the info to one proc

b) what order should the values be in to take an FFT?

just taking an FFT of displacements seems ill-defined.

Steve

Thanks, Steve,

Sorry, I did not make my point clearly.

The quantity that I hope to compute FFT is the mean squared z direction displacement which is averaged over all atoms, so it is a global quantity.

Wei

Sorry - this is still not clear. Is it a single # (which makes no sense).

Is it a histogram? How are you going to compute it within LAMMPS?

Presumably with some other fix or compute?

Steve

Steve, I use compute MSD command to get the mean squared z direction displacement, and then use fix ave/time to output the time average.

Wei

Again, what you are saying does not make much sense. 1d FFTs

are taken on a vector of values. What is in your vector of values,

how long is it, and where is it stored elsewhere in LAMMPS?

Neither compute msd or fix ave/time calculate or store a vector

of values. Once fix ave/time calculates a time-average for

some values over previous times, it has a single value, which

it writes to a file. It doesn't hold onto it.

Steve

Yes,Steve,you are right. Sorry I made a mistake, I used compute msd before,but the quantity I do fft is just squared displacement of each atom without averaged on all the atoms. Like you said before, per atom quantity, in this case I guess it is gonna be hard do it in lammps, right?

Wei

So if you have one quantity per atom, how

are they ordered into a vector to compute the FFT?

It is a 1d FFT you are talking about? Atoms

have no intrinsic ordering across processors.

Steve

Thanks, Steve, It is gonna be a 2D FFT, the variable are z direction displacements for all atoms “h” as a function of atom position “h(x,y)”.

Thanks, Steve, It is gonna be a 2D FFT, the variable are z direction

displacements for all atoms "h" as a function of atom position "h(x,y)".

sounds a lot like you'll be better off doing this in post processing.

to do the fourier transform, you first need all data on a regular grid.

you might be able to achieve that with the ave/spatial fix.

to take that output and then apply a fourier transform,

is a fairly straightforward task that can be done with most

script languages and tools like matlab/mathematica and so on.

axel.