28 template<
class T,
unsigned D>
31 explicitly_defined =
false;
41 template<
class T,
unsigned D>
45 explicitly_defined =
true;
50 template<
class T,
unsigned D>
60 for (
int i = 0; i < D; ++i)
61 for (
int j = 0; j < D; ++j)
63 for (
int i = 0; i < D; ++i)
64 for (
int j = 0; j < D; ++j)
66 for (
int i = 0; i < D; ++i)
69 OneOverLength[i] = 1.0 / Length[i];
72 for (
int i = 0; i < D; ++i)
77 SuperCellEnum = ldesc(BoxBConds);
78 DiagonalOnly = ldesc.isDiagonalOnly(R);
79 ABC = ldesc.calcSolidAngles(Rv, OneOverLength);
80 WignerSeitzRadius = ldesc.calcWignerSeitzRadius(Rv);
81 WignerSeitzRadius_G = ldesc.calcWignerSeitzRadius(Gv);
82 SimulationCellRadius = ldesc.calcSimulationCellRadius(Rv);
84 if (WignerSeitzRadius > SimulationCellRadius &&
85 WignerSeitzRadius - SimulationCellRadius <= WignerSeitzRadius * std::numeric_limits<float>::epsilon() * 2)
86 WignerSeitzRadius = SimulationCellRadius;
87 CellRadiusSq = SimulationCellRadius * SimulationCellRadius;
94 template<
class T,
unsigned D>
102 template<
class T,
unsigned D>
109 std::string unit_name =
"bohr";
111 std::string lattice_name =
" Lattice (" + unit_name +
"):";
112 std::string pad(lattice_name.length(),
' ');
114 for (
int i = 0; i < D; ++i)
120 os << Rv[i] << std::endl;
125 os <<
" Boundary Conditions: ";
126 for (
int i = 0; i < D; ++i)
134 if (VacuumScale != 1.0)
135 os <<
" Vacuum scale: " << VacuumScale << std::endl;
140 os <<
" Volume (bohr^3) = " << Volume << std::endl;
142 os <<
" Reciprocal vectors without 2*pi.\n";
143 for (
int i = 0; i < D; ++i)
144 os <<
" g_" << i + 1 <<
" = " << Gv[i] << std::endl;
146 os <<
" Metric tensor in real-space.\n";
147 for (
int i = 0; i < D; ++i)
149 os <<
" h_" << i + 1 <<
" = ";
150 for (
int j = 0; j < D; ++j)
152 os << M(i, j) <<
" ";
157 os <<
" Metric tensor in g-space.\n";
158 for (
int i = 0; i < D; ++i)
160 os <<
" h_" << i + 1 <<
" = ";
161 for (
int j = 0; j < D; ++j)
163 os << Mg(i, j) <<
" ";
170 template<
class T,
unsigned D>
173 for (
int i = 0; i < D * D; ++i)
174 if (
std::abs(lhs.
R[i] - rhs.
R[i]) > std::numeric_limits<T>::epsilon())
179 template<
class T,
unsigned D>
182 return !(lhs == rhs);
void set(const Tensor< TT, D > &lat)
set the lattice vector from the command-line options
a class that defines a supercell in D-dimensional Euclean space.
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
helper functions for EinsplineSetBuilder
Tensor< T, D >::Type_t det(const Tensor< T, D > &a)
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
bool operator==(const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)
CrystalLattice< T, D > & operator*=(T sc)
scale the lattice vectors by sc.
void print(std::ostream &, int level=2) const
Print out CrystalLattice Data.
Tensor<T,D> class for D by D tensor.
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CrystalLattice()
default constructor, assign a huge supercell
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
generic class to analyze a Lattice
Tensor< T, D > inverse(const Tensor< T, D > &a)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.
bool operator!=(const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)