Skip to content

Commit

Permalink
Merge pull request #687 from brucefan1983/small_fix
Browse files Browse the repository at this point in the history
totally remove NEP2
  • Loading branch information
brucefan1983 authored Aug 8, 2024
2 parents d6579a8 + f969fe9 commit 963a67b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
2 changes: 0 additions & 2 deletions src/force/nep3.cu
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ void NEP3::construct_table(float* parameters)
parameters +
(annmb.dim + 2) * annmb.num_neurons1 * (paramb.version == 4 ? paramb.num_types : 1) + 1;
construct_table_radial_or_angular(
paramb.version,
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_radial,
Expand All @@ -405,7 +404,6 @@ void NEP3::construct_table(float* parameters)
gn_radial.data(),
gnp_radial.data());
construct_table_radial_or_angular(
paramb.version,
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_angular,
Expand Down
2 changes: 0 additions & 2 deletions src/force/nep3_multigpu.cu
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ NEP3_MULTIGPU::NEP3_MULTIGPU(
(paramb.version == 4 ? paramb.num_types : 1) +
1;
construct_table_radial_or_angular(
paramb.version,
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_radial,
Expand All @@ -365,7 +364,6 @@ NEP3_MULTIGPU::NEP3_MULTIGPU(
gn_radial.data(),
gnp_radial.data());
construct_table_radial_or_angular(
paramb.version,
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_angular,
Expand Down
30 changes: 10 additions & 20 deletions src/utilities/nep_utilities.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ __device__ void find_index_and_weight(
}

static void construct_table_radial_or_angular(
const int version,
const int num_types,
const int num_types_sq,
const int n_max,
Expand All @@ -873,26 +872,17 @@ static void construct_table_radial_or_angular(
int t12 = t1 * num_types + t2;
float fn12[MAX_NUM_N];
float fnp12[MAX_NUM_N];
if (version == 2) {
find_fn_and_fnp(n_max, rcinv, d12, fc12, fcp12, fn12, fnp12);
for (int n = 0; n <= n_max; ++n) {
int index_all = (table_index * num_types_sq + t12) * (n_max + 1) + n;
gn[index_all] = fn12[n] * ((num_types == 1) ? 1.0f : c[n * num_types_sq + t12]);
gnp[index_all] = fnp12[n] * ((num_types == 1) ? 1.0f : c[n * num_types_sq + t12]);
}
} else {
find_fn_and_fnp(basis_size, rcinv, d12, fc12, fcp12, fn12, fnp12);
for (int n = 0; n <= n_max; ++n) {
float gn12 = 0.0f;
float gnp12 = 0.0f;
for (int k = 0; k <= basis_size; ++k) {
gn12 += fn12[k] * c[(n * (basis_size + 1) + k) * num_types_sq + t12];
gnp12 += fnp12[k] * c[(n * (basis_size + 1) + k) * num_types_sq + t12];
}
int index_all = (table_index * num_types_sq + t12) * (n_max + 1) + n;
gn[index_all] = gn12;
gnp[index_all] = gnp12;
find_fn_and_fnp(basis_size, rcinv, d12, fc12, fcp12, fn12, fnp12);
for (int n = 0; n <= n_max; ++n) {
float gn12 = 0.0f;
float gnp12 = 0.0f;
for (int k = 0; k <= basis_size; ++k) {
gn12 += fn12[k] * c[(n * (basis_size + 1) + k) * num_types_sq + t12];
gnp12 += fnp12[k] * c[(n * (basis_size + 1) + k) * num_types_sq + t12];
}
int index_all = (table_index * num_types_sq + t12) * (n_max + 1) + n;
gn[index_all] = gn12;
gnp[index_all] = gnp12;
}
}
}
Expand Down

0 comments on commit 963a67b

Please sign in to comment.