Merge branch 'collected-small-changes' of github.com:akohlmey/lammps into collected-small-changes

This commit is contained in:
Axel Kohlmeyer
2024-10-07 19:57:43 -04:00
3 changed files with 9 additions and 28 deletions

View File

@ -151,7 +151,7 @@ class AtomKokkos : public Atom {
static int map_find_hash_kokkos(tagint global, const dual_hash_type &k_map_hash)
{
int local = -1;
auto& d_map_hash = k_map_hash.const_view<DeviceType>();
auto& d_map_hash = k_map_hash.const_view<DeviceType>(); // must be alias
auto index = d_map_hash.find(global);
if (d_map_hash.valid_at(index))
local = d_map_hash.value_at(index);

View File

@ -212,7 +212,7 @@ void AtomKokkos::map_set_device()
Kokkos::sort(LMPDeviceType(),l_sorted,MyComp{});
auto d_map_array = k_map_array.d_view;
auto d_map_hash = k_map_hash.d_view;
auto& d_map_hash = k_map_hash.d_view; // must be alias
if (!map_style_array)
d_map_hash.clear();
@ -352,26 +352,17 @@ void AtomKokkos::map_set_host()
// use "view" template method to avoid unnecessary deep_copy
auto h_map_hash = k_map_hash.view<LMPHostType>();
auto& h_map_hash = k_map_hash.h_view; // must be alias
h_map_hash.clear();
for (int i = nall - 1; i >= 0; i--) {
for (int i = 0; i < nall; i++) {
// search for key
// if don't find it, done
previous = -1;
global = tag[i];
ibucket = global % map_nbucket;
index = map_bucket[ibucket];
while (index > -1) {
if (map_hash[index].global == global) break;
previous = index;
index = map_hash[index].next;
}
if (index == -1) continue;
int local = map_hash[index].local;
int local = Atom::map_find_hash(global);
if (local == -1) continue;
auto insert_result = h_map_hash.insert(global, local);
if (insert_result.failed()) error->one(FLERR, "Kokkos::UnorderedMap insertion failed");
@ -399,7 +390,7 @@ void AtomKokkos::map_one(tagint global, int local)
k_map_array.h_view[global] = local;
} else {
k_map_hash.sync_host();
auto& h_map_hash = k_map_hash.h_view;
auto& h_map_hash = k_map_hash.h_view; // must be alias
auto insert_result = h_map_hash.insert(global, local);
if (insert_result.existing())
@ -417,12 +408,13 @@ void AtomKokkos::map_one(tagint global, int local)
int AtomKokkos::map_find_hash(tagint global)
{
k_map_hash.sync_host();
auto& h_map_hash = k_map_hash.h_view;
auto& h_map_hash = k_map_hash.h_view; // must be alias
int local = -1;
auto index = h_map_hash.find(global);
if (h_map_hash.valid_at(index))
local = h_map_hash.value_at(index);
return local;
}

View File

@ -239,12 +239,6 @@ void FixQEqCTIP::init_matvec()
double *q = atom->q, qi;
int *type = atom->type;
double r = cutoff;
double rsq = r*r;
double erfcd_cut = exp(-cdamp * cdamp * rsq);
double t_cut = 1.0 / (1.0 + EWALD_P * cdamp * r);
inum = list->inum;
ilist = list->ilist;
@ -283,7 +277,6 @@ void FixQEqCTIP::compute_H()
int inum, jnum, *ilist, *jlist, *numneigh, **firstneigh;
int i, j, ii, jj;
double dx, dy, dz, r_sqr, r, reff;
double cutoffsq, erfcd_cut, t_cut;
double erfcc, erfcd, t;
double **x = atom->x;
@ -295,10 +288,6 @@ void FixQEqCTIP::compute_H()
numneigh = list->numneigh;
firstneigh = list->firstneigh;
cutoffsq = cutoff * cutoff;
erfcd_cut = exp(-cdamp * cdamp * cutoffsq);
t_cut = 1.0 / (1.0 + EWALD_P * cdamp * cutoff);
// fill in the H matrix
m_fill = 0;
for (ii = 0; ii < inum; ii++) {