17 Lattice symmetrized_with_fractional(
19 const std::vector<Eigen::Matrix3i> &fractional_point_group) {
20 Eigen::Matrix3d symmetrized_lat_matrix_squared(Eigen::Matrix3d::Zero());
23 for (
const auto &frac_mat : fractional_point_group) {
24 symmetrized_lat_matrix_squared += frac_mat.cast<
double>().transpose() *
25 lattice.lat_column_mat().transpose() *
27 frac_mat.cast<
double>();
29 symmetrized_lat_matrix_squared /= double(fractional_point_group.size());
38 Eigen::JacobiSVD<Eigen::Matrix3d> singular_value_decomposition(
39 symmetrized_lat_matrix_squared,
40 Eigen::ComputeFullU | Eigen::ComputeFullV);
47 symmetrized_lat_matrix_misoriented =
48 singular_value_decomposition.matrixU() *
49 singular_value_decomposition.singularValues().cwiseSqrt().asDiagonal() *
50 singular_value_decomposition.matrixV().transpose();
57 singular_value_decomposition.compute(symmetrized_lat_matrix_misoriented *
65 singular_value_decomposition.matrixV() *
66 singular_value_decomposition.matrixU().transpose() *
67 symmetrized_lat_matrix_misoriented;
69 return Lattice(symmetrized_lat_matrix,
lattice.tol());
89 const Lattice &lat, std::vector<SymOp>
const &super_grp) {
90 std::vector<Index> result;
96 const std::vector<SymOp> &enforced_group) {
97 Eigen::Matrix3i frac_mat;
98 std::vector<Eigen::Matrix3i> fractional_point_group;
99 for (
Index ng = 0; ng < enforced_group.size(); ng++) {
103 fractional_point_group.push_back(frac_mat);
105 return symmetrized_with_fractional(
lattice, fractional_point_group);
118 std::vector<Eigen::Matrix3i> frac_point_group;
119 frac_point_group.reserve(48);
131 frac_point_group.push_back(mat);
137 if (frac_point_group.size() != 48 && frac_point_group.size() != 24) {
138 Eigen::Matrix3i t_op;
139 for (
Index i = 0; i < frac_point_group.size(); ++i) {
140 t_op =
inverse(frac_point_group[i]);
141 if (!
contains(frac_point_group, t_op)) {
142 frac_point_group.push_back(t_op);
144 for (
Index j = i; j < frac_point_group.size(); ++j) {
145 t_op = frac_point_group[i] * frac_point_group[j];
146 if (!
contains(frac_point_group, t_op)) {
147 frac_point_group.push_back(t_op);
154 std::vector<SymOp> result;
155 result.reserve(frac_point_group.size());
157 Lattice symlat = symmetrized_with_fractional(tlat_reduced, frac_point_group);
158 for (Eigen::Matrix3i
const &frac : frac_point_group) {
Checks if operations are point group operations.
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
void set_tol(double _tol)
Lattice reduced_cell() const
Find the lattice vectors which give most compact unit cell Compactness is measured by how close lat_c...
const Eigen::Matrix3d & inv_lat_column_mat() const
Inverse of Lattice::lat_column_mat() It is the transformation matrix 'C2F', such that f = C2F * c whe...
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.
Eigen::CwiseUnaryOp< decltype(Local::iround_l< typename Derived::Scalar >), const Derived > iround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXi.
const std::vector< Eigen::Matrix3i > & unimodular_matrices()
const SymOp::matrix_type & get_matrix(const SymOp &op)
GenericVectorXdScelFormatter lattice()
xtal::Coordinate copy_apply(const xtal::SymOp &op, xtal::Coordinate coord)
Copy and apply SymOp to a Coordinate.
xtal::Coordinate & apply(const xtal::SymOp &op, xtal::Coordinate &coord)
apply SymOp to a Coordinate
BasicStructure symmetrize(const BasicStructure &structure, const std::vector< SymOp > &enforced_group)
std::vector< Index > invariant_subgroup_indices(const Lattice &lat, SymOpVector const &super_grp)
Construct indices of the subgroup that leaves a lattice unchanged.
Eigen::Matrix3d const & get_matrix(MappingNode const &_node)
External accessor for isometry, to provide xtal::SymOp adaptability.
std::vector< SymOp > make_point_group(Lattice const &_lat)
Populate.
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value)
INDEX_TYPE Index
For long integer indexing:
static SymOp point_operation(const SymOpMatrixType &mat)