1 #ifndef CASM_ChemicalReference_impl
2 #define CASM_ChemicalReference_impl
13 template <
typename RefStateIterator>
15 RefStateIterator begin,
16 RefStateIterator end,
double tol)
18 ConfigIO::AtomFrac()),
36 template <
typename RefStateIterator>
47 template <
typename RefStateIterator>
49 RefStateIterator begin,
50 RefStateIterator end,
double tol) {
59 template <
typename RefStateIterator>
61 RefStateIterator begin, RefStateIterator end,
80 template <
typename RefStateIterator>
82 RefStateIterator begin,
92 for (
auto it = begin; it != end; ++it) {
93 for (
auto mol_it = it->species_num.begin(); mol_it != it->species_num.end();
96 throw std::runtime_error(
97 "Error in ChemicalReference::hyperplane: Input should not include "
100 if (!
contains(struc_mol_name, mol_it->first)) {
101 struc_mol_name.push_back(mol_it->first);
113 Eigen::MatrixXd::Zero(struc_mol_name.size(), std::distance(begin, end));
119 for (
auto it = begin; it != end; ++it, ++index) {
120 E(index) = it->energy_per_species;
121 for (
auto mol_it = it->species_num.begin(); mol_it != it->species_num.end();
123 N(
find_index(struc_mol_name, mol_it->first), index) = mol_it->second;
std::map< std::string, Eigen::VectorXd > & _supercell()
const Access a map of scelname to reference for Supercell specialized references
const BasicStructure * m_prim
static Eigen::VectorXd _calc_hyperplane(const BasicStructure &prim, const std::vector< std::string > &struc_mol_name, Eigen::MatrixXd N, Eigen::VectorXd E, double tol)
Convert a set of ChemicalReferenceState to a hyperplane, including checks.
std::vector< ChemicalReferenceState > RefStateVec
void set_config(const std::string &configname, const Eigen::VectorXd &ref)
Set hyperplane reference specialized for a Configuration.
void set_global(const Eigen::VectorXd &ref)
Set global hyperplane reference.
RefStateMap m_supercell_ref_map
RefStateVec m_global_ref_vec
RefStateMap m_config_ref_map
static Eigen::VectorXd hyperplane(const BasicStructure &prim, RefStateIterator begin, RefStateIterator end, double tol)
Convert a set of ChemicalReferenceState to a hyperplane, including checks.
void set_supercell(const std::string &scelname, const Eigen::VectorXd &ref)
Set hyperplane reference specialized for a Supercell.
std::map< std::string, Eigen::VectorXd > & _config()
const Access a map of configname to reference for Configuration specialized references
ChemicalReference(const BasicStructure &prim, const Eigen::VectorXd &_global_ref, SpecializedRef _supercell_ref=SpecializedRef(), SpecializedRef _config_ref=SpecializedRef())
Constructor.
const BasicStructure & prim() const
Get primitive BasicStructure.
Eigen::VectorXd & _global()
Access the global reference.
Maps a Configuration to a scalar value via a hyperplane.
BasicStructure specifies the lattice and atomic basis of a crystal.
bool is_vacancy(const std::string &name)
A vacancy is any Specie/Molecule with (name == "VA" || name == "va" || name == "Va")
std::vector< std::string > struc_molecule_name(BasicStructure const &_struc)
Returns an Array of each possible Molecule in this Structure.
std::string scelname(const Structure &prim, const Lattice &superlat)
Make supercell name name [deprecated].
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
Index find_index(Iterator begin, Iterator end, const T &value)
Equivalent to std::distance(begin, std::find(begin, end, value))
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value)
INDEX_TYPE Index
For long integer indexing: