diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0259a59291..97715796da 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -15,7 +15,9 @@ set(DEEPMD_C_ROOT "" CACHE PATH "Path to imported DeePMD-kit C library") -set(CMAKE_CXX_STANDARD 11) +if (NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() macro(set_if_higher VARIABLE VALUE) # ${VARIABLE} is a variable name, not a string if(${VARIABLE} LESS "${VALUE}") diff --git a/source/api_cc/src/DeepPotPT.cc b/source/api_cc/src/DeepPotPT.cc index abd35eaf1e..5f03f7c5cb 100644 --- a/source/api_cc/src/DeepPotPT.cc +++ b/source/api_cc/src/DeepPotPT.cc @@ -143,7 +143,7 @@ void DeepPotPT::compute(ENERGYVTYPE& ener, int natoms = atype.size(); auto options = torch::TensorOptions().dtype(torch::kFloat64); torch::ScalarType floatType = torch::kFloat64; - if (std::is_same_v) { + if (std::is_same::value) { options = torch::TensorOptions().dtype(torch::kFloat32); floatType = torch::kFloat32; } @@ -341,7 +341,7 @@ void DeepPotPT::compute(ENERGYVTYPE& ener, int natoms = atype.size(); auto options = torch::TensorOptions().dtype(torch::kFloat64); torch::ScalarType floatType = torch::kFloat64; - if (std::is_same_v) { + if (std::is_same::value) { options = torch::TensorOptions().dtype(torch::kFloat32); floatType = torch::kFloat32; } diff --git a/source/api_cc/src/DeepSpinPT.cc b/source/api_cc/src/DeepSpinPT.cc index 7421b623db..19d5368213 100644 --- a/source/api_cc/src/DeepSpinPT.cc +++ b/source/api_cc/src/DeepSpinPT.cc @@ -145,7 +145,7 @@ void DeepSpinPT::compute(ENERGYVTYPE& ener, int natoms = atype.size(); auto options = torch::TensorOptions().dtype(torch::kFloat64); torch::ScalarType floatType = torch::kFloat64; - if (std::is_same_v) { + if (std::is_same::value) { options = torch::TensorOptions().dtype(torch::kFloat32); floatType = torch::kFloat32; } @@ -365,7 +365,7 @@ void DeepSpinPT::compute(ENERGYVTYPE& ener, int natoms = atype.size(); auto options = torch::TensorOptions().dtype(torch::kFloat64); torch::ScalarType floatType = torch::kFloat64; - if (std::is_same_v) { + if (std::is_same::value) { options = torch::TensorOptions().dtype(torch::kFloat32); floatType = torch::kFloat32; }