Skip to content

Commit 5bc02d9

Browse files
authored
Merge pull request brucefan1983#1295 from brucefan1983/fine_tune_descriptor
fine-tune descriptor by default
2 parents 9cd52a8 + c4d5ad4 commit 5bc02d9

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
@@ -1329,12 +1329,21 @@ void Parameters::parse_fine_tune(const char** param, int num_param)
13291329
{
13301330
fine_tune = 1;
13311331

1332-
if (num_param != 3) {
1333-
PRINT_INPUT_ERROR("fine_tune should have two parameters.\n");
1332+
if (num_param != 3 && num_param != 4) {
1333+
PRINT_INPUT_ERROR("fine_tune should have 2 or 3 parameters.\n");
13341334
}
13351335

13361336
fine_tune_nep_txt = param[1];
13371337
fine_tune_nep_restart = param[2];
1338+
1339+
if (num_param == 4) {
1340+
if (!is_valid_int(param[3], &fine_tune_descriptor)) {
1341+
PRINT_INPUT_ERROR("fine_tune_descriptor should be an integer.\n");
1342+
}
1343+
if (fine_tune_descriptor < 0 || fine_tune_descriptor > 1) {
1344+
PRINT_INPUT_ERROR("fine_tune_descriptor should be 0 or 1.");
1345+
}
1346+
}
13381347
}
13391348

13401349
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
@@ -66,6 +66,7 @@ public:
6666
bool has_bec = false; // check if there are target BEC values
6767
int flip_charge = 0; // 1 for flipping charges upon restarting
6868
int fine_tune = 0; // fine_tune option; 0=no, 1=yes
69+
int fine_tune_descriptor = 1; // fine-tune descriptor; 0=no, 1=yes
6970
std::string fine_tune_nep_txt = "";
7071
std::string fine_tune_nep_restart = "";
7172

src/main_nep/snes.cu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ void SNES::initialize_mu_and_sigma_fine_tune(Parameters& para)
206206
int element_index_2 = element_map[para.atomic_numbers[t2] - 1];
207207
int t12 = element_index_1 * NUM89 + element_index_2;
208208
mu[count] = restart_mu[nk * NUM89 * NUM89 + t12 + num_ann];
209-
#ifdef FINE_TUNE_DESCRIPTOR
210-
sigma[count] = restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
211-
#else
212-
sigma[count] = 0.0f * restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
213-
#endif
209+
if (para.fine_tune_descriptor) {
210+
sigma[count] = restart_sigma[nk * NUM89 * NUM89 + t12 + num_ann];
211+
} else {
212+
sigma[count] = 0.0f;
213+
}
214214
++count;
215215
}
216216
}

0 commit comments

Comments
 (0)