Skip to content

Commit 41aa34e

Browse files
authored
Merge pull request brucefan1983#901 from brucefan1983/fix_energy_weight_bug
Fix energy weight bug
2 parents 104a804 + 4492462 commit 41aa34e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main_nep/dataset.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ void Dataset::copy_structures(std::vector<Structure>& structures_input, int n1,
3333
structures[n].weight = structures_input[n_input].weight;
3434
structures[n].has_virial = structures_input[n_input].has_virial;
3535
structures[n].energy = structures_input[n_input].energy;
36+
structures[n].energy_weight = structures_input[n_input].energy_weight;
3637
structures[n].has_temperature = structures_input[n_input].has_temperature;
3738
structures[n].temperature = structures_input[n_input].temperature;
3839
structures[n].volume = structures_input[n_input].volume;

tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,18 @@ static void split_into_accurate_and_inaccurate(const std::vector<Structure>& str
616616
break;
617617
}
618618
}
619-
bool is_considered = energy_is_small && force_is_small;
619+
bool is_considered = (energy_is_small || structures[nc].energy_weight < 0.5f) && force_is_small;
620620

621621
bool is_accurate = true;
622622

623623
double energy_nep = 0.0;
624624
double energy_ref = 0.0;
625625
input_energy >> energy_nep >> energy_ref;
626-
if (std::abs(energy_nep - energy_ref) > 0.5) {
627-
is_accurate = false;
626+
627+
if (structures[nc].energy_weight > 0.5f) {
628+
if (std::abs(energy_nep - energy_ref) > 0.5) {
629+
is_accurate = false;
630+
}
628631
}
629632

630633
double force_nep[3];

0 commit comments

Comments
 (0)