Skip to content

Commit 74f5ece

Browse files
authored
Merge pull request #141 from denghuilu/devel-up
fix the virial assembly bug, no influence on the results
2 parents 258731f + b998077 commit 74f5ece

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

source/op/cuda/prod_virial_se_a.cu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ __global__ void deriv_wrt_neighbors_se_a(VALUETYPE * virial,
4545
{
4646
// idx -> nloc
4747
// idy -> nnei
48+
// idz = dd0 * 3 + dd1
49+
// dd0 = idz / 3
50+
// dd1 = idz % 3
4851
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
4952
const unsigned int idy = blockIdx.y;
5053
const unsigned int idz = threadIdx.y;
@@ -58,7 +61,7 @@ __global__ void deriv_wrt_neighbors_se_a(VALUETYPE * virial,
5861
return;
5962
}
6063
// atomicAdd(virial + idz, net_deriv[idx * ndescrpt + idy * 4 + idw] * rij[idx * nnei * 3 + idy * 3 + idz / 3] * in_deriv[idx * ndescrpt * 3 + (idy * 4 + idw) * 3 + idz % 3]);
61-
atomicAdd(atom_virial + j_idx * 9 + idz, net_deriv[idx * ndescrpt + idy * 4 + idw] * rij[idx * nnei * 3 + idy * 3 + idz / 3] * in_deriv[idx * ndescrpt * 3 + (idy * 4 + idw) * 3 + idz % 3]);
64+
atomicAdd(atom_virial + j_idx * 9 + idz, net_deriv[idx * ndescrpt + idy * 4 + idw] * rij[idx * nnei * 3 + idy * 3 + idz % 3] * in_deriv[idx * ndescrpt * 3 + (idy * 4 + idw) * 3 + idz / 3]);
6265
}
6366

6467
void ProdVirialSeALauncher(VALUETYPE * virial,

source/op/cuda/prod_virial_se_r.cu

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ __global__ void deriv_wrt_neighbors_se_r(VALUETYPE * virial,
4747
{
4848
// idx -> nloc
4949
// idy -> nnei
50+
// idz = dd0 * 3 + dd1
51+
// dd0 = idz / 3
52+
// dd1 = idz % 3
5053
const unsigned int idx = blockIdx.x * blockDim.x + threadIdx.x;
5154
const unsigned int idy = blockIdx.y;
5255
const unsigned int idz = threadIdx.y;
@@ -58,7 +61,7 @@ __global__ void deriv_wrt_neighbors_se_r(VALUETYPE * virial,
5861
if (j_idx < 0) {
5962
return;
6063
}
61-
atomicAdd(atom_virial + j_idx * 9 + idz, net_deriv[idx * ndescrpt + idy] * rij[idx * nnei * 3 + idy * 3 + idz / 3] * in_deriv[idx * ndescrpt * 3 + idy * 3 + idz % 3]);
64+
atomicAdd(atom_virial + j_idx * 9 + idz, net_deriv[idx * ndescrpt + idy] * rij[idx * nnei * 3 + idy * 3 + idz % 3] * in_deriv[idx * ndescrpt * 3 + idy * 3 + idz / 3]);
6265
}
6366

6467
void ProdVirialSeRLauncher(VALUETYPE * virial,

0 commit comments

Comments
 (0)