CASM
AClustersApproachtoStatisticalMechanics
|
#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 (const vector_type &_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... | |
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, double tol) const |
bool | compare (const Coordinate &RHS, double tol=TOL) const |
Returns true if this->min_dist(RHS)<tol. More... | |
bool | compare (const Coordinate &RHS, Coordinate &translation, double tol=TOL) 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 |
Checks to see if coordinate is at a lattice translation with respect to the origin. More... | |
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... | |
void | set_basis_ind (Index _basis_ind) |
Set basis Index. More... | |
Index | basis_ind () const |
Access basis Index. More... | |
const Lattice & | home () 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, int prec=7, int pad=5) const |
void | print (std::ostream &stream, char term=0, int prec=7, int pad=5) const |
void | print_axis (std::ostream &stream, COORD_TYPE mode, char term=0, int prec=7, int pad=5) 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... | |
double | min_dist (const Coordinate &neighbor, Coordinate &translation) const |
Returns distance (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 | robust_min_dist (const Coordinate &neighbor, Coordinate &translation) 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 |
Finds same shift as min_dist but returns shift(CART).transpose()*metric*shift(CART) More... | |
Coordinate & | apply_sym (const SymOp &op) |
Transform coordinate by symmetry operation (including translation) More... | |
Coordinate & | apply_sym_no_trans (const SymOp &op) |
Transform coordinate by symmetry operation (without translation) More... | |
jsonParser & | to_json (jsonParser &json) const |
void | from_json (const jsonParser &json) |
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 |
Index | m_basis_ind |
typedef vector_type::Index CASM::Coordinate::size_type |
Definition at line 37 of file Coordinate.hh.
typedef Eigen::Vector3d CASM::Coordinate::vector_type |
Definition at line 36 of file Coordinate.hh.
|
inlineexplicit |
Minimal constructor only takes a lattice.
Definition at line 46 of file Coordinate.hh.
CASM::Coordinate::Coordinate | ( | const vector_type & | _vec, |
const Lattice & | _home, | ||
COORD_TYPE | _mode | ||
) |
Definition at line 10 of file Coordinate.cc.
CASM::Coordinate::Coordinate | ( | double | _x, |
double | _y, | ||
double | _z, | ||
const Lattice & | _home, | ||
COORD_TYPE | _mode | ||
) |
Definition at line 23 of file Coordinate.cc.
|
inlineprivate |
Definition at line 272 of file Coordinate.hh.
|
inlineprivate |
Definition at line 278 of file Coordinate.hh.
|
inlineprivate |
Definition at line 260 of file Coordinate.hh.
|
inlineprivate |
Definition at line 266 of file Coordinate.hh.
|
inlineprivate |
Definition at line 250 of file Coordinate.hh.
|
inlineprivate |
Definition at line 255 of file Coordinate.hh.
bool CASM::Coordinate::almost_equal | ( | const Coordinate & | RHS, |
double | tol | ||
) | const |
Definition at line 66 of file Coordinate.cc.
Coordinate & CASM::Coordinate::apply_sym | ( | const SymOp & | op | ) |
Transform coordinate by symmetry operation (including translation)
Definition at line 216 of file Coordinate.cc.
Coordinate & CASM::Coordinate::apply_sym_no_trans | ( | const SymOp & | op | ) |
Transform coordinate by symmetry operation (without translation)
Definition at line 226 of file Coordinate.cc.
|
inline |
Access basis Index.
Definition at line 190 of file Coordinate.hh.
|
inline |
Set Cartesian coordinate vector and update fractional coordinate vector.
Definition at line 593 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 599 of file Coordinate.hh.
|
inline |
const Access a component of the Cartesian coordinate vector
Definition at line 100 of file Coordinate.hh.
bool CASM::Coordinate::compare | ( | const Coordinate & | RHS, |
double | tol = TOL |
||
) | const |
Returns true if this->min_dist(RHS)<tol.
Definition at line 73 of file Coordinate.cc.
bool CASM::Coordinate::compare | ( | const Coordinate & | RHS, |
Coordinate & | translation, | ||
double | tol = TOL |
||
) | const |
Returns true if this->min_dist(RHS)<tol if true, calculates
translation | such that *this = (RHS+translation) |
Definition at line 80 of file Coordinate.cc.
bool CASM::Coordinate::compare_type | ( | const Coordinate & | RHS | ) | const |
Return true – Exists to allow duck-typing with Site.
Definition at line 86 of file Coordinate.cc.
|
inline |
user override to force const Access the Cartesian coordinate vector
Definition at line 92 of file Coordinate.hh.
|
inline |
const Access a component of the Cartesian coordinate vector
Definition at line 105 of file Coordinate.hh.
|
inline |
user override to force const Access the fractional coordinate vector
Definition at line 66 of file Coordinate.hh.
|
inline |
user override to force const Access the fractional coordinate vector
Definition at line 79 of file Coordinate.hh.
double CASM::Coordinate::dist | ( | const Coordinate & | neighbor | ) | const |
distance (in Angstr) of neighbor from *this
Definition at line 146 of file Coordinate.cc.
|
inline |
Set the fractional coordinate vector.
Definition at line 581 of file Coordinate.hh.
|
inline |
const Access the fractional coordinate vector
Definition at line 61 of file Coordinate.hh.
|
inline |
Set a component of the fractional coordinate vector.
Definition at line 587 of file Coordinate.hh.
|
inline |
const Access a component of the fractional coordinate vector
Definition at line 74 of file Coordinate.hh.
void CASM::Coordinate::from_json | ( | const jsonParser & | json | ) |
Definition at line 398 of file Coordinate.cc.
|
inline |
Access the home lattice of the coordinate.
Definition at line 195 of file Coordinate.hh.
bool CASM::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 367 of file Coordinate.cc.
bool CASM::Coordinate::is_within | ( | ) | const |
Checks to see if coordinate is in the unit cell, but does not translate it.
Definition at line 301 of file Coordinate.cc.
double CASM::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 155 of file Coordinate.cc.
double CASM::Coordinate::min_dist | ( | const Coordinate & | neighbor, |
Coordinate & | translation | ||
) | const |
Returns distance (in Angstr) to nearest periodic image of neighbor.
This version calculates the translation such that (neighbor+translation) is the periodic nearest period image of neighbor
Definition at line 169 of file Coordinate.cc.
double CASM::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 205 of file Coordinate.cc.
|
inline |
Definition at line 120 of file Coordinate.hh.
Coordinate & CASM::Coordinate::operator+= | ( | const Coordinate & | RHS | ) |
Positive translation of this coordinate by RHS.cart()
Definition at line 38 of file Coordinate.cc.
Coordinate CASM::Coordinate::operator- | ( | ) | const |
unary minus of this coordinate
Definition at line 53 of file Coordinate.cc.
Coordinate & CASM::Coordinate::operator-= | ( | const Coordinate & | RHS | ) |
Negative translation of this coordinate by RHS.cart()
Definition at line 45 of file Coordinate.cc.
bool CASM::Coordinate::operator== | ( | const Coordinate & | RHS | ) | const |
Definition at line 59 of file Coordinate.cc.
void CASM::Coordinate::print | ( | std::ostream & | stream, |
COORD_TYPE | mode, | ||
char | term = 0 , |
||
int | prec = 7 , |
||
int | pad = 5 |
||
) | const |
Definition at line 112 of file Coordinate.cc.
void CASM::Coordinate::print | ( | std::ostream & | stream, |
char | term = 0 , |
||
int | prec = 7 , |
||
int | pad = 5 |
||
) | const |
Definition at line 107 of file Coordinate.cc.
void CASM::Coordinate::print_axis | ( | std::ostream & | stream, |
COORD_TYPE | mode, | ||
char | term = 0 , |
||
int | prec = 7 , |
||
int | pad = 5 |
||
) | const |
Print normalized vector.
Definition at line 129 of file Coordinate.cc.
void CASM::Coordinate::read | ( | std::istream & | stream, |
COORD_TYPE | mode | ||
) |
Definition at line 92 of file Coordinate.cc.
double CASM::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 179 of file Coordinate.cc.
double CASM::Coordinate::robust_min_dist | ( | const Coordinate & | neighbor, |
Coordinate & | translation | ||
) | const |
Returns distance (in Angstr) to nearest periodic image of neighbor.
This version calculates the translation such that (neighbor+translation) is the periodic nearest period 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 190 of file Coordinate.cc.
|
inline |
Set basis Index.
Definition at line 185 of file Coordinate.hh.
void CASM::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 245 of file Coordinate.cc.
jsonParser & CASM::Coordinate::to_json | ( | jsonParser & | json | ) | const |
Definition at line 383 of file Coordinate.cc.
int CASM::Coordinate::voronoi_number | ( | ) | const |
Number of periodic images of this coordinate that are on voronoi cell boundary of its home lattice
Definition at line 317 of file Coordinate.cc.
int CASM::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 325 of file Coordinate.cc.
bool CASM::Coordinate::voronoi_within | ( | ) |
Map coordinate into the voronoi cell using a lattice translation.
Definition at line 333 of file Coordinate.cc.
bool CASM::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 348 of file Coordinate.cc.
bool CASM::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 261 of file Coordinate.cc.
bool CASM::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 280 of file Coordinate.cc.
|
private |
Definition at line 292 of file Coordinate.hh.
|
private |
Definition at line 290 of file Coordinate.hh.
|
private |
Definition at line 290 of file Coordinate.hh.
|
private |
Definition at line 288 of file Coordinate.hh.