CASM  1.1.0
A Clusters Approach to Statistical Mechanics
DoFSpace.hh
Go to the documentation of this file.
1 #ifndef CASM_DoFSpace
2 #define CASM_DoFSpace
3 
6 
7 namespace CASM {
8 
9 struct VectorSpaceSymReport;
10 
11 namespace SymRepTools_v2 {
12 struct VectorSpaceSymReport;
13 }
14 
50 //
54 class DoFSpace {
55  public:
56  DoFSpace(std::shared_ptr<Structure const> const &_shared_prim,
57  DoFKey const &_dof_key,
58  std::optional<Eigen::Matrix3l> const
59  &_transformation_matrix_to_super = std::nullopt,
60  std::optional<std::set<Index>> const &_sites = std::nullopt,
61  std::optional<Eigen::MatrixXd> const &_basis = std::nullopt);
62 
64  std::shared_ptr<Structure const> const &shared_prim() const;
65 
68  DoFKey const &dof_key() const;
69 
71  std::optional<Eigen::Matrix3l> const &transformation_matrix_to_super() const;
72 
74  std::optional<std::set<Index>> const &sites() const;
75 
77  bool includes_all_sites() const;
78 
81  Eigen::MatrixXd const &basis() const;
82 
84  Index dim() const;
85 
87  Index subspace_dim() const;
88 
90  std::vector<std::string> const &axis_glossary() const;
91 
102  std::optional<std::vector<Index>> const &axis_site_index() const;
103 
114  std::optional<std::vector<Index>> const &axis_dof_component() const;
115 
116  private:
118  std::shared_ptr<Structure const> m_shared_prim;
119 
123 
125  std::optional<Eigen::Matrix3l> m_transformation_matrix_to_super;
126 
128  std::optional<std::set<Index>> m_sites;
129 
133 
135  std::vector<std::string> m_axis_glossary;
136 
147  std::optional<std::vector<Index>> m_axis_site_index;
148 
159  std::optional<std::vector<Index>> m_axis_dof_component;
160 };
161 
167 bool is_valid_dof_space(Configuration const &config, DoFSpace const &dof_space);
168 
171  DoFSpace const &dof_space);
172 
175  DoFSpace const &dof_space);
176 
178 void set_dof_value(Configuration &config, DoFSpace const &dof_space,
180 
183  DoFKey dof_key, xtal::BasicStructure const &prim,
184  std::optional<Eigen::Matrix3l> const &transformation_matrix_to_super =
185  std::nullopt,
186  std::optional<std::set<Index>> const &sites = std::nullopt);
187 
189 std::vector<std::string> make_dof_space_axis_glossary(
190  DoFKey dof_key, xtal::BasicStructure const &prim,
191  std::optional<Eigen::Matrix3l> const &transformation_matrix_to_super =
192  std::nullopt,
193  std::optional<std::set<Index>> const &sites = std::nullopt);
194 
197  DoFKey dof_key, xtal::BasicStructure const &prim,
198  std::optional<Eigen::Matrix3l> const &transformation_matrix_to_super,
199  std::optional<std::set<Index>> const &sites,
200  std::vector<std::string> &axis_glossary,
201  std::optional<std::vector<Index>> &axis_site_index,
202  std::optional<std::vector<Index>> &axis_dof_component);
203 
207  DoFKey dof_key, ConfigEnumInput const &input_state,
208  std::optional<Eigen::MatrixXd> const &basis = std::nullopt);
209 
212  DoFSpace const &dof_space, SupercellSymInfo const &sym_info,
213  std::vector<PermuteIterator> const &group,
214  MasterSymGroup &symrep_master_group, SymGroupRepID &id);
215 
218  DoFSpace const &dof_space, SupercellSymInfo const &sym_info,
219  std::vector<PermuteIterator> const &group, bool calc_wedges = false);
220 
223  DoFSpace const &dof_space, SupercellSymInfo const &sym_info,
224  std::vector<PermuteIterator> const &group, bool calc_wedges = false);
225 
228  DoFSpace const &dof_space, SupercellSymInfo const &sym_info,
229  std::vector<PermuteIterator> const &group, bool calc_wedges,
230  std::optional<VectorSpaceSymReport> &symmetry_report);
231 
234  DoFSpace const &dof_space, SupercellSymInfo const &sym_info,
235  std::vector<PermuteIterator> const &group, bool calc_wedges,
236  std::optional<SymRepTools_v2::VectorSpaceSymReport> &symmetry_report);
237 
238 class make_symmetry_adapted_dof_space_error : public std::runtime_error {
239  public:
241  : std::runtime_error(_what) {}
243 };
244 
246 DoFSpace exclude_homogeneous_mode_space(DoFSpace const &dof_space);
247 
249 Eigen::MatrixXd make_homogeneous_mode_space(DoFSpace const &dof_space);
250 
265  VectorSpaceMixingInfo(Eigen::MatrixXd const &column_vector_space,
266  Eigen::MatrixXd const &subspace, double tol);
267  std::vector<Index> axes_not_in_subspace;
268  std::vector<Index> axes_in_subspace;
269  std::vector<Index> axes_mixed_with_subspace;
271 };
272 
273 } // namespace CASM
274 
275 #endif
std::vector< std::string > m_axis_glossary
Names the DoF corresponding to each dimension (row) of the basis.
Definition: DoFSpace.hh:135
Eigen::MatrixXd const & basis() const
Definition: DoFSpace.cc:227
std::optional< std::vector< Index > > const & axis_site_index() const
Definition: DoFSpace.cc:242
Index subspace_dim() const
The DoF subspace dimension (equal to number of columns in basis).
Definition: DoFSpace.cc:233
bool includes_all_sites() const
True, if local DoF space with all sites in the supercell included.
Definition: DoFSpace.cc:219
std::optional< Eigen::Matrix3l > const & transformation_matrix_to_super() const
Specifies the supercell for a local DoF space. Has value for local DoF.
Definition: DoFSpace.cc:208
std::optional< std::vector< Index > > const & axis_dof_component() const
Definition: DoFSpace.cc:248
DoFSpace(std::shared_ptr< Structure const > const &_shared_prim, DoFKey const &_dof_key, std::optional< Eigen::Matrix3l > const &_transformation_matrix_to_super=std::nullopt, std::optional< std::set< Index >> const &_sites=std::nullopt, std::optional< Eigen::MatrixXd > const &_basis=std::nullopt)
Definition: DoFSpace.cc:141
std::optional< std::set< Index > > const & sites() const
The sites included in a local DoF space. Has value for local DoF.
Definition: DoFSpace.cc:214
std::shared_ptr< Structure const > const & shared_prim() const
Shared prim structure.
Definition: DoFSpace.cc:199
std::vector< std::string > const & axis_glossary() const
Names the DoF corresponding to each dimension (row) of the basis.
Definition: DoFSpace.cc:236
DoFKey m_dof_key
Definition: DoFSpace.hh:122
std::shared_ptr< Structure const > m_shared_prim
Shared prim structure.
Definition: DoFSpace.hh:118
std::optional< std::vector< Index > > m_axis_dof_component
Definition: DoFSpace.hh:159
std::optional< Eigen::Matrix3l > m_transformation_matrix_to_super
Specifies the supercell for a local DoF space. Required for local DoF.
Definition: DoFSpace.hh:125
std::optional< std::set< Index > > m_sites
The sites included in a local DoF space. Required for local DoF.
Definition: DoFSpace.hh:128
Index dim() const
The DoF space dimension (equal to number of rows in basis).
Definition: DoFSpace.cc:230
Eigen::MatrixXd m_basis
Definition: DoFSpace.hh:132
DoFKey const & dof_key() const
Definition: DoFSpace.cc:205
std::optional< std::vector< Index > > m_axis_site_index
Definition: DoFSpace.hh:147
A class that collects all symmetry information for for performing symmetry transformations on the sit...
SymGroupRep is an alternative representation of a SymGroup for something other than real space....
Definition: SymGroupRep.hh:31
Type-safe ID object for communicating and accessing Symmetry representation info.
make_symmetry_adapted_dof_space_error(std::string _what)
Definition: DoFSpace.hh:240
BasicStructure specifies the lattice and atomic basis of a crystal.
Generic1DDatumFormatter< Eigen::VectorXd, ConfigEnumDataType > normal_coordinate()
ConfigIO::GenericConfigFormatter< jsonParser > config()
Definition: ConfigIO.cc:777
MatrixXiSupercellSymInfoFormatter transformation_matrix_to_super()
Main CASM namespace.
Definition: APICommand.hh:8
void set_dof_value(Configuration &config, DoFSpace const &dof_space, Eigen::VectorXd const &normal_coordinate)
Set config DoF value from a coordinate in the DoFSpace basis.
Definition: DoFSpace.cc:317
VectorSpaceSymReport vector_space_sym_report(DoFSpace const &dof_space, SupercellSymInfo const &sym_info, std::vector< PermuteIterator > const &group, bool calc_wedges=false)
Make VectorSpaceSymReport.
Definition: DoFSpace.cc:560
Eigen::VectorXd get_normal_coordinate(Configuration const &config, DoFSpace const &dof_space)
Return config DoF value as a coordinate in the DoFSpace basis.
Definition: DoFSpace.cc:284
Eigen::MatrixXd MatrixXd
DoFSpace exclude_homogeneous_mode_space(DoFSpace const &dof_space)
Removes the homogeneous mode space from the DoFSpace basis.
Definition: DoFSpace.cc:673
DoFSpace make_dof_space(DoFKey dof_key, ConfigEnumInput const &input_state, std::optional< Eigen::MatrixXd > const &basis=std::nullopt)
Definition: DoFSpace.cc:487
Index get_dof_space_dimension(DoFKey dof_key, xtal::BasicStructure const &prim, std::optional< Eigen::Matrix3l > const &transformation_matrix_to_super=std::nullopt, std::optional< std::set< Index >> const &sites=std::nullopt)
Return dimension of DoFSpace.
Definition: DoFSpace.cc:359
std::vector< std::string > make_dof_space_axis_glossary(DoFKey dof_key, xtal::BasicStructure const &prim, std::optional< Eigen::Matrix3l > const &transformation_matrix_to_super=std::nullopt, std::optional< std::set< Index >> const &sites=std::nullopt)
Make DoFSpace axis glossary.
void make_dof_space_axis_info(DoFKey dof_key, xtal::BasicStructure const &prim, std::optional< Eigen::Matrix3l > const &transformation_matrix_to_super, std::optional< std::set< Index >> const &sites, std::vector< std::string > &axis_glossary, std::optional< std::vector< Index >> &axis_site_index, std::optional< std::vector< Index >> &axis_dof_component)
Make DoFSpace axis glossary, axis site index, and axis dof component.
Definition: DoFSpace.cc:429
SymGroupRep const & make_dof_space_symrep(DoFSpace const &dof_space, SupercellSymInfo const &sym_info, std::vector< PermuteIterator > const &group, MasterSymGroup &symrep_master_group, SymGroupRepID &id)
Make a SymGroupRep for a DoFSpace.
Definition: DoFSpace.cc:513
std::string DoFKey
Definition: DoFDecl.hh:7
SymRepTools_v2::VectorSpaceSymReport vector_space_sym_report_v2(DoFSpace const &dof_space, SupercellSymInfo const &sym_info, std::vector< PermuteIterator > const &group, bool calc_wedges=false)
Make VectorSpaceSymReport.
Definition: DoFSpace.cc:585
void throw_if_invalid_dof_space(Configuration const &config, DoFSpace const &dof_space)
Throw if !is_valid_dof_space(config, dof_space)
Definition: DoFSpace.cc:272
bool is_valid_dof_space(Configuration const &config, DoFSpace const &dof_space)
Definition: DoFSpace.cc:257
Eigen::MatrixXd make_homogeneous_mode_space(DoFSpace const &dof_space)
Make the homogeneous mode space of a local DoFSpace.
Definition: DoFSpace.cc:740
DoFSpace make_symmetry_adapted_dof_space(DoFSpace const &dof_space, SupercellSymInfo const &sym_info, std::vector< PermuteIterator > const &group, bool calc_wedges, std::optional< VectorSpaceSymReport > &symmetry_report)
Make DoFSpace with symmetry adapated basis.
Definition: DoFSpace.cc:604
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39
Eigen::VectorXd VectorXd
DoFSpace make_symmetry_adapted_dof_space_v2(DoFSpace const &dof_space, SupercellSymInfo const &sym_info, std::vector< PermuteIterator > const &group, bool calc_wedges, std::optional< SymRepTools_v2::VectorSpaceSymReport > &symmetry_report)
Make DoFSpace with symmetry adapated basis.
Definition: DoFSpace.cc:635
Definition: stream_io.hh:24
Summary of data associated with the action of a symmetry group on a vector space.
A struct which gives out the mixing information of given column_vector_space and a subspace.
Definition: DoFSpace.hh:264
std::vector< Index > axes_not_in_subspace
Definition: DoFSpace.hh:267
std::vector< Index > axes_in_subspace
Definition: DoFSpace.hh:268
VectorSpaceMixingInfo(Eigen::MatrixXd const &column_vector_space, Eigen::MatrixXd const &subspace, double tol)
Definition: DoFSpace.cc:809
std::vector< Index > axes_mixed_with_subspace
Definition: DoFSpace.hh:269
Summary of data associated with the action of a symmetry group on a vector space.
Definition: SymRepTools.hh:185