14 std::vector<std::string> splt_vec;
15 double _lattice_weight(0.5);
18 boost::split(splt_vec, args, boost::is_any_of(
", "), boost::token_compress_on);
19 if(splt_vec.size() < 2 || splt_vec.size() > 4) {
20 throw std::runtime_error(
"Attempted to initialize format tag " +
name()
22 + args +
"). You must provide at least 2 arguments, but no more than 4.\n");
30 throw std::runtime_error(
"Attempted to initialize format tag " +
name()
31 +
" invalid file path '" + fs::absolute(
m_prim_path).
string() +
"'. File does not exist.\n");
36 for(
Index i = 1; i < splt_vec.size(); ++i) {
37 if(splt_vec[i] !=
"basis_score" && splt_vec[i] !=
"lattice_score" && splt_vec[i] !=
"total_score") {
39 _lattice_weight = std::stod(splt_vec[i]);
42 throw std::runtime_error(
"Attempted to initialize format tag " +
name()
43 +
" with invalid argument '" + splt_vec[i] +
"'. Valid arguments are [ basis_score | lattice_score | total_score ]\n");
46 for(; pushed_args > 0; pushed_args--)
69 std::vector<std::string> col;
71 std::stringstream t_ss;
73 col.push_back(t_ss.str());
82 std::stringstream t_ss;
92 std::vector<double> result_vec;
98 auto lambda = [&](
const std::vector<double> &result_vec) {
100 for(
Index i = 0; i < res.size(); ++i) {
101 res(i) = result_vec[i];
110 result_vec.push_back(1e9);
113 return lambda(result_vec);
126 result_vec.push_back(w * sc + (1.0 - w)*bc);
130 return lambda(result_vec);
void from_json(ClexDescription &desc, const jsonParser &json)
bool struc_to_configdof(const BasicStructure< Site > &_struc, ConfigDoF &mapped_configdof, Lattice &mapped_lat) const
Low-level routine to map a structure onto a ConfigDof.
Structure specifies the lattice and atomic basis of a crystal.
fs::path calc_properties_path() const
std::string to_string(ENUM val)
Return string representation of enum class.
const Lattice & lattice() const
Eigen::VectorXd evaluate(const Configuration &_config) const override
bool validate(const Configuration &_config) const override
bool parse_args(const std::string &args) override
Default implementation calls _parse_index_expression.
EigenIndex Index
For long integer indexing:
A container class for the different degrees of freedom a Configuration might have.
double lattice_weight() const
std::vector< std::string > m_prop_names
Array< CoordType > basis
Lattice vectors that specifies periodicity of the crystal.
std::string short_header(const Configuration &_config) const override
PrimClex is the top-level data structure for a CASM project.
SimpleJSonSiteStructure< true > simple_json(const BasicStructure< Site > &struc, const std::string &prefix)
double basis_cost(const ConfigDoF &_dof, Index Nsites)
Calculate the basis cost function of a ConfigDoF as the mean-square displacement of its atoms...
std::unique_ptr< PrimClex > m_altprimclex
ConfigMapper m_configmapper
std::vector< std::string > col_header(const Configuration &_config) const override
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)
A Configuration represents the values of all degrees of freedom in a Supercell.
double strain_cost(const Lattice &relaxed_lat, const ConfigDoF &_dof, Index Nsites)
Calculate the strain cost function of a ConfigDoF using LatticeMap::calc_strain_cost() ...