15 namespace ConfigIO_impl {
29 for(
Index i = 0; i < struc_molecule.size(); i++) {
37 for(i = 0; i < struc_molecule.size(); i++) {
43 if(i == struc_molecule.size())
44 throw std::runtime_error(std::string(
"Format tag: '") +
name() +
"(" +
45 m_mol_names[n] +
")' does not correspond to a viable composition.\n");
52 std::vector<std::string> col;
67 "Parametric composition parameters, individual label as argument. "
68 "Without argument, all values are printed. Ex: comp(a), comp(b), etc.";
82 if(args.size() == 1) {
85 else if(args.size() > 1) {
86 throw std::runtime_error(std::string(
"Format tag: 'comp(") + args +
") is invalid.\n");
94 std::vector<std::string> col;
107 "Number of each species per unit cell, including vacancies. "
108 "No argument prints all available values. Ex: comp_n, comp_n(Au), comp_n(Pt), etc.";
121 "Fraction of sites occupied by a species, including vacancies. "
122 "No argument prints all available values. Ex: site_frac(Au), site_frac(Pt), etc.";
135 "Fraction of atoms that are a particular species, excluding vacancies. "
136 "Without argument, all values are printed. Ex: atom_frac(Au), atom_frac(Pt), etc.";
148 "Relaxed magnetic moment on each basis site. " ;
165 "Correlation values (evaluated basis functions, normalized per primitive cell). "
166 "If no arguements, prints all correlations, using the basis set for the default "
167 "cluster expansion as listed by 'casm settings -l'. "
168 "If one argument, accepts either: "
169 "1) a cluster expansion name, for example 'corr(formation_energy)', and "
170 "evaluates all basis functions, or "
171 "2) an integer index or range of indices of basis functions to evaluate, "
172 "for example 'corr(6)', or 'corr(0:6)'. "
173 "If two arguments, accepts cluster expansion name and an integer index or "
174 "range of basis functions to evaluate, for example 'corr(formation_energy,6)' "
175 "or 'corr(formation_energy,0:6)'.";
184 if(!m_clexulator.initialized()) {
198 std::vector<std::string> splt_vec;
199 boost::split(splt_vec, args, boost::is_any_of(
","), boost::token_compress_on);
201 if(!splt_vec.size()) {
204 else if(splt_vec.size() == 1) {
205 if((splt_vec[0].find_first_not_of(
"0123456789") == std::string::npos) ||
206 (splt_vec[0].find(
':') != std::string::npos)) {
210 m_clex_name = splt_vec[0];
213 else if(splt_vec.size() == 2) {
214 m_clex_name = splt_vec[0];
218 std::stringstream ss;
219 ss <<
"Too many arguments for 'clex'. Received: " << args <<
"\n";
220 throw std::runtime_error(ss.str());
230 "Predicted property value."
231 " Accepts arguments ($clex_name,$norm)."
232 " ($clex_name is a cluster expansion name as listed by 'casm settings -l', default=the default clex)"
233 " ($norm is the normalization, either 'per_species', or 'per_unitcell' <--default)";
242 m_clexulator(clexulator),
254 return std::unique_ptr<Clex>(this->
_clone());
269 err_log <<
"max eci index: " <<
m_eci.
index().back() << std::endl;
270 throw std::runtime_error(
"Error: bset and eci mismatch");
277 std::vector<std::string> splt_vec;
278 boost::split(splt_vec, args, boost::is_any_of(
","), boost::token_compress_on);
281 if(splt_vec.size()) {
285 m_norm = notstd::make_cloneable<Norm<Configuration> >();
286 if(splt_vec.size() == 2) {
287 if(splt_vec[1] ==
"per_unitcell") {
288 m_norm = notstd::make_cloneable<Norm<Configuration> >();
290 else if(splt_vec[1] ==
"per_species") {
291 m_norm = notstd::make_cloneable<NormPerSpecies>();
294 std::stringstream ss;
295 ss <<
"Error parsing second argument for 'clex'. Received: " << args <<
"\n";
296 throw std::runtime_error(ss.str());
300 if(splt_vec.size() > 2) {
301 std::stringstream ss;
302 ss <<
"Too many arguments for 'clex'. Received: " << args <<
"\n";
303 throw std::runtime_error(ss.str());
316 return new Clex(*
this);
342 "Configuration name, in the form 'SCEL#_#_#_#_#_#_#/#'",
344 return config.name();
350 "Supercell name, in the form 'SCEL#_#_#_#_#_#_#'",
352 return config.get_supercell().get_name();
360 "Status of calculation.",
367 "Reason for calculation failure.",
375 "Supercell volume, given as the integer number of unit cells",
377 return config.get_supercell().volume();
383 "Symmetric multiplicity of the configuration, excluding translational equivalents.",
385 return config.get_prim().factor_group().size() / config.factor_group().size();
391 "Name of the configuration's point group.",
393 return config.point_group().get_name();
410 "DFT relaxed energy, normalized per primitive cell",
417 "relaxed_energy_per_atom",
418 "DFT relaxed energy, normalized per atom",
426 "reference energy, normalized per primitive cell, as determined by current reference states",
433 "reference_energy_per_atom",
434 "reference energy, normalized per atom, as determined by current reference states",
442 "DFT formation energy, normalized per primitive cell and measured "
443 "relative to current reference states",
450 "formation_energy_per_atom",
451 "DFT formation energy, normalized per atom and measured relative to "
452 "current reference states",
469 "True (1) if all current properties have been been calculated for the configuration",
475 "True (1) if the configuration cannot be described within a smaller supercell",
481 "True (1) if the configuration cannot be transfromed by symmetry to a configuration with higher lexicographic order",
487 "Root-mean-square forces of relaxed configurations, determined from DFT (eV/Angstr.)",
494 "Cost function that describes the degree to which basis sites have relaxed",
501 "Cost function that describes the degree to which lattice has relaxed.",
508 "Change in volume due to relaxation, expressed as the ratio V/V_0.",
515 "Relaxed magnetic moment, normalized per primative cell.",
522 "Relaxed magnetic moment, normalized per atom.",
535 using namespace ConfigIO;
552 using namespace ConfigIO;
571 using namespace ConfigIO;
585 using namespace ConfigIO;
613 using namespace ConfigIO;
bool parse_args(const std::string &args) override
Expects arguments of the form 'name' or 'name(Au)', 'name(Pt)', etc.
Clexulator clexulator(const ClexDescription &key) const
void init(const Configuration &_tmplt) const override
Adds index rules corresponding to the parsed args.
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the mag sites.
Specifies a particular cluster expansion.
double rms_force(const Configuration &_config)
Root-mean-square forces of relaxed configurations, determined from DFT (eV/Angstr.)
static const std::string Name
ConfigIO::GenericConfigFormatter< std::string > failure_type()
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the parametric composition.
void init(const Configuration &_tmplt) const override
If not yet initialized, use the global clexulator and eci from the PrimClex.
std::vector< std::string > col_header(const Configuration &_tmplt) const override
col_header returns: {'comp(a)', 'comp(b)', ...'}
Eigen::VectorXd relaxed_mag(const Configuration &_config)
Returns the relaxed magnetic moment for each molecule.
static const std::string Desc
static const std::string Desc
PrimClex & get_primclex() const
Get the PrimClex for this Configuration.
notstd::cloneable_ptr< Norm< Configuration > > m_norm
double relaxed_magmom(const Configuration &_config)
Returns the relaxed magnetic moment, normalized per unit cell.
static const std::string Desc
ConfigIO::Selected selected_in(const ConfigSelection< IsConst > &_selection)
bool has_basis_deformation(const Configuration &_config)
bool has_formation_energy(const Configuration &_config)
ConfigIO::GenericConfigFormatter< std::string > calc_status()
std::vector< Molecule > get_struc_molecule() const
Returns an Array of each possible Molecule in this Structure.
ConfigIO::GenericConfigFormatter< double > relaxed_energy()
ConfigIO::GenericConfigFormatter< double > relaxed_magmom()
IntegerAttributeDictionary< Configuration > make_integer_dictionary< Configuration >()
bool has_composition_axes() const
check if CompositionConverter object initialized
bool has_lattice_deformation(const Configuration &_config)
static const std::string Desc
Correlation correlations(const ConfigDoF &configdof, const Supercell &scel, Clexulator &clexulator)
Returns correlations using 'clexulator'. Supercell needs a correctly populated neighbor list...
bool has_relaxed_energy(const Configuration &_config)
bool initialized() const
Is runtime library loaded?
size_type corr_size() const
Number of correlations.
bool parse_args(const std::string &args) override
Expects 'clex', 'clex(formation_energy)', or 'clex(formation_energy_per_species)'.
Eigen::VectorXd comp(const Configuration &config)
Returns parametric composition, as calculated using PrimClex::param_comp.
std::pair< iterator, bool > insert(const value_type &value)
Insert single value.
static const std::string Desc
double relaxed_energy_per_species(const Configuration &config)
Returns the relaxed energy, normalized per species.
Eigen::VectorXd comp_n(const ConfigDoF &configdof, const Supercell &scel)
Returns comp_n, the number of each molecule per primitive cell, ordered as Structure::get_struc_molec...
ConfigIO::GenericConfigFormatter< double > lattice_deformation()
double formation_energy(const Configuration &config)
Returns the formation energy, normalized per unit cell.
const ClexDescription & clex(std::string name) const
const Properties & calc_properties() const
ConfigIO::GenericConfigFormatter< double > rms_force()
ConfigIO::GenericConfigFormatter< double > relaxed_magmom_per_species()
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the atom fraction.
ConfigIO::GenericConfigFormatter< double > reference_energy()
static const int standard
double evaluate(const Configuration &config) const override
Returns the atom fraction.
std::string failure_type(const Configuration &_config)
double _norm(const Configuration &config) const
Returns the normalization.
void init(const Configuration &_tmplt) const override
If not yet initialized, use the global clexulator from the PrimClex.
ConfigIO::GenericConfigFormatter< bool > is_primitive()
T norm(const Tensor< T > &ttens)
EigenIndex Index
For long integer indexing:
static const std::string Name
bool has_rms_force(const Configuration &_config)
GenericConfigFormatter< std::string > pointgroup_name()
static const std::string Desc
bool parse_args(const std::string &args) override
Expects arguments of the form 'comp' or 'comp(a)', 'comp(b)', etc.
StringAttributeDictionary< Configuration > make_string_dictionary< Configuration >()
bool is_canonical(const Configuration &_config)
returns true if _config no symmetry transformation applied to _config will increase its lexicographic...
double volume_relaxation(const Configuration &_config)
Change in volume due to relaxation, expressed as the ratio V/V_0.
bool is_calculated(const Configuration &config)
Return true if all current properties have been been calculated for the configuration.
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the site fraction.
ProjectSettings & settings()
const std::vector< size_type > & index() const
const Access orbit indices of ECI values
BooleanAttributeDictionary< Configuration > make_boolean_dictionary< Configuration >()
ConfigIO::GenericConfigFormatter< double > volume_relaxation()
PrimClex is the top-level data structure for a CASM project.
ConfigIO::GenericConfigFormatter< double > formation_energy()
std::vector< std::string > col_header(const Configuration &_tmplt) const override
col_header returns: {'name(Au)', 'name(Pt)', ...}
double relaxed_magmom_per_species(const Configuration &_config)
Returns the relaxed magnetic moment, normalized per species.
std::vector< std::string > m_mol_names
ConfigIO::GenericConfigFormatter< bool > is_calculated()
ScalarAttributeDictionary< Configuration > make_scalar_dictionary< Configuration >()
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
static const std::string Name
Returns predicted formation energy.
Eigen::VectorXd site_frac(const Configuration &config)
Returns the composition as site fraction, in the order of Structure::get_struc_molecule.
static const std::string Name
double formation_energy_per_species(const Configuration &config)
Returns the formation energy, normalized per species.
double lattice_deformation(const Configuration &_config)
Cost function that describes the degree to which lattice has relaxed.
bool validate(const Configuration &config) const override
Returns true if the Configuration has relaxed_mag.
bool validate(const Configuration &config) const override
Returns true if the PrimClex has composition axes.
static const std::string Name
bool has_failure_type(const Configuration &_config)
ConfigIO::GenericConfigFormatter< double > basis_deformation()
ConfigIO::GenericConfigFormatter< double > reference_energy_per_species()
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
bool has_volume_relaxation(const Configuration &_config)
static const std::string Name
double relaxed_energy(const Configuration &config)
Returns the relaxed energy, normalized per unit cell.
double basis_deformation(const Configuration &_config)
Cost function that describes the degree to which basis sites have relaxed.
static const std::string Name
double reference_energy(const Configuration &config)
Returns the reference energy, normalized per unit cell.
void error(const std::string &what)
bool has_relaxed_magmom(const Configuration &_config)
double reference_energy_per_species(const Configuration &config)
Returns the reference energy, normalized per species.
std::unique_ptr< Clex > clone() const
Clone using copy constructor.
std::string calc_status(const Configuration &_config)
Status of calculation.
Clex * _clone() const override
Clone using copy constructor.
ConfigIO::GenericConfigFormatter< Index > scel_size()
ConfigIO::GenericConfigFormatter< std::string > scelname()
static const std::string Desc
ConfigIO::GenericConfigFormatter< Index > multiplicity()
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the atom fraction.
Data structure used for cluster expansions.
const ClexDescription & default_clex() const
ConfigIO::GenericConfigFormatter< bool > is_canonical()
ConfigIO::GenericConfigFormatter< double > relaxed_energy_per_species()
bool is_primitive(const Configuration &_config)
returns true if _config describes primitive cell of the configuration it describes ...
bool parse_args(const std::string &args) override
Expects 'corr', 'corr(clex_name)', 'corr(index_expression)', or 'corr(clex_name,index_expression)'.
Eigen::VectorXd species_frac(const Configuration &config)
Returns the composition as species fraction, with [Va] = 0.0, in the order of Structure::get_struc_mo...
A Configuration represents the values of all degrees of freedom in a Supercell.
Eigen::VectorXd evaluate(const Configuration &config) const override
Returns the parametric composition.
const Structure & get_prim() const
const Access to primitive Structure
bool has_reference_energy(const Configuration &_config)
Returns true if configuration is specified in given selection (default: MASTER)
const ECIContainer & eci(const ClexDescription &key) const
VectorXdAttributeDictionary< Configuration > make_vectorxd_dictionary< Configuration >()
ConfigIO::GenericConfigFormatter< double > formation_energy_per_species()
bool has_calc_status(const Configuration &_config)
A sparse container of ECI values and their corresponding orbit indices.