21 "ConfigEnumStrain: \n\n"
23 " ... include help documentation here ... \n\n";
29 throw std::runtime_error(
"EnumInterface<Strain>::run is not implemented");
34 const std::vector<Index> &linear_partitions,
35 const std::vector<double> &magnitudes,
40 m_perm_begin(_scel.permute_begin()),
41 m_perm_end(_scel.permute_end()),
42 m_shape_factor(
Eigen::
MatrixXd::Identity(m_strain_calc.dim(), m_strain_calc.dim())) {
51 std::vector<double> absmags;
52 std::transform(magnitudes.cbegin(), magnitudes.cend(), std::back_inserter(absmags), std::abs<double>);
57 std::vector<Index> mult;
60 Index num_sub = wedges.size();
63 for(
Index s = 0; s < num_sub; s++) {
64 double wedgevol = sqrt((wedges[s].transpose() * wedges[s]).determinant());
65 Index N =
round(pow(linear_partitions[s], wedges[s].cols()));
67 std::cout <<
"wedgevol: " << wedgevol <<
", N: " << N;
68 N =
max(1, (
int) ceil(pow(wedgevol *
double(N), 1.0 /
double(wedges[s].cols())) -
TOL));
69 std::cout <<
", linearN: " << N <<
"\n";
70 std::cout <<
"mult.size() is: " << mult.size() <<
" and mult is ";
72 std::cout << m <<
" ";
75 for(
Index i = 0; i < wedges[s].cols(); i++, nc++) {
76 if(mult[nc] == 1 && linear_partitions[s] > 1) {
77 init(nc) = -absmags[s];
88 if(linear_partitions[s] < 2) {
93 final(nc) = absmags[s] +
TOL;
94 inc(nc) = absmags[s] / double(N);
104 std::vector<Index> max_equiv(wedges.size());
105 for(
Index w = 0; w < wedges.size(); w++) {
107 if(absmags[w] <
TOL) {
108 wedge_orbits[w].push_back(0.0 * wedges[w]);
113 for(
Index p = 0; p < trep.size(); p++) {
115 if(
contains(wedge_orbits[w], twedge, eigen_compare))
117 wedge_orbits[w].push_back(twedge);
120 max_equiv[w] = wedge_orbits[w].size() - 1;
126 for(; wcount; ++wcount) {
129 for(
Index i = 0; i < wedges.size(); i++) {
130 for(
Index j = 0; j < wedges[i].cols(); j++)
131 ttrans.col(l++) = wedge_orbits[i][wcount[i]].col(j);
135 [&ttrans, eigen_compare](
const std::vector<Eigen::MatrixXd> &_orbit)->
bool {
136 return contains(_orbit, ttrans, eigen_compare);
139 trans_mat_orbits.push_back(std::vector<Eigen::MatrixXd>(1, ttrans));
141 for(
Index p = 0; p < trep.size(); p++) {
143 if(!
contains(trans_mat_orbits.back(), symtrans, eigen_compare))
144 trans_mat_orbits.back().push_back(symtrans);
152 std::cout <<
"Project matrices are \n";
184 std::cout <<
"INCREMENTING m_equiv_ind to " <<
m_equiv_ind <<
"\n";
194 std::cout <<
"Counter is " <<
m_counter().transpose() <<
"\n\n";
const Eigen::MatrixXd & sop_transf_mat() const
void reset_properties(ConfigDoF &_dof)
A Counter allows looping over many incrementing variables in one loop.
void set_deformation(const Eigen::Matrix3d &_deformation)
Set applied strain.
const SymGroup & point_group() const
CASM::EnumInterfaceBase * make_ConfigEnumStrain_interface()
const Structure & get_prim() const
bool contains_if(const Container &container, UnaryPredicate p)
Equivalent to container.end() != std::find_if(container.begin(), container.end(), p) ...
Matrix3d unrolled_strain_metric_to_F(const VectorXd &E) const
Base class for generic use of enumerators that may be accessed through the API.
virtual jsonParser source(step_type step) const
Eigen::MatrixXd m_shape_factor
Represents a supercell of the primitive parent crystal structure.
SymGroupRepID symrep_ID() const
PrimClex & get_primclex() const
void increment() override
Implements increment over all strain states.
Template class to be specialized for each enumerator that may be accessed via the API...
value_type & _current()
Access the current ObjectType by reference.
const MasterSymGroup & factor_group() const
static int run(PrimClex &primclex, const jsonParser &kwargs, const Completer::EnumOption &enum_opt)
typename multivector_impl::multivector_tmp< T, N >::type X
EigenIndex Index
For long integer indexing:
void _invalidate()
Call if enumeration complete.
step_type step() const
Increments with each enumerated object.
ConfigEnumStrain(Supercell &scel, const Configuration &_init, const std::vector< Index > &subspace_partitions, const std::vector< double > &magnitudes, std::string _mode)
PrimClex is the top-level data structure for a CASM project.
void set_symmetrized_sop(const SymGroup &pg)
T max(const T &A, const T &B)
std::vector< Eigen::MatrixXd > irreducible_wedges(const SymGroup &pg, std::vector< Index > &multiplicities)
void set_source(const jsonParser &source)
static const std::string interface_help
bool almost_equal(const Eigen::MatrixBase< Derived1 > &val1, const Eigen::MatrixBase< Derived2 > &val2, double tol=CASM::TOL)
static const std::string enumerator_name
std::vector< Eigen::MatrixXd > m_trans_mats
StrainConverter m_strain_calc
bool contains(const Container &container, const T &value)
Equivalent to container.end() != std::find(container.begin(), container.end(), value) ...
EigenCounter< Eigen::VectorXd > m_counter
void _increment_step()
Increment current step value.
A Configuration represents the values of all degrees of freedom in a Supercell.
const Structure & get_prim() const
const Access to primitive Structure