From a5ff51f98498478f28221a7fb67f704e99e574c0 Mon Sep 17 00:00:00 2001 From: bhk Date: Wed, 1 Jan 2025 00:43:57 +0800 Subject: [PATCH] add dp nl init and delete code --- src/force/dp.cu | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/force/dp.cu b/src/force/dp.cu index 2750d205..81538825 100644 --- a/src/force/dp.cu +++ b/src/force/dp.cu @@ -42,6 +42,13 @@ DP::DP(const char* filename_dp, int num_atoms) dp_data.cell_count.resize(num_atoms); dp_data.cell_count_sum.resize(num_atoms); dp_data.cell_contents.resize(num_atoms); + + // init dp neighbor list + dp_nl.inum = num_atoms; + dp_nl.ilist = (int*) malloc(num_atoms * sizeof(int)); + dp_nl.numneigh = (int*) malloc(num_atoms * sizeof(int)); + dp_nl.firstneigh = (int**) malloc(num_atoms * sizeof(int*)); + } @@ -85,7 +92,12 @@ void DP::initialize_dp(const char* filename_dp) DP::~DP(void) { - // nothing + free(dp_nl.ilist); + free(dp_nl.numneigh); + free(dp_nl.firstneigh); + dp_nl.ilist = nullptr; + dp_nl.numneigh = nullptr; + dp_nl.firstneigh = nullptr; } void DP::set_dp_coeff(void) {