CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <Coordinate.hh>
Represents cartesian and fractional coordinates.
Definition at line 34 of file Coordinate.hh.
Public Types | |
typedef Eigen::Vector3d | vector_type |
typedef vector_type::Index | size_type |
Public Member Functions | |
Coordinate (const Lattice &_home) | |
Minimal constructor only takes a lattice. More... | |
Coordinate (Eigen::Ref< const vector_type > const &_vec, const Lattice &_home, COORD_TYPE _mode) | |
Coordinate (double _x, double _y, double _z, const Lattice &_home, COORD_TYPE _mode) | |
Coordinate_impl::FracCoordinate | frac () |
Set the fractional coordinate vector. More... | |
const vector_type & | frac () const |
const Access the fractional coordinate vector More... | |
const vector_type & | const_frac () const |
user override to force const Access the fractional coordinate vector More... | |
Coordinate_impl::FracCoordinateComponent | frac (size_type index) |
Set a component of the fractional coordinate vector. More... | |
const double & | frac (size_type index) const |
const Access a component of the fractional coordinate vector More... | |
const double & | const_frac (size_type index) const |
user override to force const Access the fractional coordinate vector More... | |
Coordinate_impl::CartCoordinate | cart () |
Set Cartesian coordinate vector and update fractional coordinate vector. More... | |
const vector_type & | cart () const |
const Access the Cartesian coordinate vector More... | |
const vector_type & | const_cart () const |
user override to force const Access the Cartesian coordinate vector More... | |
Coordinate_impl::CartCoordinateComponent | cart (size_type index) |
Set a component of the Cartesian coordinate vector. More... | |
const double & | cart (size_type index) const |
const Access a component of the Cartesian coordinate vector More... | |
const double & | const_cart (size_type index) const |
const Access a component of the Cartesian coordinate vector More... | |
vector_type | as_vec (COORD_TYPE _mode) const |
Coordinate & | operator+= (const Coordinate &RHS) |
Positive translation of this coordinate by RHS.cart() More... | |
Coordinate & | operator-= (const Coordinate &RHS) |
Negative translation of this coordinate by RHS.cart() More... | |
Coordinate | operator- () const |
unary minus of this coordinate More... | |
bool | operator== (const Coordinate &RHS) const |
bool | operator!= (const Coordinate &RHS) const |
bool | almost_equal (const Coordinate &RHS) const |
bool | compare (const Coordinate &RHS) const |
Returns true if this->min_dist(RHS)<this->lattice().tol() More... | |
bool | compare (const Coordinate &RHS, Coordinate &translation) const |
bool | compare_type (const Coordinate &RHS) const |
Return true – Exists to allow duck-typing with Site. More... | |
bool | within () |
bool | within (Coordinate &translation) |
bool | is_within () const |
Checks to see if coordinate is in the unit cell, but does not translate it. More... | |
int | voronoi_number () const |
int | voronoi_number (const Lattice &cell) const |
bool | voronoi_within () |
Map coordinate into the voronoi cell using a lattice translation. More... | |
bool | voronoi_within (Coordinate &translation) |
bool | is_lattice_shift (double tol=TOL) const |
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 remains invariant. More... | |
const Lattice & | home () const |
Access the home lattice of the coordinate. More... | |
const Lattice & | lattice () const |
Access the home lattice of the coordinate. More... | |
void | read (std::istream &stream, COORD_TYPE mode) |
void | print (std::ostream &stream, COORD_TYPE mode, char term=0, Eigen::IOFormat format=Eigen::IOFormat(7, 12)) const |
void | print (std::ostream &stream, char term=0, Eigen::IOFormat format=Eigen::IOFormat(7, 12)) const |
void | print_axis (std::ostream &stream, COORD_TYPE mode, char term=0, Eigen::IOFormat format=Eigen::IOFormat(7, 12)) const |
Print normalized vector. More... | |
double | dist (const Coordinate &neighbor) const |
distance (in Angstr) of neighbor from *this More... | |
double | min_dist (const Coordinate &neighbor) const |
Returns distance (in Angstr) to nearest periodic image of neighbor. More... | |
Coordinate | min_translation (const Coordinate &neighbor) const |
Returns translation coordinate (in Angstr) to nearest periodic image of neighbor. More... | |
double | robust_min_dist (const Coordinate &neighbor) const |
Returns distance (in Angstr) to nearest periodic image of neighbor. More... | |
double | min_dist2 (const Coordinate &neighbor, const Eigen::Ref< const Eigen::Matrix3d > &metric) const |
Static Public Member Functions | |
static Coordinate | origin (const Lattice &_home) |
construct a coordinate describing origin of _home lattice More... | |
Private Member Functions | |
void | _update_cart () |
void | _update_frac () |
void | _set_frac (const Eigen::Ref< const vector_type > &f) |
void | _set_frac (size_type ind, double val) |
void | _set_cart (const Eigen::Ref< const vector_type > &c) |
void | _set_cart (size_type ind, double val) |
Private Attributes | |
Lattice const * | m_home |
vector_type | m_frac_coord |
vector_type | m_cart_coord |
typedef vector_type::Index CASM::xtal::Coordinate::size_type |
Definition at line 37 of file Coordinate.hh.
typedef Eigen::Vector3d CASM::xtal::Coordinate::vector_type |
Definition at line 36 of file Coordinate.hh.
|
inlineexplicit |
Minimal constructor only takes a lattice.
Definition at line 47 of file Coordinate.hh.
CASM::xtal::Coordinate::Coordinate | ( | Eigen::Ref< const vector_type > const & | _vec, |
const Lattice & | _home, | ||
COORD_TYPE | _mode | ||
) |
CASM::xtal::Coordinate::Coordinate | ( | double | _x, |
double | _y, | ||
double | _z, | ||
const Lattice & | _home, | ||
COORD_TYPE | _mode | ||
) |
Definition at line 21 of file Coordinate.cc.
|
inlineprivate |
Definition at line 264 of file Coordinate.hh.
|
inlineprivate |
Definition at line 269 of file Coordinate.hh.
|
inlineprivate |
Definition at line 254 of file Coordinate.hh.
|
inlineprivate |
Definition at line 259 of file Coordinate.hh.
|
inlineprivate |
Definition at line 247 of file Coordinate.hh.
|
inlineprivate |
Definition at line 249 of file Coordinate.hh.
bool CASM::xtal::Coordinate::almost_equal | ( | const Coordinate & | RHS | ) | const |
Definition at line 66 of file Coordinate.cc.
|
inline |
Definition at line 103 of file Coordinate.hh.
|
inline |
Set Cartesian coordinate vector and update fractional coordinate vector.
Definition at line 562 of file Coordinate.hh.
|
inline |
const Access the Cartesian coordinate vector
Definition at line 87 of file Coordinate.hh.
|
inline |
Set a component of the Cartesian coordinate vector.
Definition at line 567 of file Coordinate.hh.
|
inline |
const Access a component of the Cartesian coordinate vector
Definition at line 96 of file Coordinate.hh.
bool CASM::xtal::Coordinate::compare | ( | const Coordinate & | RHS | ) | const |
Returns true if this->min_dist(RHS)<this->lattice().tol()
Definition at line 72 of file Coordinate.cc.
bool CASM::xtal::Coordinate::compare | ( | const Coordinate & | RHS, |
Coordinate & | translation | ||
) | const |
Returns true if this->min_dist(RHS)<this->lattice().tol() if true, calculates
translation | such that *this = (RHS+translation) |
Definition at line 78 of file Coordinate.cc.
bool CASM::xtal::Coordinate::compare_type | ( | const Coordinate & | RHS | ) | const |
Return true – Exists to allow duck-typing with Site.
Definition at line 84 of file Coordinate.cc.
|
inline |
user override to force const Access the Cartesian coordinate vector
Definition at line 90 of file Coordinate.hh.
|
inline |
const Access a component of the Cartesian coordinate vector
Definition at line 99 of file Coordinate.hh.
|
inline |
user override to force const Access the fractional coordinate vector
Definition at line 68 of file Coordinate.hh.
|
inline |
user override to force const Access the fractional coordinate vector
Definition at line 78 of file Coordinate.hh.
double CASM::xtal::Coordinate::dist | ( | const Coordinate & | neighbor | ) | const |
distance (in Angstr) of neighbor from *this
Definition at line 148 of file Coordinate.cc.
|
inline |
Set the fractional coordinate vector.
Definition at line 550 of file Coordinate.hh.
|
inline |
const Access the fractional coordinate vector
Definition at line 64 of file Coordinate.hh.
|
inline |
Set a component of the fractional coordinate vector.
Definition at line 555 of file Coordinate.hh.
|
inline |
const Access a component of the fractional coordinate vector
Definition at line 74 of file Coordinate.hh.
|
inline |
Access the home lattice of the coordinate.
Definition at line 200 of file Coordinate.hh.
bool CASM::xtal::Coordinate::is_lattice_shift | ( | double | tol = TOL | ) | const |
Checks to see if coordinate is at a lattice translation with respect to the origin
Definition at line 311 of file Coordinate.cc.
bool CASM::xtal::Coordinate::is_within | ( | ) | const |
Checks to see if coordinate is in the unit cell, but does not translate it.
Definition at line 244 of file Coordinate.cc.
|
inline |
Access the home lattice of the coordinate.
Definition at line 206 of file Coordinate.hh.
double CASM::xtal::Coordinate::min_dist | ( | const Coordinate & | neighbor | ) | const |
Returns distance (in Angstr) to nearest periodic image of neighbor.
Is unsafe if min_dist is comparable to half a lattice vector in length
Definition at line 152 of file Coordinate.cc.
double CASM::xtal::Coordinate::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)
Definition at line 178 of file Coordinate.cc.
Coordinate CASM::xtal::Coordinate::min_translation | ( | const Coordinate & | neighbor | ) | const |
Returns translation coordinate (in Angstr) to nearest periodic image of neighbor.
This version calculates the translation such that (neighbor+translation) is the nearest periodic image of neighbor
Definition at line 156 of file Coordinate.cc.
|
inline |
Definition at line 125 of file Coordinate.hh.
Coordinate & CASM::xtal::Coordinate::operator+= | ( | const Coordinate & | RHS | ) |
Positive translation of this coordinate by RHS.cart()
Definition at line 37 of file Coordinate.cc.
Coordinate CASM::xtal::Coordinate::operator- | ( | ) | const |
unary minus of this coordinate
Definition at line 54 of file Coordinate.cc.
Coordinate & CASM::xtal::Coordinate::operator-= | ( | const Coordinate & | RHS | ) |
Negative translation of this coordinate by RHS.cart()
Definition at line 44 of file Coordinate.cc.
bool CASM::xtal::Coordinate::operator== | ( | const Coordinate & | RHS | ) | const |
Definition at line 60 of file Coordinate.cc.
void CASM::xtal::Coordinate::print | ( | std::ostream & | stream, |
char | term = 0 , |
||
Eigen::IOFormat | format = Eigen::IOFormat(7, 12) |
||
) | const |
Definition at line 102 of file Coordinate.cc.
void CASM::xtal::Coordinate::print | ( | std::ostream & | stream, |
COORD_TYPE | mode, | ||
char | term = 0 , |
||
Eigen::IOFormat | format = Eigen::IOFormat(7, 12) |
||
) | const |
Definition at line 121 of file Coordinate.cc.
void CASM::xtal::Coordinate::print_axis | ( | std::ostream & | stream, |
COORD_TYPE | mode, | ||
char | term = 0 , |
||
Eigen::IOFormat | format = Eigen::IOFormat(7, 12) |
||
) | const |
Print normalized vector.
Definition at line 135 of file Coordinate.cc.
void CASM::xtal::Coordinate::read | ( | std::istream & | stream, |
COORD_TYPE | mode | ||
) |
Definition at line 88 of file Coordinate.cc.
double CASM::xtal::Coordinate::robust_min_dist | ( | const Coordinate & | neighbor | ) | const |
Returns distance (in Angstr) to nearest periodic image of neighbor.
It is safe in all cases, because it uses the lattice Wigner-Seitz cell to determine the nearest image, but this makes it slower than min_dist
Definition at line 168 of file Coordinate.cc.
void CASM::xtal::Coordinate::set_lattice | ( | const Lattice & | new_lat, |
COORD_TYPE | mode | ||
) |
Change the home lattice of the coordinate, selecting one representation (either CART or FRAC) that remains invariant.
invariant_mode | invariant_mode == CART: Cartesian coordinates stay the same, and fractional coordinates are updated Ex: (my_coord.set_lattice(superlattice, CART); // this is how superlattices get filled. invariant_mode == FRAC: Fractional coordinates stay the same, and Cartesian coordinates are updated Ex: you can apply a strain by changing the lattice and keepin FRAC invariant (my_coord.set_lattice(strained_lattice, FRAC); Ex: you can apply a rotation by changing the lattice and keeping FRAC invariant (my_coord.set_lattice(rotated_lattice, FRAC); |
Definition at line 190 of file Coordinate.cc.
int CASM::xtal::Coordinate::voronoi_number | ( | ) | const |
Number of periodic images of this coordinate that are on voronoi cell boundary of its home lattice
Definition at line 259 of file Coordinate.cc.
int CASM::xtal::Coordinate::voronoi_number | ( | const Lattice & | cell | ) | const |
Number of periodic images of this coordinate that are on voronoi cell boundary of 'cell'
Definition at line 265 of file Coordinate.cc.
bool CASM::xtal::Coordinate::voronoi_within | ( | ) |
Map coordinate into the voronoi cell using a lattice translation.
Definition at line 274 of file Coordinate.cc.
bool CASM::xtal::Coordinate::voronoi_within | ( | Coordinate & | translation | ) |
Same as voronoi_within(), but lattice translation is stored in Coordinate translation such that coord_after = coord_before + translation returns true if *this was already within the voronoi cell
Definition at line 290 of file Coordinate.cc.
bool CASM::xtal::Coordinate::within | ( | ) |
Map coordinate into the unit cell using a lattice translation returns true if *this was already within the unit cell
Definition at line 205 of file Coordinate.cc.
bool CASM::xtal::Coordinate::within | ( | Coordinate & | translation | ) |
Same as within(), but lattice translation is stored in Coordinate translation, such that coord_after = coord_before + translation returns true if *this was already within the unit cell
Definition at line 223 of file Coordinate.cc.
|
private |
Definition at line 281 of file Coordinate.hh.
|
private |
Definition at line 281 of file Coordinate.hh.
|
private |
Definition at line 279 of file Coordinate.hh.