1 #ifndef CASM_CompositionConverter_HH
2 #define CASM_CompositionConverter_HH
24 template <
typename ComponentIterator,
typename... EndMembers>
29 template <
typename ComponentIterator>
102 template <
typename... EndMembers>
142 template <
typename OutputIterator>
148 std::ostream &stream,
149 const std::map<std::string, CompositionConverter> &map);
193 template <
typename ComponentIterator,
typename... EndMembers>
195 ComponentIterator end,
197 EndMembers... _end_members)
198 : m_components(begin, end), m_origin(_origin) {
218 template <
typename ComponentIterator>
220 ComponentIterator end,
223 : m_components(begin, end), m_origin(_origin), m_end_members(_end_members) {
232 template <
typename... EndMembers>
234 EndMembers... _others) {
241 template <
typename OutputIterator>
248 for (
int i = 0; i < param_comp.
allowed_list().size(); i++) {
Convert between number of species per unit cell and parametric composition.
Eigen::VectorXd mol_composition(const Eigen::VectorXd &x) const
Convert parametric composition, 'x', to number of mol per prim, 'n'.
Eigen::MatrixXd m_end_members
Column vector matrix, rows == m_components.size(), cols == rank of parametric composition space.
std::string comp_formula(size_type i) const
Return formula for comp(i) in terms of comp_n(A), comp_n(B), ...
Eigen::VectorXd chem_pot(const Eigen::VectorXd param_chem_pot) const
Convert dG/dx to dG/dn.
std::string _n_formula(const Eigen::VectorXd &vec) const
Return formula for 'n'.
void _calc_conversion_matrices()
Calculate conversion matrices m_to_n and m_to_x.
Eigen::VectorXd m_origin
Vector, size == m_components.size(), specifying the num_mols_per_prim of each component at the origin...
Eigen::MatrixXd m_to_x
Conversion matrix: x = m_to_x*(n - origin)
Eigen::VectorXd end_member(size_type i) const
The mol composition of the parameteric composition axes end members.
std::string origin_formula() const
Return formula for origin.
std::string param_formula() const
Return formula for n->x.
void _check_size(const Eigen::MatrixXd &vec) const
Check that origin and end member vectors have same size as the number of components.
Eigen::VectorXd param_composition(const Eigen::VectorXd &n) const
Convert number of mol per prim, 'n' to parametric composition 'x'.
std::string comp_n_formula(size_type i) const
Return formula for comp_n(components()[i]) in terms of comp(a), comp(b), ...
static std::string comp_var(size_type i)
Composition variable names: "a", "b", ...
CompositionConverter()
Default constructor.
Eigen::VectorXd dparam_composition(const Eigen::VectorXd &dn) const
Convert change in number of atoms per prim, 'dn' to change in parametric composition 'dx'.
Eigen::VectorXd origin() const
The mol composition of the parameteric composition axes origin.
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), ...
size_type independent_compositions() const
The dimensionality of the composition space.
Eigen::VectorXd param_chem_pot(const Eigen::VectorXd chem_pot) const
Convert dG/dn to dG/dx.
std::string mol_formula() const
Return formula for x->n.
Eigen::VectorXd dmol_composition(const Eigen::VectorXd &dx) const
Convert change in parametric composition, 'dx', to change in number of mol per prim,...
void _add_end_member(Eigen::VectorXd _end_member)
Helps make variadic template constructor possible.
Eigen::MatrixXd dparam_dmol() const
Return the matrix Mij = dx_i/dn_j.
Eigen::MatrixXd dmol_dparam() const
Return the matrix Mij = dn_i/dx_j.
Eigen::MatrixXd m_to_n
Conversion matrix: n = origin + m_to_n*x.
std::vector< std::string > components() const
The order of components in mol composition vectors.
std::vector< std::string > m_components
List of all allowed components names in the prim, position in vector is reference for origin and end_...
std::string end_member_formula(size_type i) const
Return formula for end member.
const std::vector< ParamComposition > & allowed_list() const
std::vector< std::vector< std::string > > AllowedOccupants
const Eigen::VectorXd & origin() const
void generate_prim_end_members()
void generate_composition_space(bool verbose=false)
const std::vector< std::string > & components() const
Components are in order of appearance precedence in allowed_occs()
const std::vector< Eigen::VectorXd > & spanning_end_members() const
void display_comp_n(std::ostream &stream, const CompositionConverter &f, int indent=0)
Pretty-print comp_n in terms of comp.
Eigen::MatrixXd composition_space(const ParamComposition::AllowedOccupants &_allowed_occs, double tol=1e-14)
Return the composition space of a ParamComposition::AllowedOccupants.
void display_param_chem_pot(std::ostream &stream, const CompositionConverter &f, int indent=0)
Pretty-print param_chem_pot in terms of chem_pot.
void display_composition_axes(std::ostream &stream, const std::map< std::string, CompositionConverter > &map)
Pretty-print map of name/CompositionConverter pairs.
Eigen::MatrixXd end_members(const ParamComposition::AllowedOccupants &_allowed_occs)
Serialize CompositionConverter to JSON.
Eigen::MatrixXd null_composition_space(const ParamComposition::AllowedOccupants &_allowed_occs, double tol=1e-14)
Return the null composition space of a ParamComposition::AllowedOccupants.
void display_comp(std::ostream &stream, const CompositionConverter &f, int indent=0)
Pretty-print comp in terms of comp_n.
OutputIterator standard_composition_axes(ParamComposition::AllowedOccupants _allowed_occs, OutputIterator result)
Generate CompositionConverter specifying standard composition axes for a prim Structure.