CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::CompositionConverter Class Reference

#include <CompositionConverter.hh>

Detailed Description

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...
 

Member Typedef Documentation

◆ size_type

Definition at line 18 of file CompositionConverter.hh.

Constructor & Destructor Documentation

◆ CompositionConverter() [1/3]

CASM::CompositionConverter::CompositionConverter ( )
inline

Default constructor.

Definition at line 21 of file CompositionConverter.hh.

◆ CompositionConverter() [2/3]

template<typename ComponentIterator , typename... EndMembers>
CASM::CompositionConverter::CompositionConverter ( ComponentIterator  begin,
ComponentIterator  end,
Eigen::VectorXd  _origin,
EndMembers...  _end_members 
)

Construct a CompositionConverter.

Parameters
begin,endRange of occupant name (std::string) indicating the Molecule type
_originOrigin for parametric composition space
_end_members1 or more end members for parameteric composition space axes
  • origin and end members should be Eigen::VectorXd giving number of atoms per type per prim
  • length of origin and end members should match size of prim.struc_molecule()

Definition at line 194 of file CompositionConverter.hh.

◆ CompositionConverter() [3/3]

template<typename ComponentIterator >
CASM::CompositionConverter::CompositionConverter ( ComponentIterator  begin,
ComponentIterator  end,
Eigen::VectorXd  _origin,
Eigen::MatrixXd  _end_members 
)

Construct a CompositionConverter.

Parameters
_primA primitive BasicStructure
_originOrigin for parametric composition space
_end_membersColumn vector matrix of end members for parameteric composition space axes
  • origin and columns in end members should be Eigen::VectorXd giving number of atoms per prim
  • length of origin and end members should match size of prim.struc_molecule()

Definition at line 219 of file CompositionConverter.hh.

Member Function Documentation

◆ _add_end_member() [1/2]

void CASM::CompositionConverter::_add_end_member ( Eigen::VectorXd  _end_member)
private

Helps make variadic template constructor possible.

Definition at line 398 of file CompositionConverter.cc.

◆ _add_end_member() [2/2]

template<typename... EndMembers>
void CASM::CompositionConverter::_add_end_member ( Eigen::VectorXd  _end_member,
EndMembers...  _others 
)
private

Helps make variadic template constructor possible.

Definition at line 233 of file CompositionConverter.hh.

◆ _calc_conversion_matrices()

void CASM::CompositionConverter::_calc_conversion_matrices ( )
private

Calculate conversion matrices m_to_n and m_to_x.

Definition at line 421 of file CompositionConverter.cc.

◆ _check_size()

void CASM::CompositionConverter::_check_size ( const Eigen::MatrixXd &  vec) const
private

Check that origin and end member vectors have same size as the number of components.

Definition at line 412 of file CompositionConverter.cc.

◆ _n_formula()

std::string CASM::CompositionConverter::_n_formula ( const Eigen::VectorXd &  vec) const
private

Return formula for 'n'.

Definition at line 448 of file CompositionConverter.cc.

◆ chem_pot()

Eigen::VectorXd CASM::CompositionConverter::chem_pot ( const Eigen::VectorXd  param_chem_pot) const

Convert dG/dx to dG/dn.

◆ comp_formula()

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.

◆ comp_n_formula()

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.

◆ comp_var()

std::string CASM::CompositionConverter::comp_var ( size_type  i)
static

Composition variable names: "a", "b", ...

Definition at line 29 of file CompositionConverter.cc.

◆ components()

std::vector< std::string > CASM::CompositionConverter::components ( ) const

The order of components in mol composition vectors.

Definition at line 34 of file CompositionConverter.cc.

◆ dmol_composition()

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.

◆ dmol_dparam()

Eigen::MatrixXd CASM::CompositionConverter::dmol_dparam ( ) const

Return the matrix Mij = dn_i/dx_j.

Definition at line 56 of file CompositionConverter.cc.

◆ dparam_composition()

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'.

Parameters
dnmol composition, matches order from components()

Definition at line 72 of file CompositionConverter.cc.

◆ dparam_dmol()

Eigen::MatrixXd CASM::CompositionConverter::dparam_dmol ( ) const

Return the matrix Mij = dx_i/dn_j.

Definition at line 53 of file CompositionConverter.cc.

◆ end_member()

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.

◆ end_member_formula()

std::string CASM::CompositionConverter::end_member_formula ( size_type  i) const

Return formula for end member.

Definition at line 393 of file CompositionConverter.cc.

◆ independent_compositions()

CompositionConverter::size_type CASM::CompositionConverter::independent_compositions ( ) const

The dimensionality of the composition space.

Examples:

  • ZrOa: 1
  • AaB(1-a): 1
  • AaBbC(1-a-b): 2

Definition at line 23 of file CompositionConverter.cc.

◆ mol_composition()

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.

◆ mol_formula()

std::string CASM::CompositionConverter::mol_formula ( ) const

Return formula for x->n.

Definition at line 104 of file CompositionConverter.cc.

◆ origin()

Eigen::VectorXd CASM::CompositionConverter::origin ( ) const

The mol composition of the parameteric composition axes origin.

Definition at line 42 of file CompositionConverter.cc.

◆ origin_formula()

std::string CASM::CompositionConverter::origin_formula ( ) const

Return formula for origin.

Definition at line 388 of file CompositionConverter.cc.

◆ param_chem_pot()

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.

◆ param_chem_pot_formula()

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.

◆ param_composition()

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'.

Parameters
nmol composition, matches order from components()

Definition at line 62 of file CompositionConverter.cc.

◆ param_formula()

std::string CASM::CompositionConverter::param_formula ( ) const

Return formula for n->x.

Definition at line 152 of file CompositionConverter.cc.

Member Data Documentation

◆ m_components

std::vector<std::string> CASM::CompositionConverter::m_components
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.

◆ m_end_members

Eigen::MatrixXd CASM::CompositionConverter::m_end_members
private

Column vector matrix, rows == m_components.size(), cols == rank of parametric composition space.

  • Specifies the number mol per prim of end member in parametric composition space

Definition at line 129 of file CompositionConverter.hh.

◆ m_origin

Eigen::VectorXd CASM::CompositionConverter::m_origin
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.

◆ m_to_n

Eigen::MatrixXd CASM::CompositionConverter::m_to_n
private

Conversion matrix: n = origin + m_to_n*x.

  • where x is parametric composition, and n is number of mol per prim

Definition at line 133 of file CompositionConverter.hh.

◆ m_to_x

Eigen::MatrixXd CASM::CompositionConverter::m_to_x
private

Conversion matrix: x = m_to_x*(n - origin)

  • where x is parametric composition, and n is number of mol per prim

Definition at line 137 of file CompositionConverter.hh.


The documentation for this class was generated from the following files: