Skip to content

Commit c4d5ad4

Browse files
committed
fine-tune descriptor by default
1 parent 593aaf3 commit c4d5ad4

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/main_nep/parameters.cu

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,12 +1307,21 @@ void Parameters::parse_fine_tune(const char** param, int num_param)
13071307
{
13081308
fine_tune = 1;
13091309

1310-
if (num_param != 3) {
1311-
PRINT_INPUT_ERROR("fine_tune should have two parameters.\n");
1310+
if (num_param != 3 && num_param != 4) {
1311+
PRINT_INPUT_ERROR("fine_tune should have 2 or 3 parameters.\n");
13121312
}
13131313

13141314
fine_tune_nep_txt = param[1];
13151315
fine_tune_nep_restart = param[2];
1316+
1317+
if (num_param == 4) {
1318+
if (!is_valid_int(param[3], &fine_tune_descriptor)) {
1319+
PRINT_INPUT_ERROR("fine_tune_descriptor should be an integer.\n");
1320+
}
1321+
if (fine_tune_descriptor < 0 || fine_tune_descriptor > 1) {
1322+
PRINT_INPUT_ERROR("fine_tune_descriptor should be 0 or 1.");
1323+
}
1324+
}
13161325
}
13171326

13181327
void Parameters::parse_save_potential(const char** param, int num_param)

src/main_nep/parameters.cuh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public:
6565
bool has_bec = false; // check if there are target BEC values
6666
int flip_charge = 0; // 1 for flipping charges upon restarting
6767
int fine_tune = 0; // fine_tune option; 0=no, 1=yes
68+
int fine_tune_descriptor = 1; // fine-tune descriptor; 0=no, 1=yes
6869
std::string fine_tune_nep_txt = "";
6970
std::string fine_tune_nep_restart = "";
7071

src/main_nep/snes.cu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ void SNES::initialize_mu_and_sigma_fine_tune(Parameters& para)
199199
int element_index_2 = element_map[para.atomic_numbers[t2] - 1];
200200
int t12 = element_index_1 * NUM89 + element_index_2;
201201
mu[count] = restart_mu[nk * NUM89 * NUM89 + t12 + num_ann];
202-
#ifdef FINE_TUNE_DESCRIPTOR
203-
sigma[count] = restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
204-
#else
205-
sigma[count] = 0.0f * restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
206-
#endif
202+
if (para.fine_tune_descriptor) {
203+
sigma[count] = restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
204+
} else {
205+
sigma[count] = 0.0f;
206+
}
207207
++count;
208208
}
209209
}

0 commit comments

Comments
 (0)