KOKKOS_INLINE_FUNCTION powint() to replace MathSpecial::powint
This commit is contained in:
@ -22,15 +22,29 @@
|
||||
#include "atom_kokkos.h"
|
||||
#include "error.h"
|
||||
#include "kokkos_base.h"
|
||||
#include "math_special.h"
|
||||
#include "memory_kokkos.h"
|
||||
#include "region.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using MathSpecial::powint;
|
||||
|
||||
enum { LJ93, LJ126, LJ1043, COLLOID, HARMONIC, MORSE };
|
||||
|
||||
KOKKOS_INLINE_FUNCTION double powint(const double &x, const int n)
|
||||
{
|
||||
double yy, ww;
|
||||
|
||||
if (n == 0) return 1.0;
|
||||
if (x == 0.0) return 0.0;
|
||||
int nn = (n > 0) ? n : -n;
|
||||
ww = x;
|
||||
|
||||
for (yy = 1.0; nn != 0; nn >>= 1, ww *= ww)
|
||||
if (nn & 1) yy *= ww;
|
||||
|
||||
return (n > 0) ? yy : 1.0 / yy;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template <class DeviceType>
|
||||
|
||||
Reference in New Issue
Block a user