24 for(
int i = 0; i < 3; i++) {
25 for(
int j = 0; j < 3; j++) {
30 std::cerr <<
"CRITICAL ERROR: Attempting to construct a PrimGrid for a superlattice that is smaller than lattice passed as its prim.\n"
31 <<
"floating-point transformation matrix:\n" << dtrans_mat <<
"\n was rounded to integer matrix:\n" <<
m_trans_mat <<
"\n\n"
32 <<
"This usage of PrimGrid is not supported. Exiting...\n";
52 m_S = Smat.diagonal();
58 m_N_vol = m_S[0] * m_S[1] * m_S[2];
62 Smat(0, 0) =
m_N_vol / Smat(0, 0);
63 Smat(1, 1) =
m_N_vol / Smat(1, 1);
64 Smat(2, 2) =
m_N_vol / Smat(2, 2);
86 const Eigen::Ref<const PrimGrid::matrix_type> &U,
87 const Eigen::Ref<const PrimGrid::matrix_type> &Smat,
96 for(
int i = 0; i < 3; i++) {
97 for(
int j = 0; j < 3; j++) {
103 std::cerr <<
"CRITICAL ERROR: Attempting to construct a PrimGrid for a superlattice that is smaller than lattice passed as its prim.\n"
104 <<
"floating-point transformation matrix:\n" << dtrans_mat <<
"\n was rounded to integer matrix:\n" <<
m_trans_mat <<
"\n\n"
105 <<
"This usage of PrimGrid is not supported. Exiting...\n";
112 for(
int i = 0; i < 3; i++) {
119 m_N_vol = m_S[0] * m_S[1] * m_S[2];
141 return m_S.asDiagonal();
146 auto lambda = [](
double val) {
236 assert(i >= 0 && i <
m_N_vol &&
"PrimGrid::uccoord(Index i) -> index 'i' out of range!");
240 (i % m_stride[1]) / m_stride[0],
253 for(
Index ng = 0; ng < group.
size(); ng++) {
254 SymBasisPermute const *rep = group[ng].get_basis_permute_rep(basis_permute_ID);
256 std::cerr <<
"CRITICAL ERROR: In PrimGrid::make_permutation_representation, BasisPermute representation is incorrectly initialized!\n"
257 <<
" basis_permute_ID is " << basis_permute_ID <<
" and op index is " << group[ng].index() <<
"\n"
265 std::vector<UnitCellCoord>
const &b_permute = rep->
data();
270 for(
Index nb = 0; nb < b_permute.size(); nb++) {
276 for(; mnp_count.
valid(); ++mnp_count) {
277 new_mnp = mat_mnp * mnp_count() + mnp_shift.
unitcell();
280 for(
int i = 0; i < 3; i++) {
281 new_mnp[i] = ((new_mnp[i] %
m_S[i]) +
m_S[i]) %
m_S[i];
285 new_l = new_mnp[0] + new_mnp[1] *
m_stride[0] + new_mnp[2] *
m_stride[1] + mnp_shift[0] *
size();
286 assert(old_l < b_permute.size()*
size() && new_l < b_permute.size()*
size());
294 ipermute[new_l] = old_l;
315 for(
Index shift_l = 0; shift_l <
size(); shift_l++) {
319 shift_bmnp[3] = shift_l /
m_stride[1];
321 for(
Index old_l = 0; old_l <
size(); old_l++) {
327 bmnp[1] = (bmnp[1] + shift_bmnp[1]) %
m_S[0];
328 bmnp[2] = (bmnp[2] + shift_bmnp[2]) %
m_S[1];
329 bmnp[3] = (bmnp[3] + shift_bmnp[3]) %
m_S[2];
332 for(
Index nb = 0; nb < NB; nb++) {
336 ipermute[new_l + nb *
size()] = old_l + nb *
size();
350 for(
int i = 0; i < 3; i++) {
351 for(
int j = 0; j < 3; j++) {
352 bmnp[i + 1] +=
m_invU(i, j) * bijk[j + 1];
355 bmnp[i + 1] = ((bmnp[i + 1] %
m_S[i]) +
m_S[i]) %
m_S[i];
366 for(
int i = 0; i < 3; i++) {
367 for(
int j = 0; j < 3; j++) {
368 bijk[i + 1] +=
m_U(i, j) * bmnp[j + 1];
Eigen::Matrix< long, 3, 1 > vector_type
static SymOp translation(const Eigen::Ref< const vector_type > &_tau)
static method to create operation that describes pure translation
long int m_N_vol
Number of primgrid lattice points in the supercell.
A Counter allows looping over many incrementing variables in one loop.
Coordinate_impl::CartCoordinate cart()
Set Cartesian coordinate vector and update fractional coordinate vector.
Type-safe ID object for communicating and accessing Symmetry representation info. ...
long int m_NB
Number of basis atoms in the primitive cell.
void push_back(const T &toPush)
matrix_type m_U
The Smith Normal Form decomposition is: trans_mat = U*S*V, with det(U)=det(V)=1; S is diagonal...
UnitCellCoord to_canonical(const UnitCellCoord &bijk) const
SymBasisPermute describes how a symmetry operation permutes atoms in a basis.
Eigen::Matrix< long, 3, 1 > m_S
Lattice const * m_lat[2]
m_lat[PRIM] is primitive lattice, lat[SCEL] is super lattice
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
const Eigen::DiagonalWrapper< const PrimGrid::vector_type > matrixS() const
Index find(const Coordinate &_coord) const
SymPermutation describes how a symmetry operation permutes a list of 'things' For example...
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Represents cartesian and fractional coordinates.
SymGroupRepID make_permutation_representation(const SymGroup &group, SymGroupRepID basis_permute_rep) const
const std::vector< UnitCellCoord > & data() const
Get underlying data (data()[b] is the result of transforming (b,0,0,0))
UnitCellCoord get_within(const UnitCellCoord &_uccoord) const
Eigen::Matrix< typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > adjugate(const Eigen::MatrixBase< Derived > &M)
Return adjugate matrix.
EigenIndex Index
For long integer indexing:
Eigen::Matrix< typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > inverse(const Eigen::MatrixBase< Derived > &M)
Return the integer inverse matrix of an invertible integer matrix.
void set_lattice(const Lattice &new_lat, COORD_TYPE mode)
Change the home lattice of the coordinate, selecting one representation (either CART or FRAC) that re...
SymOp sym_op(Index l) const
ReturnArray< Permutation > make_translation_permutations(Index NB) const
void reserve(Index new_max)
Eigen::Matrix< long, 3, 3 > matrix_type
void smith_normal_form(const Eigen::MatrixBase< DerivedIn > &M, Eigen::MatrixBase< DerivedOut > &U, Eigen::MatrixBase< DerivedOut > &S, Eigen::MatrixBase< DerivedOut > &V)
Return the smith normal form, M == U*S*V.
PrimGrid(const Lattice &p_lat, const Lattice &s_lat, Index NB=1)
UnitCellCoord uccoord(Index i) const
Coordinate coord(Index l, CELL_TYPE lat_mode) const
UnitCell unitcell(Index i) const
const Eigen::Matrix3l & matrix() const
Get underlying integer transformation amtrix.
SymGroupRepID add_empty_representation() const
Add a new empty representation.
Index find_cart(const Eigen::Ref< const Eigen::Vector3d > &_cart_coord) const
UnitCellCoord from_canonical(const UnitCellCoord &bmnp) const