97 else if(mode ==
CART) {
114 stream.precision(prec);
115 stream.width(prec + pad);
116 stream.flags(std::ios::showpoint | std::ios::fixed | std::ios::right);
120 else if(mode ==
FRAC)
122 if(term) stream << term;
131 stream.precision(prec);
132 stream.width(prec + pad);
133 stream.flags(std::ios::showpoint | std::ios::fixed | std::ios::right);
136 stream <<
const_cart().normalized().transpose();
137 else if(mode ==
FRAC)
138 stream <<
const_frac().normalized().transpose();
139 if(term) stream << term;
157 tfrac -=
lround(tfrac).cast<
double>();
170 translation = (*this) - neighbor;
191 double fast_result =
min_dist(neighbor, translation);
193 if(fast_result < (
home().inner_voronoi_radius() +
TOL))
207 tfrac -=
lround(tfrac).cast<
double>();
248 if(invariant_mode ==
CART)
250 else if(invariant_mode ==
FRAC)
264 bool was_within =
true;
266 for(
int i = 0; i < 3; i++) {
284 bool was_within =
true;
286 for(
int i = 0; i < 3; i++) {
295 (*this) += translation;
304 for(
int i = 0; i < 3; i++) {
306 if(std::abs(tshift) >
TOL) {
334 bool was_within(
true);
335 Eigen::Vector3d lattice_trans;
336 while(
home().max_voronoi_measure(
cart(), lattice_trans) > (1. +
TOL)) {
338 cart() -= lattice_trans;
350 translation.
cart() = vector_type::Zero();
352 Eigen::Vector3d lattice_trans;
353 bool was_within(
true);
354 while(
home().max_voronoi_measure(
cart(), lattice_trans) > (1. +
TOL)) {
356 cart() -= lattice_trans;
357 translation.
cart() -= lattice_trans;
402 m_frac_coord[2] = json[
"FRAC"][2].
get<
double>();
405 m_cart_coord[1] = json[
"CART"][1].
get<
double>();
406 m_cart_coord[2] = json[
"CART"][2].
get<
double>();
Coordinate & operator-=(const Coordinate &RHS)
Negative translation of this coordinate by RHS.cart()
Eigen::MatrixXd pad(const Eigen::MatrixXd &M, int n)
Construct a matrix consisting of blocks M and Identity(n,n)
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
jsonParser & to_json(jsonParser &json) const
bool voronoi_within()
Map coordinate into the voronoi cell using a lattice translation.
void from_json(ClexDescription &desc, const jsonParser &json)
Coordinate_impl::CartCoordinate cart()
Set Cartesian coordinate vector and update fractional coordinate vector.
bool is_lattice_shift(double tol=TOL) const
Checks to see if coordinate is at a lattice translation with respect to the origin.
Coordinate operator-() const
unary minus of this coordinate
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
double dist(const Coordinate &neighbor) const
distance (in Angstr) of neighbor from *this
Coordinate & apply_sym(const SymOp &op)
Transform coordinate by symmetry operation (including translation)
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
void from_json(const jsonParser &json)
const vector_type & const_cart() const
user override to force const Access the Cartesian coordinate vector
T get(Args...args) const
Get data from json, using one of several alternatives.
const vector_type & const_frac() const
user override to force const Access the fractional coordinate vector
int voronoi_number() const
const matrix_type & matrix() const
Const access of entire cartesian symmetry matrix.
bool operator==(const Coordinate &RHS) const
double min_dist(const Coordinate &neighbor) const
Returns distance (in Angstr) to nearest periodic image of neighbor.
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
void _set_frac(const Eigen::Ref< const vector_type > &f)
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
BasisSet operator*(const SymOp &LHS, const BasisSet &RHS)
Represents cartesian and fractional coordinates.
Coordinate & apply_sym_no_trans(const SymOp &op)
Transform coordinate by symmetry operation (without translation)
T norm(const Tensor< T > &ttens)
void print(std::ostream &stream, COORD_TYPE mode, char term=0, int prec=7, int pad=5) const
Eigen::Vector3d vector_type
Coordinate & operator+=(const Coordinate &RHS)
Positive translation of this coordinate by RHS.cart()
double robust_min_dist(const Coordinate &neighbor) const
Returns distance (in Angstr) to nearest periodic image of neighbor.
Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::lround< typename Derived::Scalar >)), const Derived > lround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXl.
bool is_within() const
Checks to see if coordinate is in the unit cell, but does not translate it.
void read(std::istream &stream, COORD_TYPE mode)
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...
T dot(const Tensor< T > &LHS, const Tensor< T > &RHS)
void _set_cart(const Eigen::Ref< const vector_type > &c)
CASM::jsonParser & to_json_array(const Eigen::MatrixBase< Derived > &value, CASM::jsonParser &json)
Write Eigen Matrix with 1 row or 1 column to JSON array.
bool compare_type(const Coordinate &RHS) const
Return true – Exists to allow duck-typing with Site.
bool compare(const Coordinate &RHS, double tol=TOL) const
Returns true if this->min_dist(RHS)
jsonParser & put_obj()
Puts new empty JSON object.
Index basis_ind() const
Access basis Index.
bool almost_equal(const Coordinate &RHS, double tol) const
Coordinate_impl::FracCoordinate frac()
Set the fractional coordinate vector.
const vector_type & tau() const
Const access of the cartesian translation vector, 'tau'.
void print_axis(std::ostream &stream, COORD_TYPE mode, char term=0, int prec=7, int pad=5) const
Print normalized vector.
const Lattice & home() const
Access the home lattice of the coordinate.
double min_dist2(const Coordinate &neighbor, const Eigen::Ref< const Eigen::Matrix3d > &metric) const
Finds same shift as min_dist but returns shift(CART).transpose()*metric*shift(CART) ...
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)
int voronoi_number(const Eigen::Vector3d &pos) const
Coordinate(const Lattice &_home)
Minimal constructor only takes a lattice.
static COORD_TYPE CHECK()
get the current mode (call using COORD_MODE::CHECK())