From 38db2d88812e4c422ccaab479d4b45b6e4a92afb Mon Sep 17 00:00:00 2001 From: "Ben R. Ryan" Date: Mon, 23 Mar 2020 09:29:49 -0600 Subject: [PATCH 1/2] bugfix --- src/cdi_ndi/NDI_AtomicMass.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cdi_ndi/NDI_AtomicMass.cc b/src/cdi_ndi/NDI_AtomicMass.cc index a66d5424bf..54beebea0c 100644 --- a/src/cdi_ndi/NDI_AtomicMass.cc +++ b/src/cdi_ndi/NDI_AtomicMass.cc @@ -69,15 +69,17 @@ double NDI_AtomicMass::get_amw(const int zaid) const { NDI2_set_option_gendir(gendir_handle, NDI_LIBRARY_DEFAULT, "mendf71x"); Require(ndi_error == 0); + std::string zaid_formatted = std::to_string(zaid) + "."; + int size = NDI2_get_size_x(gendir_handle, NDI_AT_WGT, - std::to_string(zaid).c_str(), &ndi_error); + zaid_formatted.c_str(), &ndi_error); Require(ndi_error == 0); Insist(size == 1, "NDI returned more or fewer than one atomic weight?"); std::array arr; ndi_error = NDI2_get_float64_vec_x(gendir_handle, NDI_AT_WGT, - std::to_string(zaid).c_str(), arr.data(), size); + zaid_formatted.c_str(), arr.data(), size); Require(ndi_error == 0); ndi_error = NDI2_close_gendir(gendir_handle); From 5f589a6cb32494c575226f10493bb957d2597353 Mon Sep 17 00:00:00 2001 From: "Ben R. Ryan" Date: Mon, 23 Mar 2020 09:34:06 -0600 Subject: [PATCH 2/2] Formatting --- src/cdi_ndi/NDI_AtomicMass.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cdi_ndi/NDI_AtomicMass.cc b/src/cdi_ndi/NDI_AtomicMass.cc index 54beebea0c..3c661ae6d5 100644 --- a/src/cdi_ndi/NDI_AtomicMass.cc +++ b/src/cdi_ndi/NDI_AtomicMass.cc @@ -71,15 +71,14 @@ double NDI_AtomicMass::get_amw(const int zaid) const { std::string zaid_formatted = std::to_string(zaid) + "."; - int size = NDI2_get_size_x(gendir_handle, NDI_AT_WGT, - zaid_formatted.c_str(), &ndi_error); + int size = NDI2_get_size_x(gendir_handle, NDI_AT_WGT, zaid_formatted.c_str(), + &ndi_error); Require(ndi_error == 0); Insist(size == 1, "NDI returned more or fewer than one atomic weight?"); std::array arr; - ndi_error = - NDI2_get_float64_vec_x(gendir_handle, NDI_AT_WGT, - zaid_formatted.c_str(), arr.data(), size); + ndi_error = NDI2_get_float64_vec_x(gendir_handle, NDI_AT_WGT, + zaid_formatted.c_str(), arr.data(), size); Require(ndi_error == 0); ndi_error = NDI2_close_gendir(gendir_handle);