1 #ifndef CASM_SupercellIO_impl
2 #define CASM_SupercellIO_impl
18 template <
typename Base>
24 m_last_unit(nullptr) {}
27 template <
typename Base>
29 std::vector<std::string> splt_vec;
30 boost::split(splt_vec, args, boost::is_any_of(
","), boost::token_compress_on);
35 if (splt_vec.size() != 1) {
37 ss << this->
name() <<
" expected 1 argument. Received " << splt_vec.size()
38 <<
": '" << args <<
"'";
39 throw std::runtime_error(ss.str());
42 m_refcell_name = args;
47 template <
typename Base>
50 auto it = supercell_db.find(m_refcell_name);
51 if (it == supercell_db.end()) {
53 ss << this->
name() <<
" expected a supercell name. Received '"
54 << m_refcell_name <<
"': no supercell with this name was found";
55 throw std::runtime_error(ss.str());
62 template <
typename Base>
65 return std::vector<std::string>{this->
name() +
"(" + m_refcell_name +
")"};
74 template <
typename Base>
78 if (&scel != m_last_scel || &unit != m_last_unit) {
85 *res.first,
iround(res.second));
87 return *m_last_result;
90 template <
typename Base>
92 if (m_refcell ==
nullptr) {
94 ss << this->
name() <<
" expected a supercell name. Received '"
95 << m_refcell_name <<
"': no supercell with this name was found";
96 throw std::runtime_error(ss.str());
bool init(const Supercell &_tmplt) const override
Set pointer to ref supercell.
SupercellCheckBase(std::string name, std::string desc)
bool parse_args(const std::string &args) override
Expects arguments of the form 'is_supercell_of(scelname)'.
std::tuple< bool, SymOp, Eigen::MatrixXi > result_type
const result_type & _evaluate(const Supercell &scel, const Supercell &unit) const
Supercell const & refcell() const
std::vector< std::string > col_header(const Supercell &_tmplt) const override
col_header returns: {'short_name(refcell_name)'}
const MasterSymGroup & factor_group() const
Represents a supercell of the primitive parent crystal structure.
const PrimClex & primclex() const
Use while transitioning Supercell to no longer need a PrimClex const *
double crystallography_tol() const
const Lattice & lattice() const
The super lattice.
const Structure & prim() const
Eigen::CwiseUnaryOp< decltype(Local::iround_l< typename Derived::Scalar >), const Derived > iround(const Eigen::MatrixBase< Derived > &val)
Round Eigen::MatrixXd to Eigen::MatrixXi.
DB::Database< T > & db() const
std::pair< OpIterator, Eigen::Matrix3d > is_equivalent_superlattice(const Object &scel, const Object &unit, OpIterator begin, OpIterator end, double tol)
GenericDatumFormatter< std::string, DataObject > name()
Non-std smart pointer classes and functions.
cloneable_ptr< T > make_cloneable(Args &&... args)
make a cloneable_ptr<T> via T(Args... args)