CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <CompositionConverter.hh>
Convert between number of species per unit cell and parametric composition.
Definition at line 16 of file CompositionConverter.hh.
Public Types | |
typedef unsigned int | size_type |
Public Member Functions | |
CompositionConverter () | |
Default constructor. More... | |
template<typename ComponentIterator , typename... EndMembers> | |
CompositionConverter (ComponentIterator begin, ComponentIterator end, Eigen::VectorXd _origin, EndMembers... _end_members) | |
Construct a CompositionConverter. More... | |
template<typename ComponentIterator > | |
CompositionConverter (ComponentIterator begin, ComponentIterator end, Eigen::VectorXd _origin, Eigen::MatrixXd _end_members) | |
Construct a CompositionConverter. More... | |
size_type | independent_compositions () const |
The dimensionality of the composition space. More... | |
std::vector< std::string > | components () const |
The order of components in mol composition vectors. More... | |
Eigen::VectorXd | origin () const |
The mol composition of the parameteric composition axes origin. More... | |
Eigen::VectorXd | end_member (size_type i) const |
The mol composition of the parameteric composition axes end members. More... | |
Eigen::MatrixXd | dparam_dmol () const |
Return the matrix Mij = dx_i/dn_j. More... | |
Eigen::MatrixXd | dmol_dparam () const |
Return the matrix Mij = dn_i/dx_j. More... | |
Eigen::VectorXd | param_composition (const Eigen::VectorXd &n) const |
Convert number of mol per prim, 'n' to parametric composition 'x'. More... | |
Eigen::VectorXd | dparam_composition (const Eigen::VectorXd &dn) const |
Convert change in number of atoms per prim, 'dn' to change in parametric composition 'dx'. More... | |
Eigen::VectorXd | mol_composition (const Eigen::VectorXd &x) const |
Convert parametric composition, 'x', to number of mol per prim, 'n'. More... | |
Eigen::VectorXd | dmol_composition (const Eigen::VectorXd &dx) const |
Convert change in parametric composition, 'dx', to change in number of mol per prim, 'dn'. More... | |
Eigen::VectorXd | param_chem_pot (const Eigen::VectorXd chem_pot) const |
Convert dG/dn to dG/dx. More... | |
Eigen::VectorXd | chem_pot (const Eigen::VectorXd param_chem_pot) const |
Convert dG/dx to dG/dn. More... | |
std::string | mol_formula () const |
Return formula for x->n. More... | |
std::string | param_formula () const |
Return formula for n->x. More... | |
std::string | origin_formula () const |
Return formula for origin. More... | |
std::string | end_member_formula (size_type i) const |
Return formula for end member. More... | |
std::string | comp_formula (size_type i) const |
Return formula for comp(i) in terms of comp_n(A), comp_n(B), ... More... | |
std::string | comp_n_formula (size_type i) const |
Return formula for comp_n(components()[i]) in terms of comp(a), comp(b), ... More... | |
std::string | param_chem_pot_formula (size_type i) const |
Return formula for param_chem_pot(i) in terms of chem_pot(A), chem_pot(B), ... More... | |
Static Public Member Functions | |
static std::string | comp_var (size_type i) |
Composition variable names: "a", "b", ... More... | |
Private Member Functions | |
void | _add_end_member (Eigen::VectorXd _end_member) |
Helps make variadic template constructor possible. More... | |
template<typename... EndMembers> | |
void | _add_end_member (Eigen::VectorXd _end_member, EndMembers... _others) |
Helps make variadic template constructor possible. More... | |
void | _check_size (const Eigen::MatrixXd &vec) const |
Check that origin and end member vectors have same size as the number of components. More... | |
void | _calc_conversion_matrices () |
Calculate conversion matrices m_to_n and m_to_x. More... | |
std::string | _n_formula (const Eigen::VectorXd &vec) const |
Return formula for 'n'. More... | |
Private Attributes | |
std::vector< std::string > | m_components |
List of all allowed components names in the prim, position in vector is reference for origin and end_members. More... | |
Eigen::VectorXd | m_origin |
Vector, size == m_components.size(), specifying the num_mols_per_prim of each component at the origin in parametric composition space. More... | |
Eigen::MatrixXd | m_end_members |
Column vector matrix, rows == m_components.size(), cols == rank of parametric composition space. More... | |
Eigen::MatrixXd | m_to_n |
Conversion matrix: n = origin + m_to_n*x. More... | |
Eigen::MatrixXd | m_to_x |
Conversion matrix: x = m_to_x*(n - origin) More... | |
typedef unsigned int CASM::CompositionConverter::size_type |
Definition at line 18 of file CompositionConverter.hh.
|
inline |
Default constructor.
Definition at line 21 of file CompositionConverter.hh.
CASM::CompositionConverter::CompositionConverter | ( | ComponentIterator | begin, |
ComponentIterator | end, | ||
Eigen::VectorXd | _origin, | ||
EndMembers... | _end_members | ||
) |
Construct a CompositionConverter.
begin,end | Range of occupant name (std::string) indicating the Molecule type |
_origin | Origin for parametric composition space |
_end_members | 1 or more end members for parameteric composition space axes |
Definition at line 194 of file CompositionConverter.hh.
CASM::CompositionConverter::CompositionConverter | ( | ComponentIterator | begin, |
ComponentIterator | end, | ||
Eigen::VectorXd | _origin, | ||
Eigen::MatrixXd | _end_members | ||
) |
Construct a CompositionConverter.
_prim | A primitive BasicStructure |
_origin | Origin for parametric composition space |
_end_members | Column vector matrix of end members for parameteric composition space axes |
Definition at line 219 of file CompositionConverter.hh.
|
private |
Helps make variadic template constructor possible.
Definition at line 398 of file CompositionConverter.cc.
|
private |
Helps make variadic template constructor possible.
Definition at line 233 of file CompositionConverter.hh.
|
private |
Calculate conversion matrices m_to_n and m_to_x.
Definition at line 421 of file CompositionConverter.cc.
|
private |
Check that origin and end member vectors have same size as the number of components.
Definition at line 412 of file CompositionConverter.cc.
|
private |
Return formula for 'n'.
Definition at line 448 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::chem_pot | ( | const Eigen::VectorXd | param_chem_pot | ) | const |
Convert dG/dx to dG/dn.
std::string CASM::CompositionConverter::comp_formula | ( | size_type | i | ) | const |
Return formula for comp(i) in terms of comp_n(A), comp_n(B), ...
Definition at line 219 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::comp_n_formula | ( | size_type | i | ) | const |
Return formula for comp_n(components()[i]) in terms of comp(a), comp(b), ...
Return formula for comp_n(component(i)) in terms of comp(a), comp(b), ...
Definition at line 278 of file CompositionConverter.cc.
|
static |
Composition variable names: "a", "b", ...
Definition at line 29 of file CompositionConverter.cc.
std::vector< std::string > CASM::CompositionConverter::components | ( | ) | const |
The order of components in mol composition vectors.
Definition at line 34 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::dmol_composition | ( | const Eigen::VectorXd & | dx | ) | const |
Convert change in parametric composition, 'dx', to change in number of mol per prim, 'dn'.
Convert change in parametric composition, 'dx', to change in number of atoms per prim, 'dn'.
Definition at line 91 of file CompositionConverter.cc.
Eigen::MatrixXd CASM::CompositionConverter::dmol_dparam | ( | ) | const |
Return the matrix Mij = dn_i/dx_j.
Definition at line 56 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::dparam_composition | ( | const Eigen::VectorXd & | dn | ) | const |
Convert change in number of atoms per prim, 'dn' to change in parametric composition 'dx'.
dn | mol composition, matches order from components() |
Definition at line 72 of file CompositionConverter.cc.
Eigen::MatrixXd CASM::CompositionConverter::dparam_dmol | ( | ) | const |
Return the matrix Mij = dx_i/dn_j.
Definition at line 53 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::end_member | ( | size_type | i | ) | const |
The mol composition of the parameteric composition axes end members.
Definition at line 48 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::end_member_formula | ( | size_type | i | ) | const |
Return formula for end member.
Definition at line 393 of file CompositionConverter.cc.
CompositionConverter::size_type CASM::CompositionConverter::independent_compositions | ( | ) | const |
The dimensionality of the composition space.
Examples:
Definition at line 23 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::mol_composition | ( | const Eigen::VectorXd & | x | ) | const |
Convert parametric composition, 'x', to number of mol per prim, 'n'.
Convert parametric composition, 'x', to number of atoms per prim, 'n'.
Definition at line 81 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::mol_formula | ( | ) | const |
Return formula for x->n.
Definition at line 104 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::origin | ( | ) | const |
The mol composition of the parameteric composition axes origin.
Definition at line 42 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::origin_formula | ( | ) | const |
Return formula for origin.
Definition at line 388 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::param_chem_pot | ( | const Eigen::VectorXd | chem_pot | ) | const |
Convert dG/dn to dG/dx.
Convert chemical potential, 'chem_pot', to parametric chemical potential, 'param_chem_pot'.
Definition at line 98 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::param_chem_pot_formula | ( | size_type | i | ) | const |
Return formula for param_chem_pot(i) in terms of chem_pot(A), chem_pot(B), ...
Ex: param_chem_pot(a) = c0*chem_pot(A) + c1*chem_pot(B) + ...
Assumes chem_pot(Va) == 0
Definition at line 334 of file CompositionConverter.cc.
Eigen::VectorXd CASM::CompositionConverter::param_composition | ( | const Eigen::VectorXd & | n | ) | const |
Convert number of mol per prim, 'n' to parametric composition 'x'.
Convert number of atoms per prim, 'n' to parametric composition 'x'.
n | mol composition, matches order from components() |
Definition at line 62 of file CompositionConverter.cc.
std::string CASM::CompositionConverter::param_formula | ( | ) | const |
Return formula for n->x.
Definition at line 152 of file CompositionConverter.cc.
|
private |
List of all allowed components names in the prim, position in vector is reference for origin and end_members.
Definition at line 118 of file CompositionConverter.hh.
|
private |
Column vector matrix, rows == m_components.size(), cols == rank of parametric composition space.
Definition at line 129 of file CompositionConverter.hh.
|
private |
Vector, size == m_components.size(), specifying the num_mols_per_prim of each component at the origin in parametric composition space.
Definition at line 123 of file CompositionConverter.hh.
|
private |
Conversion matrix: n = origin + m_to_n*x.
Definition at line 133 of file CompositionConverter.hh.
|
private |
Conversion matrix: x = m_to_x*(n - origin)
Definition at line 137 of file CompositionConverter.hh.