diff --git a/source/api_cc/src/DeepPot.cc b/source/api_cc/src/DeepPot.cc index 018c3aca09..bb39a9fd60 100644 --- a/source/api_cc/src/DeepPot.cc +++ b/source/api_cc/src/DeepPot.cc @@ -474,7 +474,7 @@ void DeepPot::init(const std::string& model, ntypes = get_scalar("descrpt_attr/ntypes"); try { ntypes_spin = get_scalar("spin_attr/ntypes_spin"); - } catch (deepmd::deepmd_exception) { + } catch (const deepmd::deepmd_exception) { ntypes_spin = 0; } dfparam = get_scalar("fitting_attr/dfparam"); @@ -488,7 +488,7 @@ void DeepPot::init(const std::string& model, if (daparam > 0) { try { aparam_nall = get_scalar("fitting_attr/aparam_nall"); - } catch (deepmd::deepmd_exception) { + } catch (const deepmd::deepmd_exception) { aparam_nall = false; } } else { @@ -1331,7 +1331,7 @@ void DeepPotModelDevi::init(const std::vector& models, ntypes = get_scalar("descrpt_attr/ntypes"); try { ntypes_spin = get_scalar("spin_attr/ntypes_spin"); - } catch (deepmd::deepmd_exception) { + } catch (const deepmd::deepmd_exception) { ntypes_spin = 0; } dfparam = get_scalar("fitting_attr/dfparam"); @@ -1345,7 +1345,7 @@ void DeepPotModelDevi::init(const std::vector& models, if (daparam > 0) { try { aparam_nall = get_scalar("fitting_attr/aparam_nall"); - } catch (deepmd::deepmd_exception) { + } catch (const deepmd::deepmd_exception) { aparam_nall = false; } } else {