diff --git a/lib/gpu/pair_gpu_atom.cpp b/lib/gpu/pair_gpu_atom.cpp index 0ca2345087..106dc3971b 100644 --- a/lib/gpu/pair_gpu_atom.cpp +++ b/lib/gpu/pair_gpu_atom.cpp @@ -219,6 +219,13 @@ bool PairGPUAtomT::init(const int inum, const int nall, const bool charge, return success && alloc(ef_inum,ef_nall); } +template +bool PairGPUAtomT::add_fields(const bool charge, const bool rot) { + if (charge && _charge=false) { + _charge=true; + _e_fields++; + + template void PairGPUAtomT::clear_resize() { if (!_allocated) diff --git a/lib/gpu/pair_gpu_atom.h b/lib/gpu/pair_gpu_atom.h index e0a1fd9fb1..2f816be037 100644 --- a/lib/gpu/pair_gpu_atom.h +++ b/lib/gpu/pair_gpu_atom.h @@ -84,6 +84,11 @@ class PairGPUAtom { } return false; } + + /// If already initialized by another LAMMPS style, add fields as necessary + /** \param rot True if atom storage needs quaternions + * \param gpu_nbor True if neighboring will be performed on device **/ + bool add_fields(const bool charge, const bool rot); /// Only free matrices of length inum or nall for resizing void clear_resize(); diff --git a/lib/gpu/pair_gpu_device.cpp b/lib/gpu/pair_gpu_device.cpp index d02618e22c..09728c77d3 100644 --- a/lib/gpu/pair_gpu_device.cpp +++ b/lib/gpu/pair_gpu_device.cpp @@ -137,6 +137,7 @@ bool PairGPUDeviceT::init(const bool charge, const bool rot, const int nlocal, return false; nbor.cell_size(cell_size); } else { + atom.add_fields(charge,rot); if (cell_size>nbor.cell_size()) nbor.cell_size(cell_size); } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 00a2c5d65d..12137406ef 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -196,7 +196,6 @@ void PairHybrid::settings(int narg, char **arg) // exception is 1st arg of style "table", which is non-numeric word // exception is 1st two args of style "lj/coul", which are non-numeric // exception is 1st two args of style "buck/coul", which are non-numeric - // exception is 1st arg of any "gpu" style, which is non-numeric // exception is 1st arg of reax/c style, which is non-numeric // need a better way to skip these exceptions @@ -206,7 +205,6 @@ void PairHybrid::settings(int narg, char **arg) if (strcmp(arg[i],"table") == 0) i++; if (strcmp(arg[i],"lj/coul") == 0) i += 2; if (strcmp(arg[i],"buck/coul") == 0) i += 2; - if (strstr(arg[i],"gpu")) i++; if (strcmp(arg[i],"reax/c") == 0) i++; i++; while (i < narg && !isalpha(arg[i][0])) i++; @@ -223,7 +221,6 @@ void PairHybrid::settings(int narg, char **arg) // exception is 1st arg of style "table", which is non-numeric // exception is 1st two args of style "lj/coul", which are non-numeric // exception is 1st two args of style "buck/coul", which are non-numeric - // exception is 1st arg of any "gpu" style, which is non-numeric // exception is 1st arg of reax/c style, which is non-numeric // need a better way to skip these exceptions @@ -244,7 +241,6 @@ void PairHybrid::settings(int narg, char **arg) if (strcmp(arg[i],"table") == 0) i++; if (strcmp(arg[i],"lj/coul") == 0) i += 2; if (strcmp(arg[i],"buck/coul") == 0) i += 2; - if (strstr(arg[i],"gpu")) i++; if (strcmp(arg[i],"reax/c") == 0) i++; i++; while (i < narg && !isalpha(arg[i][0])) i++;