5#ifndef OILAB_LATTICEVECTORBINDINGS_H
6#define OILAB_LATTICEVECTORBINDINGS_H
8#include <pybind11/pybind11.h>
9#include <pybind11/operators.h>
12#include <pybind11/numpy.h>
13#include <pybind11/eigen.h>
15namespace py = pybind11;
31 using MatrixDimI = Eigen::Matrix<IntScalarType, dim, dim>;
56 lv.operator+=(other.
lv);
61 lv.operator-=(other.
lv);
86 typename std::enable_if<dm==2,PyReciprocalLatticeDirection>::type
93 typename std::enable_if<dm==3,PyReciprocalLatticeDirection>::type
100 typename std::enable_if<dm==2,PyReciprocalLatticeDirection>::type
106 typename std::enable_if<dm==3,PyReciprocalLatticeDirection>::type
123 using IntScalarType =
long long int;
124 using MatrixDimD = Eigen::Matrix<double, dim, dim>;
125 using VectorDimD = Eigen::Matrix<double, dim, 1>;
126 using VectorDimI = Eigen::Matrix<IntScalarType, dim, 1>;
127 using MatrixDimI = Eigen::Matrix<IntScalarType, dim, dim>;
131 py::class_<PyLatticeVector>(m, (
"LatticeVector" + std::to_string(dim) +
"D").c_str(),(
"LatticeVector" + std::to_string(dim) +
"D class").c_str())
132 .def(py::init<const Lattice&>())
133 .def(py::init<const VectorDimD&, const Lattice&>())
134 .def(py::init<const VectorDimI&, const Lattice&>())
135 .def(py::init<const PyLatticeVector&>())
138 },py::return_value_policy::reference_internal)
141 "output the integer coordinates of the lattice vecctor")
143 "input the integer coordinates of the lattice vector")
145 "dot product with a reciprocal lattice vector")
146 .def(py::self + py::self)
147 .def(py::self - py::self)
148 .def(
"__mul__", [](
const PyLatticeVector& self,
const IntScalarType& scalar) {
149 return self * scalar;
150 }, py::is_operator())
151 .def(
"__rmul__", [](
const PyLatticeVector& self,
const IntScalarType& scalar) {
152 return scalar * self;
153 }, py::is_operator())
154 .def(py::self -= py::self)
155 .def(py::self += py::self)
VectorDimD cartesian() const
const Lattice< dim > & lattice
std::enable_if< dm==2, ReciprocalLatticeDirection< dm > >::type cross(const LatticeVector< dm > &other) const
IntScalarType dot(const ReciprocalLatticeVector< dim > &other) const
Eigen::Matrix< double, dim, dim > MatrixDimD
PyLatticeVector operator*(const IntScalarType &scalar) const
PyLatticeVector operator+(const PyLatticeVector &other) const
PyLatticeVector operator-(const PyLatticeVector &other) const
PyLatticeVector(const LatticeVector &lv)
std::enable_if< dm==3, PyReciprocalLatticeDirection >::type cross(const PyLatticeVector< dm > &other) const
VectorDimD cartesian() const
PyLatticeVector(const VectorDimI &integerCoordinates, const Lattice &lattice)
PyLatticeVector(const Lattice &lattice)
PyLatticeVector operator+=(const PyLatticeVector &other)
IntScalarType dot(const PyReciprocalLatticeVector< dim > &other)
VectorDimI integerCoordinates() const
long long int IntScalarType
Eigen::Matrix< double, dim, 1 > VectorDimD
PyLatticeVector(const VectorDimD &cartesianCoordinates, const Lattice &lattice)
PyLatticeVector(const PyLatticeVector &)=default
Eigen::Matrix< IntScalarType, dim, dim > MatrixDimI
Eigen::Matrix< IntScalarType, dim, 1 > VectorDimI
PyLatticeVector operator-=(const PyLatticeVector &other)
PyReciprocalLatticeDirection< dim > PyReciprocalLatticeDirection
std::enable_if< dm==3, PyReciprocalLatticeDirection >::type cross() const
std::enable_if< dm==2, PyReciprocalLatticeDirection >::type cross() const
std::enable_if< dm==2, PyReciprocalLatticeDirection >::type cross(const PyLatticeVector< dim > &other) const
void integerCoordinates(const VectorDimI &input)
ReciprocalLatticeVector rlv
PyLatticeVector< dim > operator*(const long long int &scalar, const PyLatticeVector< dim > &L)
void bind_LatticeVector(py::module_ &m)