diff --git a/source/api_cc/include/common.h b/source/api_cc/include/common.h index c4db90687f..24b58f669c 100644 --- a/source/api_cc/include/common.h +++ b/source/api_cc/include/common.h @@ -227,9 +227,9 @@ int session_get_dtype(tensorflow::Session* session, * @param[in] fparam_ Frame parameters. * @param[in] aparam_ Atom parameters. * @param[in] atommap Atom map. + * @param[in] scope The scope of the tensors. * @param[in] aparam_nall Whether the atomic dimesion of atomic parameters is * nall. - * @param[in] scope The scope of the tensors. */ template int session_input_tensors( @@ -257,9 +257,9 @@ int session_input_tensors( * @param[in] atommap Atom map. * @param[in] nghost Number of ghost atoms. * @param[in] ago Update the internal neighbour list if ago is 0. + * @param[in] scope The scope of the tensors. * @param[in] aparam_nall Whether the atomic dimesion of atomic parameters is * nall. - * @param[in] scope The scope of the tensors. */ template int session_input_tensors( @@ -274,8 +274,8 @@ int session_input_tensors( const deepmd::AtomMap& atommap, const int nghost, const int ago, - const bool aparam_nall = false, - const std::string scope = ""); + const std::string scope = "", + const bool aparam_nall = false); /** * @brief Get input tensors for mixed type. @@ -290,9 +290,9 @@ int session_input_tensors( * @param[in] atommap Atom map. * @param[in] nghost Number of ghost atoms. * @param[in] ago Update the internal neighbour list if ago is 0. + * @param[in] scope The scope of the tensors. * @param[in] aparam_nall Whether the atomic dimesion of atomic parameters is * nall. - * @param[in] scope The scope of the tensors. */ template int session_input_tensors_mixed_type( @@ -306,8 +306,8 @@ int session_input_tensors_mixed_type( const std::vector& fparam_, const std::vector& aparam_, const deepmd::AtomMap& atommap, - const bool aparam_nall = false, - const std::string scope = ""); + const std::string scope = "", + const bool aparam_nall = false); /** * @brief Read model file to a string. diff --git a/source/api_cc/src/DeepPot.cc b/source/api_cc/src/DeepPot.cc index 98674efcb3..09ffd1e365 100644 --- a/source/api_cc/src/DeepPot.cc +++ b/source/api_cc/src/DeepPot.cc @@ -591,14 +591,14 @@ void DeepPot::compute(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int ret = session_input_tensors(input_tensors, dcoord_, ntypes, datype_, dbox, cell_size, fparam, - aparam, atommap, aparam_nall); + aparam, atommap, "", aparam_nall); assert(ret == nloc); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes); } else { int ret = session_input_tensors(input_tensors, dcoord_, ntypes, datype_, dbox, cell_size, fparam, - aparam, atommap, aparam_nall); + aparam, atommap, "", aparam_nall); assert(ret == nloc); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes); @@ -768,14 +768,14 @@ void DeepPot::compute_inner(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int ret = session_input_tensors( input_tensors, dcoord_, ntypes, datype_, dbox, nlist, fparam, aparam, - atommap, nghost, ago, aparam_nall); + atommap, nghost, ago, "", aparam_nall); assert(nloc == ret); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes, nghost); } else { - int ret = session_input_tensors(input_tensors, dcoord_, ntypes, - datype_, dbox, nlist, fparam, aparam, - atommap, nghost, ago, aparam_nall); + int ret = session_input_tensors( + input_tensors, dcoord_, ntypes, datype_, dbox, nlist, fparam, aparam, + atommap, nghost, ago, "", aparam_nall); assert(nloc == ret); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes, nghost); @@ -857,13 +857,13 @@ void DeepPot::compute(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int nloc = session_input_tensors(input_tensors, dcoord_, ntypes, datype_, dbox, cell_size, fparam, - aparam, atommap, aparam_nall); + aparam, atommap, "", aparam_nall); run_model(dener, dforce_, dvirial, datom_energy_, datom_virial_, session, input_tensors, atommap, nframes); } else { int nloc = session_input_tensors(input_tensors, dcoord_, ntypes, datype_, dbox, cell_size, fparam, - aparam, atommap, aparam_nall); + aparam, atommap, "", aparam_nall); run_model(dener, dforce_, dvirial, datom_energy_, datom_virial_, session, input_tensors, atommap, nframes); } @@ -963,14 +963,14 @@ void DeepPot::compute(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int ret = session_input_tensors( input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, - atommap, nghost_real, ago, aparam_nall); + atommap, nghost_real, ago, "", aparam_nall); assert(nloc_real == ret); run_model(dener, dforce, dvirial, datom_energy, datom_virial, session, input_tensors, atommap, nframes, nghost_real); } else { int ret = session_input_tensors( input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, - atommap, nghost_real, ago, aparam_nall); + atommap, nghost_real, ago, "", aparam_nall); assert(nloc_real == ret); run_model(dener, dforce, dvirial, datom_energy, datom_virial, session, input_tensors, atommap, nframes, nghost_real); @@ -1075,14 +1075,14 @@ void DeepPot::compute_mixed_type(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int ret = session_input_tensors_mixed_type( input_tensors, nframes, dcoord_, ntypes, datype_, dbox, cell_size, - fparam, aparam, atommap, aparam_nall); + fparam, aparam, atommap, "", aparam_nall); assert(ret == nloc); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes); } else { int ret = session_input_tensors_mixed_type( input_tensors, nframes, dcoord_, ntypes, datype_, dbox, cell_size, - fparam, aparam, atommap, aparam_nall); + fparam, aparam, atommap, "", aparam_nall); assert(ret == nloc); run_model(dener, dforce_, dvirial, session, input_tensors, atommap, nframes); @@ -1161,13 +1161,13 @@ void DeepPot::compute_mixed_type(ENERGYVTYPE& dener, if (dtype == tensorflow::DT_DOUBLE) { int nloc = session_input_tensors_mixed_type( input_tensors, nframes, dcoord_, ntypes, datype_, dbox, cell_size, - fparam, aparam, atommap, aparam_nall); + fparam, aparam, atommap, "", aparam_nall); run_model(dener, dforce_, dvirial, datom_energy_, datom_virial_, session, input_tensors, atommap, nframes); } else { int nloc = session_input_tensors_mixed_type( input_tensors, nframes, dcoord_, ntypes, datype_, dbox, cell_size, - fparam, aparam, atommap, aparam_nall); + fparam, aparam, atommap, "", aparam_nall); run_model(dener, dforce_, dvirial, datom_energy_, datom_virial_, session, input_tensors, atommap, nframes); } @@ -1481,11 +1481,11 @@ void DeepPotModelDevi::compute(std::vector& all_energy, if (dtype == tensorflow::DT_DOUBLE) { ret = session_input_tensors(input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, atommap, - nghost_real, ago, aparam_nall); + nghost_real, ago, "", aparam_nall); } else { ret = session_input_tensors(input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, atommap, - nghost_real, ago, aparam_nall); + nghost_real, ago, "", aparam_nall); } all_energy.resize(numb_models); all_force.resize(numb_models); @@ -1579,11 +1579,11 @@ void DeepPotModelDevi::compute( if (dtype == tensorflow::DT_DOUBLE) { ret = session_input_tensors(input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, atommap, - nghost_real, ago, aparam_nall); + nghost_real, ago, "", aparam_nall); } else { ret = session_input_tensors(input_tensors, dcoord, ntypes, datype, dbox, nlist, fparam, aparam, atommap, - nghost_real, ago, aparam_nall); + nghost_real, ago, "", aparam_nall); } all_energy.resize(numb_models); diff --git a/source/api_cc/src/common.cc b/source/api_cc/src/common.cc index 5175c9f317..d4be7c1de8 100644 --- a/source/api_cc/src/common.cc +++ b/source/api_cc/src/common.cc @@ -374,8 +374,8 @@ int deepmd::session_input_tensors( const std::vector& fparam_, const std::vector& aparam__, const deepmd::AtomMap& atommap, - const bool aparam_nall, - const std::string scope) { + const std::string scope, + const bool aparam_nall) { int nframes = dcoord_.size() / 3 / datype_.size(); int nall = datype_.size(); int nloc = nall; @@ -514,8 +514,8 @@ int deepmd::session_input_tensors( const deepmd::AtomMap& atommap, const int nghost, const int ago, - const bool aparam_nall, - const std::string scope) { + const std::string scope, + const bool aparam_nall) { int nframes = dcoord_.size() / 3 / datype_.size(); int nall = datype_.size(); int nloc = nall - nghost; @@ -651,8 +651,8 @@ int deepmd::session_input_tensors_mixed_type( const std::vector& fparam_, const std::vector& aparam__, const deepmd::AtomMap& atommap, - const bool aparam_nall, - const std::string scope) { + const std::string scope, + const bool aparam_nall) { int nall = datype_.size() / nframes; int nloc = nall; assert(nall * 3 * nframes == dcoord_.size());