15 Eigen::Vector3d round_error =
16 lattice_point.
const_frac() - rounded_lattice_point.cast<
double>();
27 std::cerr << round_error << std::endl;
31 return UnitCell(rounded_lattice_point);
46 const Lattice &new_tiling_unit)
const {
47 auto as_coord = this->
coordinate(current_tiling_unit);
48 as_coord.set_lattice(new_tiling_unit,
CART);
60 for (
Index b = 0; b < prim.
basis().size(); ++b) {
68 throw std::runtime_error(
69 "Error constructing UnitCellCoord. No basis site could be found within "
70 "the given tolerance.");
83 throw std::runtime_error(
84 "Error in UnitCellCoord. Sublattice index out of range.");
124 std::size_t seed = value.size();
125 for (
int i = 0; i < 3; ++i) {
126 seed ^= value(i) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
135 seed ^= value.
sublattice() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
BasicStructure specifies the lattice and atomic basis of a crystal.
const Lattice & lattice() const
const std::vector< Site > & basis() const
Represents cartesian and fractional coordinates.
Coordinate_impl::CartCoordinate cart()
Set Cartesian coordinate vector and update fractional coordinate vector.
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...
const Lattice & lattice() const
Access the home lattice of the coordinate.
const vector_type & const_frac() const
user override to force const Access the fractional coordinate vector
double min_dist(const Coordinate &neighbor) const
Returns distance (in Angstr) to nearest periodic image of neighbor.
const Lattice & prim_lattice() const
const Lattice & superlattice() const
Site site(const PrimType &prim) const
Get a copy of corresponding site.
const UnitCell & unitcell() const
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
static UnitCell from_cartesian(const Eigen::Vector3d &cartesian_coord, const Lattice &tiling_unit)
Coordinate coordinate(const Lattice &tiling_unit) const
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()
Eigen::CwiseUnaryOp< decltype(Local::lround_l< typename Derived::Scalar >), const Derived > lround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXl.
Coordinate make_superlattice_coordinate(const UnitCell &ijk, const Superlattice &superlattice)
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
INDEX_TYPE Index
For long integer indexing:
Matrix< long int, 3, 1 > Vector3l
std::size_t operator()(const CASM::xtal::UnitCell &value) const
std::size_t operator()(const CASM::xtal::UnitCellCoord &value) const