Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also check stress #801

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ static void split_into_train_and_test(const std::vector<Structure>& structures)
static void split_into_accurate_and_inaccurate(const std::vector<Structure>& structures)
{
std::ifstream input_energy("energy_train.out");
std::ifstream input_stress("stress_train.out");
std::ifstream input_force("force_train.out");
std::ofstream output_accurate("accurate.xyz");
std::ofstream output_inaccurate("inaccurate.xyz");
Expand All @@ -656,10 +657,24 @@ static void split_into_accurate_and_inaccurate(const std::vector<Structure>& str
double energy_nep = 0.0;
double energy_ref = 0.0;
input_energy >> energy_nep >> energy_ref;
if (std::abs(energy_nep - energy_ref) > 1.0) {
if (std::abs(energy_nep - energy_ref) > 0.5) {
is_accurate = false;
}

double stress_nep[6];
double stress_ref[6];
for (int n = 0; n < 6; ++n) {
input_stress >> stress_nep[n];
}
for (int n = 0; n < 6; ++n) {
input_stress >> stress_ref[n];
}
for (int n = 0; n < 6; ++n) {
if (std::abs(stress_nep[n] - stress_ref[n]) > 10.0) {
is_accurate = false;
}
}

double force_nep[3];
double force_ref[3];
for (int n = 0; n < structures[nc].num_atom; ++n) {
Expand All @@ -681,6 +696,7 @@ static void split_into_accurate_and_inaccurate(const std::vector<Structure>& str
}
}
input_energy.close();
input_stress.close();
input_force.close();
output_accurate.close();
output_inaccurate.close();
Expand Down
Loading