8#ifndef model_ReciprocalLatticeVector_cpp_
9#define model_ReciprocalLatticeVector_cpp_
12#include <LatticeModule.h>
61 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
68 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
76 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
83 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
97 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
104 assert(&
lattice == &other.
lattice &&
"LatticeVectors belong to different Lattices.");
111 return lattice.reciprocalBasis *
base().template cast<double>();
124 return c /
c.squaredNorm();
130 assert(
base().squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
132 return std::lround(hd);
138 assert(
base().squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
140 const long int h(std::lround(hd));
141 if (fabs(hd -
h) > FLT_EPSILON)
143 std::cout <<
"P=" << P.transpose() << std::endl;
144 std::cout <<
"r=" << this->
cartesian().transpose() << std::endl;
145 std::cout <<
"hd=" << std::setprecision(15) << std::scientific << hd << std::endl;
146 std::cout <<
"h=" <<
h << std::endl;
147 throw std::runtime_error(
"P in not on a lattice plane.");
155 assert(
base().squaredNorm() > 0 &&
"A null ReciprocalLatticeVector cannot be used to compute planeIndexOfPoint");
167 std::cout <<
"d2cov, nd=" << nd.transpose() << std::endl;
168 std::cout <<
"d2cov, rd=" << rd.transpose() << std::endl;
169 throw std::runtime_error(
"Input vector is not a reciprocal lattice vector");
171 return rd.template cast<long int>();
180 template class ReciprocalLatticeVector<3>;
const MatrixDimD latticeBasis
const LatticeType & lattice
LatticeCore< 3 >::VectorDimI VectorDimI
static VectorDimI d2cov(const VectorDimD &d, const LatticeType &lat)
LatticeVector< dim > LatticeVectorType
ReciprocalLatticeVector< dim > ReciprocalLatticeVectorType
ReciprocalLatticeVectorType operator-(const ReciprocalLatticeVectorType &other) const
ReciprocalLatticeVectorType operator*(const long int &scalar) const
Eigen::Matrix< long int, dim, 1 > VectorDimI
VectorDimD interplaneVector() const
Lattice< dim > LatticeType
LatticeDirectionType cross(const ReciprocalLatticeVectorType &other) const
ReciprocalLatticeVectorType & operator+=(const ReciprocalLatticeVectorType &other)
long int planeIndexOfPoint(const VectorDimD &P) const
VectorDimD cartesian() const
Eigen::Matrix< double, dim, 1 > VectorDimD
Eigen::Matrix< long int, dim, 1 > BaseType
long int closestPlaneIndexOfPoint(const VectorDimD &P) const
ReciprocalLatticeVector(const LatticeType &lat)
double planeSpacing() const
ReciprocalLatticeVectorType operator+(const ReciprocalLatticeVectorType &other) const
ReciprocalLatticeVectorType & operator-=(const ReciprocalLatticeVectorType &other)
long int dot(const LatticeVectorType &other) const
LatticeDirection< dim > LatticeDirectionType
const LatticeType & lattice
static constexpr double roundTol
auto operator*(const std::shared_ptr< BilinearForm< T1, T2 > > &f, const IntegrationDomain< FE, D, Q, Rule > &dom)
auto eval(const std::shared_ptr< T > &t)