#include <fstream>
#include<vector>
{
Eigen::Matrix3d A;
A << 0.5, 0.5, 0,
0.5, 0.0, 0.5,
0.0, 0.5, 0.5;
std::cout << "Lattice basis:" << std::endl;
std::cout << "Reciprocal lattice basis:" << std::endl;
std::cout << "Creating a zero lattice vector u:" << std::endl;
std::cout << u << std::endl;
std::cout << "Modifying u:" << std::endl;
u << 2,1,3;
std::cout << u << std::endl;
std::cout << "Cartesian coordinates of u:" << std::endl;
std::cout << "Recover lattice vector from its cartesian components:";
std::cout << "Create a lattice vector using cartesian coordinates: 1.5,2,3.5" << std::endl;
Eigen::Vector3d vCoords; vCoords << 1.5,2,3.5;
std::cout << "Integer coordinates of v:" << std::endl;
std::cout << v << std::endl;
try{
Eigen::Vector3d wCoords; wCoords << 1.8,2,3.5;
}
catch(std::runtime_error& e)
{
std::cout << e.what() << std::endl;
}
v << 1,1,2;
std::cout << "Integer coordinates of w:" << std::endl;
std::cout << w << std::endl;
std::cout << "Cartesian coordinates of w:" << std::endl;
std::cout << "Lattice direction along w:" << std::endl;
std::cout << wDir << std::endl;
std::cout << "Creating a reciprocal lattice vector r:" << std::endl;
r << 3,6,9;
std::cout << r << std::endl;
std::cout << "Cartesian coordinates of the reciprocal lattice vector r:" << std::endl;
std::cout << "Reciprocal lattice direction along r:" << std::endl;
std::cout << s << std::endl;
std::cout << "Recover the reciprocal lattice vector from the reciprocal lattice direction s:" << std::endl;
std::cout << t << std::endl;
std::cout << "Lattice direction along s = " << std::endl;
std::cout << latticeDirectionAlong_s << std::endl;
std::cout <<
"Stacking of the lattice plane described by s = " << s.
stacking() << std::endl;
std::cout << "The cross product of the lattice vectors u and v is a lattice direction: " << uxv << std::endl;
q << 7,9,11;
std::cout << "Reciprocal lattice vector q = " << std::endl;
std::cout << q << std::endl;
std::cout << "The cross product of two reciprocal lattice vectors q and r is a lattice direction: " << qxr<< std::endl;
std::vector<LatticeVector<3>> boxVectors;
std::cout << "Outputting a configuration of lattice points bounded by three box vectors: " << std::endl;
for (const auto& vector : boxVectors)
std::cout << vector.
cartesian().transpose() << std::endl;
L.
box(boxVectors,
"lattice.txt");
Eigen::Matrix2d B;
B << 1.0, 0.0,
0.5, 1.0;
std::cout << "Outputting a configuration of lattice points bounded by two box vectors: " << std::endl;
std::cout << b1.
cartesian().transpose() << std::endl;
std::cout << b2.
cartesian().transpose() << std::endl;
return 0;
}
const MatrixDimD latticeBasis
const MatrixDimD reciprocalBasis
std::enable_if< dm==3, std::vector< LatticeVector< dim > > >::type box(const std::vector< LatticeVector< dim > > &boxVectors, const std::string &filename="") const
LatticeVector< dim > latticeVector(const VectorDimD &p) const
Returns a lattice vector (in the current lattice) with Cartesian coordinates p.
LatticeDirection< dim > latticeDirection(const VectorDimD &d, const double &tol=FLT_EPSILON) const
Returns the lattice direction along a vector.
VectorDimD cartesian() const
std::enable_if< dm==2, ReciprocalLatticeDirection< dm > >::type cross(const LatticeVector< dm > &other) const
std::enable_if< dm==2, LatticeDirection< dim > >::type cross(const ReciprocalLatticeVector< dim > &other) const
VectorDimD cartesian() const
int main(int argc, char **argv)
const LatticeVector< dim > & latticeVector() const
int stacking() const
Returns the number of planes in the stacking sequence.
const ReciprocalLatticeVector< dim > & reciprocalLatticeVector() const
Returns a constant reference to the base class (ReciprocalLatticeVector)