diff --git a/CHANGELOG.md b/CHANGELOG.md index c34dafe..6532aee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,11 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `IntegralSiteCoordinateRep.copy`, `IntegralSiteCoordinateRep.__copy__`, `IntegralSiteCoordinateRep.__deepcopy__`, and `IntegralSiteCoordinateRep.__repr__` - Added usage documentation for Structure manipulation and input / output - ### Changed - Changed `IntegralSiteCoordinate.__str__` to `IntegralSiteCoordinate.__repr__` and changed the output from "b, i j k" to "[b, i, j, k]" - +- Changed `xtal::make_point_group` to remove the `symmetrized_with_fractional` step. +- Changed construction of factor group translations to set components very close to zero (absolute value less than tol * 1e-5) to exactly zero. ### Fixed diff --git a/include/casm/crystallography/SymType.hh b/include/casm/crystallography/SymType.hh index e3ba3e0..ad22887 100644 --- a/include/casm/crystallography/SymType.hh +++ b/include/casm/crystallography/SymType.hh @@ -18,7 +18,7 @@ typedef bool SymOpTimeReversalType; /// Within the scope of crystallography, this struct will serve as the symmetry /// object, which holds a transformation matrix, translation vector, and time -/// reversal boolean, whithout any other overhead. +/// reversal boolean, without any other overhead. struct SymOp { SymOp(const SymOpMatrixType &mat, const SymOpTranslationType &translation, SymOpTimeReversalType time_reversal) diff --git a/src/casm/crystallography/BasicStructureTools.cc b/src/casm/crystallography/BasicStructureTools.cc index 3bc6d1a..252b500 100644 --- a/src/casm/crystallography/BasicStructureTools.cc +++ b/src/casm/crystallography/BasicStructureTools.cc @@ -162,6 +162,18 @@ xtal::SymOpVector make_factor_group_from_point_group( // correct this. translation -= drift; + // If components of the translation are very close to zero, + // just set them to zero + { + Eigen::VectorXd translation_cart = translation.const_cart(); + for (int i = 0; i < 3; ++i) { + if (CASM::almost_zero(translation_cart[i], tol * 1e-5)) { + translation_cart[i] = 0.0; + } + } + translation.cart() = translation_cart; + } + // Now that the translation has been adjusted, create the symmetry // operation and add it if we don't have an equivalent one already xtal::SymOp translation_operation = diff --git a/src/casm/crystallography/SymTools.cc b/src/casm/crystallography/SymTools.cc index 7103e59..7aefe96 100644 --- a/src/casm/crystallography/SymTools.cc +++ b/src/casm/crystallography/SymTools.cc @@ -154,11 +154,9 @@ std::vector make_point_group(Lattice const &_lat, double tol) { std::vector result; result.reserve(frac_point_group.size()); Eigen::Matrix3d t_cart, t_diff; - Lattice symlat = symmetrized_with_fractional(tlat_reduced, frac_point_group); for (Eigen::Matrix3i const &frac : frac_point_group) { - t_cart = symlat.lat_column_mat() * frac.cast() * - symlat.inv_lat_column_mat(); - t_diff = t_cart * _lat.lat_column_mat() - _lat.lat_column_mat(); + t_cart = tlat_reduced.lat_column_mat() * frac.cast() * + tlat_reduced.inv_lat_column_mat(); result.push_back(SymOp::point_operation(t_cart)); } return result;