int n_ok(unsigned int rank, unsigned int *n) { unsigned int i; for (i = 0; i < rank; ++i) if (!check_prime_factors(n[i], 5)) return 0; return 1; }
/** Compute the ceiling of len that is also a product of powers of 2, 3, 5. * Use check_prime_factors to get the smallest integer greater or equal * than len which is decomposable into powers of 2, 3, 5. */ int Ewald_ParticleMesh::ComputeNFFT(double len) { int mval = (int)len - 1; for (int i = 0; i < 100; i++) { mval += 1; // Sanity check if (mval < 1) { mprinterr("Error: Bad box length %g, cannot get NFFT value.\n", len); return 0; } if (check_prime_factors(mval)) return mval; } mprinterr("Error: Failed to get good FFT array size for length %g Ang.\n", len); return 0; }