Improve parameter typing for gmxapi simulation parameter setter.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Wed, 25 Sep 2019 10:04:39 +0000 (13:04 +0300)
committerEric Irrgang <ericirrgang@gmail.com>
Sat, 12 Oct 2019 13:41:38 +0000 (15:41 +0200)
* Use conventional simple built-in types for simulation parameter
  setter.
* Resolve a sphinx warning due to unrecognized documented parameter
  type.
* Make sure we test both integer and floating point parameter setting.

Change-Id: I3c51bbeaf8a5145690e8000b159099476ff53be6

python_packaging/src/gmxapi/export_tprfile.cpp

index 8134ba9f68c92df2799fc7ce407e9c0c1d6c7e3a..b5d86404be83ab9e18db6ba6138ac8755b0a0979 100644 (file)
@@ -110,17 +110,17 @@ void detail::export_tprfile(pybind11::module &module)
 
     // Overload a setter for each known type and None
     mdparams.def("set",
-                 [](GmxMdParams* self, const std::string &key, py::int_ value)
+                 [](GmxMdParams* self, const std::string &key, int64_t value)
                  {
-                     gmxapicompat::setParam(self, key, py::cast<int64_t>(value));
+                     gmxapicompat::setParam(self, key, value);
                  },
                  py::arg("key").none(false),
                  py::arg("value").none(false),
                  "Use a dictionary to update simulation parameters.");
     mdparams.def("set",
-                 [](GmxMdParams* self, const std::string &key, py::float_ value)
+                 [](GmxMdParams* self, const std::string &key, double value)
                  {
-                     gmxapicompat::setParam(self, key, py::cast<double>(value));
+                     gmxapicompat::setParam(self, key, value);
                  },
                  py::arg("key").none(false),
                  py::arg("value").none(false),