Overview
This week I started by making a github repository named pyseams. Me and my mentor worked together on writing a meson build file. After this, I realised that dSEAMS had some enums which had to be converted to enum class to prevent the implicit conversion to other types i.e., to another enum or int and made a pull request for the same thing. Then I proceeded with writing bindings using pybind11, tested it locally, and committed to the git repo pyseams.
// The following bindings are still in progress:
#include <pybind11/pybind11.h>
#include "../subprojects/seams-core/src/include/internal/mol_sys.hpp"
namespace py = pybind11;
PYBIND11_MODULE(cyoda, m) {
py::class_<molSys::Point<double>>(m, "PointDouble")
.def(py::init<>())
.def_readwrite("c_type", &molSys::Point<double>::type)
.def_readwrite("molID", &molSys::Point<double>::molID)
.def_readwrite("atomID", &molSys::Point<double>::atomID)
.def_readwrite("x", &molSys::Point<double>::x)
.def_readwrite("y", &molSys::Point<double>::y)
.def_readwrite("z", &molSys::Point<double>::z);
py::enum_<molSys::bond_type>(m, "BondType")
.value("staggered", molSys::bond_type::staggered)
.value("eclipsed", molSys::bond_type::eclipsed)
.value("out_of_range", molSys::bond_type::out_of_range);
py::enum_<molSys::atom_state_type >(m, "AtomStateType")
.value("cubic", molSys::atom_state_type ::cubic)
.value("hexagonal", molSys::atom_state_type ::hexagonal)
.value("water", molSys::atom_state_type ::water)
.value("interfacial", molSys::atom_state_type ::interfacial)
.value("clathrate", molSys::atom_state_type ::clathrate)
.value("interClathrate", molSys::atom_state_type ::interClathrate)
.value("unclassified", molSys::atom_state_type ::unclassified)
.value("reCubic", molSys::atom_state_type ::reCubic)
.value("reHex", molSys::atom_state_type ::reHex);
py::class_<molSys::Result>(m, "Result")
.def(py::init<>())
.def_readwrite("classifier", &molSys::Result::classifier)
.def_readwrite("c_value", &molSys::Result::c_value);
}
Check-in Questions
What did you do this week?
-
Made a Github repository named pyseams.
-
Pull request for enum to enum class change.
-
Made a meson build file.
-
Started compiling the extensions and running the
python
bindings.
What is coming up next?
-
Finishing the
python
bindings for the first workflow in thelua
design as discussed earlier. -
Writing documentation and tests
-
Moving the pyseams repository to the dseams-core.
Did you get stuck anywhere?
I was a bit stuck at the meson build file process, but my mentor helped me with it. I think I am on track.