Skip to content

Commit

Permalink
Merge pull request #855 from BBBuZHIDAO/add_table_ilp
Browse files Browse the repository at this point in the history
Add USE_TABLE for ILP_NEP_GR_HBN potential
  • Loading branch information
brucefan1983 authored Jan 7, 2025
2 parents ab815b9 + 4913f06 commit 59fef82
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/force/ilp_nep_gr_hbn.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,45 @@ void ILP_NEP_GR_HBN::update_potential(float* parameters, ANN& ann)
ann.c = pointer;
}

#ifdef USE_TABLE
void ILP_NEP_GR_HBN::construct_table(float* parameters)
{
nep_data.gn_radial.resize(table_length * paramb.num_types_sq * (paramb.n_max_radial + 1));
nep_data.gnp_radial.resize(table_length * paramb.num_types_sq * (paramb.n_max_radial + 1));
nep_data.gn_angular.resize(table_length * paramb.num_types_sq * (paramb.n_max_angular + 1));
nep_data.gnp_angular.resize(table_length * paramb.num_types_sq * (paramb.n_max_angular + 1));
std::vector<float> gn_radial(table_length * paramb.num_types_sq * (paramb.n_max_radial + 1));
std::vector<float> gnp_radial(table_length * paramb.num_types_sq * (paramb.n_max_radial + 1));
std::vector<float> gn_angular(table_length * paramb.num_types_sq * (paramb.n_max_angular + 1));
std::vector<float> gnp_angular(table_length * paramb.num_types_sq * (paramb.n_max_angular + 1));
float* c_pointer = parameters + annmb.num_para_ann;
construct_table_radial_or_angular(
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_radial,
paramb.basis_size_radial,
paramb.rc_radial,
paramb.rcinv_radial,
c_pointer,
gn_radial.data(),
gnp_radial.data());
construct_table_radial_or_angular(
paramb.num_types,
paramb.num_types_sq,
paramb.n_max_angular,
paramb.basis_size_angular,
paramb.rc_angular,
paramb.rcinv_angular,
c_pointer + paramb.num_c_radial,
gn_angular.data(),
gnp_angular.data());
nep_data.gn_radial.copy_from_host(gn_radial.data());
nep_data.gnp_radial.copy_from_host(gnp_radial.data());
nep_data.gn_angular.copy_from_host(gn_angular.data());
nep_data.gnp_angular.copy_from_host(gnp_angular.data());
}
#endif

static __global__ void find_neighbor_list_nep(
ILP_NEP_GR_HBN::ParaMB paramb,
const int N,
Expand Down
3 changes: 3 additions & 0 deletions src/force/ilp_nep_gr_hbn.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public:
private:
int ilp_group_method;
double ilp_rc;
#ifdef USE_TABLE
void construct_table(float* parameters);
#endif

ParaMB paramb;
ANN annmb;
Expand Down

0 comments on commit 59fef82

Please sign in to comment.