Slow - FFT Timing

I use lammps as a library within a python code that externally modifies the positions and then uses lammps to calculate the forces by executing the command "run 0", perhaps this isn't ideal?

After August the 6th update, LAMMPS became very slow (>10 times) when using the KSPACE package. This was because of changes made to finish.cpp, where the FFT mesh is deliberately iteratively increased until the fft times cross a certain threshold.

The guilty code is:

    int nfft = force->kspace->timing(nsample,time3d,time1d);
    while (time3d < 1.0 || time1d < 1.0) {
      nsample *= 5;
      nfft = force->kspace->timing(nsample,time3d,time1d);

In my case this is easy to resolve as nfft isn't used if nsteps is 0 so you can wrap it with if(nsteps){..} but it seems strange to have such an expensive routine in the timing statistics. It accounts for >40% of the time in the peptide example on my system (using KISSFFT).

I understand my method of running lammps is unusual and for most people this additional time will be lost in the noise.

You can use the "post no" option with the run command
to avoid calling Finish at all, when doing a series of short
runs. The up-to-one second loop is there to try to
get an accurate timing.