5#ifndef OILAB_LATTICEVECTORBINDINGS_H
6#define OILAB_LATTICEVECTORBINDINGS_H
8#include <pybind11/pybind11.h>
9#include <pybind11/operators.h>
10#include "../Lattices/LatticeModule.h"
12#include <pybind11/numpy.h>
13#include <pybind11/eigen.h>
15namespace py = pybind11;
30 using MatrixDimI = Eigen::Matrix<IntScalarType, dim, dim>;
55 lv.operator+=(other.
lv);
60 lv.operator-=(other.
lv);
85 typename std::enable_if<dm==2,PyReciprocalLatticeDirection>::type
92 typename std::enable_if<dm==3,PyReciprocalLatticeDirection>::type
99 typename std::enable_if<dm==2,PyReciprocalLatticeDirection>::type
105 typename std::enable_if<dm==3,PyReciprocalLatticeDirection>::type
122 using IntScalarType =
long long int;
123 using MatrixDimD = Eigen::Matrix<double, dim, dim>;
124 using VectorDimD = Eigen::Matrix<double, dim, 1>;
125 using VectorDimI = Eigen::Matrix<IntScalarType, dim, 1>;
126 using MatrixDimI = Eigen::Matrix<IntScalarType, dim, dim>;
130 py::class_<PyLatticeVector>(
131 m, (
"LatticeVector" + std::to_string(dim) +
"D").c_str(),
132 (
"LatticeVector" + std::to_string(dim) +
"D class").c_str())
133 .def(py::init<const Lattice &>())
134 .def(py::init<const VectorDimD &, const Lattice &>())
135 .def(py::init<const VectorDimI &, const Lattice &>())
136 .def(py::init<const PyLatticeVector &>())
140 py::return_value_policy::reference_internal)
142 .def(
"integerCoordinates",
145 "output the integer coordinates of the lattice vecctor")
146 .def(
"integerCoordinates",
149 "input the integer coordinates of the lattice vector")
151 "dot product with a reciprocal lattice vector")
152 .def(py::self + py::self)
153 .def(py::self - py::self)
157 return self * scalar;
163 return scalar * self;
166 .def(py::self -= py::self)
167 .def(py::self += py::self)
const Lattice< dim > & lattice
IntScalarType dot(const ReciprocalLatticeVector< dim > &other) const
std::enable_if< dm==2, ReciprocalLatticeDirection< dm > >::type cross(const LatticeVector< dm > &other) const
VectorDimD cartesian() 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)