Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
abkein committed Jan 21, 2025
1 parent 4865864 commit 3085ba4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
10 changes: 6 additions & 4 deletions src/compute_cluster_ke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ void ComputeClusterKE::compute_local()
const double* const peratomkes = compute_ke_atom->vector_atom;
local_kes.reset();

int nclusters = dynamic_cast<ComputeClusterSizeExt*>(compute_cluster_size)->get_cluster_map().size();
const auto& clusters = dynamic_cast<ComputeClusterSizeExt*>(compute_cluster_size)->get_clusters();
int nclusters = compute_cluster_size->get_cluster_map().size();
const auto& clusters = compute_cluster_size->get_clusters();
for (int i = 0; i < nclusters; ++i) {
const auto& clstr = clusters[i];
const auto& atoms = clstr.atoms();
for (int j = 0; j < clstr.l_size; ++j) {
local_kes[clstr.g_size] += peratomkes[atoms[j]];
if (clstr.g_size < size_cutoff) {
for (int j = 0; j < clstr.l_size; ++j) {
local_kes[clstr.g_size] += peratomkes[atoms[j]];
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/compute_cluster_pe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ void ComputeClusterPE::compute_local()
for (int i = 0; i < nclusters; ++i) {
const auto& clstr = clusters[i];
const auto& atoms = clstr.atoms();
for (int j = 0; j < clstr.l_size; ++j) {
local_pes[clstr.g_size] += peratompes[atoms[j]];
if (clstr.g_size < size_cutoff) {
for (int j = 0; j < clstr.l_size; ++j) {
local_pes[clstr.g_size] += peratompes[atoms[j]];
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/compute_cluster_volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ void ComputeClusterVolume::compute_local()
for (const auto clidx : clidxs) {
const cluster_data &clstr = clusters[clidx];
bool const nonexclusive = clstr.nowners > 0;
volumes[clidx] = occupied_volume_precomputed(clstr.atoms_all(), clstr.l_size, clstr.nghost,
nonexclusive);
// volumes[clidx] = occupied_volume_precomputed(clstr.atoms_all(), clstr.l_size, clstr.nghost,
// nonexclusive);
volumes[clidx] = occupied_volume_precomputed(clstr.atoms(), clstr.l_size, 0,
nonexclusive);
if (nonexclusive) {
if (clstr.host != comm->me) {
// ++send_comm_matrix_local[clstr.host];
Expand Down
6 changes: 3 additions & 3 deletions src/nucc_cluster_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct cluster_data {

// void rearrange() noexcept { ::memcpy(_atoms + l_size, _ghost, nghost * sizeof(int)); }

NUCC::cspan<const int> atoms_all() const { return std::span<const int>(_atoms, l_size + nghost); }
// NUCC::cspan<const int> atoms_all() const { return std::span<const int>(_atoms, l_size + nghost); }

template <bool Protect = true>
requires(!Protect)
Expand All @@ -23,7 +23,7 @@ struct cluster_data {

// NUCC::cspan<int, LMP_NUCC_CLUSTER_MAX_GHOST> ghost_initial() { return std::span<int, LMP_NUCC_CLUSTER_MAX_GHOST>(_ghost, nghost); }

NUCC::cspan<const int> ghost() const { return std::span<const int>(_atoms + l_size, nghost); }
// NUCC::cspan<const int> ghost() const { return std::span<const int>(_atoms + l_size, nghost); }

template <bool Protect = true>
requires(!Protect)
Expand All @@ -40,7 +40,7 @@ struct cluster_data {
int host = -1; // host proc (me if <0)
int nhost = 0; // local cluster size of host proc
int nowners = 0; // number of owners
int nghost = 0; // number of ghost atoms in cluster
// int nghost = 0; // number of ghost atoms in cluster
private:
int _owners[LMP_NUCC_CLUSTER_MAX_OWNERS]; // procs owning some cluster's atoms
int _atoms[LMP_NUCC_CLUSTER_MAX_SIZE]; // local ids of atoms
Expand Down

0 comments on commit 3085ba4

Please sign in to comment.