From a12cce594481d8949b0e77968e57d7503e5336cd Mon Sep 17 00:00:00 2001 From: brucefan1983 Date: Tue, 26 Nov 2024 02:48:31 +0800 Subject: [PATCH] also check stress --- .../for_perioidc_table/nep_data_toolkit.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp b/tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp index dd80453c..5a0c4037 100644 --- a/tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp +++ b/tools/for_coding/for_perioidc_table/nep_data_toolkit.cpp @@ -645,6 +645,7 @@ static void split_into_train_and_test(const std::vector& structures) static void split_into_accurate_and_inaccurate(const std::vector& 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"); @@ -656,10 +657,24 @@ static void split_into_accurate_and_inaccurate(const std::vector& 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) { @@ -681,6 +696,7 @@ static void split_into_accurate_and_inaccurate(const std::vector& str } } input_energy.close(); + input_stress.close(); input_force.close(); output_accurate.close(); output_inaccurate.close();