1 #ifndef UNITCELLCOORD_HH
2 #define UNITCELLCOORD_HH
39 template <
typename OtherDerived>
40 UnitCell(
const Eigen::MatrixBase<OtherDerived> &integral_coordinate)
59 const Lattice &new_tiling_unit)
const;
62 template <
typename OtherDerived>
64 this->Eigen::Vector3l::operator=(other);
70 const auto &A = *
this;
71 for (
Index i = 0; i < 3; i++) {
86 throw std::runtime_error(
87 "Could not round values to integers within a reasonable tolerance");
96 template <
typename Base>
121 :
public Comparisons<Translatable<CRTPBase<UnitCellCoord>>> {
128 throw std::runtime_error(
129 "Error in UnitCellCoord. Construction requires a positive sublattice "
209 const auto &A = *
this;
210 for (
Index i = 0; i < 3; i++) {
211 if (A.unitcell()(i) < B.
unitcell()(i)) {
214 if (A.unitcell()(i) > B.
unitcell()(i)) {
226 const auto &A = *
this;
227 return A.unitcell()(0) == B.
unitcell()(0) &&
228 A.unitcell()(1) == B.
unitcell()(1) &&
252 struct hash<
CASM::xtal::UnitCell> {
257 struct hash<
CASM::xtal::UnitCellCoord> {
BasicStructure specifies the lattice and atomic basis of a crystal.
Represents cartesian and fractional coordinates.
Site site(const PrimType &prim) const
Get a copy of corresponding site.
UnitCellCoord(Index _sublat, Index i, Index j, Index k)
UnitCellCoord & operator=(const UnitCellCoord &B)=default
UnitCellCoord(UnitCellCoord &&B)=default
UnitCellCoord & operator=(UnitCellCoord &&B)=default
const UnitCell & unitcell() const
UnitCellCoord(const UnitCellCoord &B)=default
const Site & sublattice_site(const PrimType &prim) const
Get reference to corresponding sublattice site in the unit structure.
Coordinate coordinate(const PrimType &prim) const
Get corresponding coordinate.
static UnitCellCoord from_coordinate(const PrimType &, const Coordinate &coord, double tol)
static void _throw_incompatible_primitive_cell()
bool _is_compatible_with_prim(const PrimType &prim) const
UnitCellCoord(Index _sublat, const UnitCell &_unitcell)
bool operator<(const UnitCellCoord &B) const
Compare UnitCellCoord.
Index operator[](Index i) const
bool eq_impl(const UnitCellCoord &B) const
UnitCellCoord & operator+=(UnitCell frac)
static UnitCell from_cartesian(const Eigen::Vector3d &cartesian_coord, const Lattice &tiling_unit)
Coordinate coordinate(const Lattice &tiling_unit) const
UnitCell(Index a, Index b, Index c)
static UnitCell from_coordinate(Coordinate const &lattice_point)
Convert lattice point to a unitcell.
UnitCell reset_tiling_unit(const Lattice ¤t_tiling_unit, const Lattice &new_tiling_unit) const
Finds a new UnitCell with values relative to the given tiling unit.
static void _throw_large_rounding_error()
bool operator<(const UnitCell &B) const
Compare UnitCell.
UnitCell(const Eigen::MatrixBase< OtherDerived > &integral_coordinate)
Construct from integral fractional values, relative to the tiling unit.
UnitCell & operator=(const Eigen::MatrixBase< OtherDerived > &other)
Base class for CRTP pattern.
std::ostream & operator<<(std::ostream &stream, const Site &site)
Coordinate make_superlattice_coordinate(const UnitCell &ijk, const Superlattice &superlattice)
bool valid_index(Index i)
INDEX_TYPE Index
For long integer indexing:
Matrix< long int, 3, 1 > Vector3l
CRTP class to implement '-=', '+', and '-' in terms of '+='.
MostDerived operator+(UnitCell frac) const
MostDerived & operator-=(UnitCell frac)
Base::MostDerived MostDerived
MostDerived operator-(UnitCell frac) const
Implements other comparisons in terms of '<'.