CASM  1.1.0
A Clusters Approach to Statistical Mechanics
Structure.hh
Go to the documentation of this file.
1 #ifndef STRUCTURE_HH
2 #define STRUCTURE_HH
3 
4 #include <cmath>
5 #include <cstdlib>
6 #include <iostream>
7 #include <memory>
8 #include <unordered_map>
9 #include <vector>
10 
15 
16 namespace CASM {
17 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 
20 // template<typename ClustType>
21 // class GenericOrbitree;
22 
23 // typedef GenericOrbitree<SiteCluster> SiteOrbitree;
24 
30 class Structure {
31  private:
32  // TODO: Collect all the symmetry information and package it into a
33  // StructureSymInfo class or the like. Then store alongside the BasicStructure
34  // as a shared pointer. This will save you regenerating the factor group each
35  // time you make a copy of *this. It'll also make the custom copy constructor
36  // and assignment operators unnecessary.
37 
41 
44 
46  std::vector<SymGroupRepID> m_occupant_symrep_IDs;
47 
50  std::vector<std::map<DoFKey, SymGroupRepID>> m_site_dof_symrep_IDs;
51 
54  std::unordered_map<std::string, SymGroupRepID> m_global_dof_symrep_IDs;
55 
56  // Flushes out every SymGroupRepID for each site (occupant DoF) and gives it a
57  // default value of identity
59 
60  // Flushes out every SymGroupRepID for each site (continuous DoF) and gives it
61  // a default values
63 
67 
70 
71  void _fg_converge(SymGroup &factor_group, double small_tol, double large_tol,
72  double increment);
73 
77  void generate_factor_group(); // TOL is max distance for site equivalence, in
78  // Angstr.
79 
81  void copy_attributes_from(const Structure &RHS);
82 
83  // Don't ever even think about making this non-const, assignable or modifiable
84  // in any way.
85  std::shared_ptr<const xtal::BasicStructure> m_structure_ptr;
86 
87  public:
88  // TODO: Do we even want automatic conversion?
90  operator const xtal::BasicStructure &() const;
91 
93  return *this->m_structure_ptr;
94  }
95 
96  const std::shared_ptr<const xtal::BasicStructure> &shared_structure() const {
97  return this->m_structure_ptr;
98  }
99 
100  const Lattice &lattice() const { return this->structure().lattice(); }
101 
102  const std::vector<xtal::Site> &basis() const {
103  return this->structure().basis();
104  }
105 
106  // TODO: I tried getting rid of this but it seems to get used in almost every
107  // casm command right now
108  Structure();
109  explicit Structure(const xtal::BasicStructure &base);
110  explicit Structure(const fs::path &filepath);
111 
114  Structure(const Structure &RHS);
115 
117 
118  const MasterSymGroup &factor_group() const;
119  const SymGroup &point_group() const;
120  SymGroupRep const *basis_permutation_symrep() const;
122  std::vector<SymGroupRepID> occupant_symrep_IDs() const;
123  std::vector<std::map<DoFKey, SymGroupRepID>> site_dof_symrep_IDs() const;
124  SymGroupRepID global_dof_symrep_ID(const std::string dof_name) const;
125 
128  Structure &operator=(const Structure &RHS);
129 };
130 
134 std::vector<std::vector<Index>> make_index_converter(
135  const Structure &struc, std::vector<xtal::Molecule> mol_list);
136 
140 std::vector<std::vector<Index>> make_index_converter(
141  const Structure &struc, std::vector<std::string> mol_name_list);
142 
146 std::vector<std::vector<Index>> make_index_converter_inverse(
147  const Structure &struc, std::vector<std::string> mol_name_list);
148 
149 //************************************************************************************
150 
151 struct DoFSetInfo;
152 
153 std::map<DoFKey, CASM::DoFSetInfo> global_dof_info(Structure const &_struc);
154 
155 std::map<DoFKey, std::vector<CASM::DoFSetInfo>> local_dof_info(
156  Structure const &_struc);
157 
158 class SupercellSymInfo;
159 SupercellSymInfo make_supercell_sym_info(Structure const &prim,
160  Lattice const &super_lattice);
161 
163 } // namespace CASM
164 
165 #endif
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:30
SymGroupRepID m_basis_perm_rep_ID
This holds the representation id of the permutation representation.
Definition: Structure.hh:43
std::vector< SymGroupRepID > m_occupant_symrep_IDs
Hold the SymRepIDs for the occupant DoF, one for each of the basis sites.
Definition: Structure.hh:46
const xtal::BasicStructure & structure() const
Definition: Structure.hh:92
std::vector< std::map< DoFKey, SymGroupRepID > > site_dof_symrep_IDs() const
Definition: Structure.cc:132
void _generate_global_symreps()
Obtain global dof symreps of factor_group.
Definition: Structure.cc:275
const SymGroup & point_group() const
Definition: Structure.cc:110
const Lattice & lattice() const
Definition: Structure.hh:100
SymGroupRep const * basis_permutation_symrep() const
Definition: Structure.cc:116
std::shared_ptr< const xtal::BasicStructure > m_structure_ptr
Definition: Structure.hh:85
MasterSymGroup m_factor_group
Definition: Structure.hh:40
const std::vector< xtal::Site > & basis() const
Definition: Structure.hh:102
void generate_factor_group()
Definition: Structure.cc:88
void _generate_basis_symreps()
Definition: Structure.cc:162
SymGroupRepID global_dof_symrep_ID(const std::string dof_name) const
Definition: Structure.cc:137
void _reset_site_dof_symrep_IDs()
Definition: Structure.cc:151
void _fg_converge(SymGroup &factor_group, double small_tol, double large_tol, double increment)
std::vector< std::map< DoFKey, SymGroupRepID > > m_site_dof_symrep_IDs
Definition: Structure.hh:50
void copy_attributes_from(const Structure &RHS)
copy all non-derived members
Definition: Structure.cc:79
Structure & operator=(const Structure &RHS)
Definition: Structure.cc:69
const MasterSymGroup & factor_group() const
Definition: Structure.cc:107
SymGroupRepID basis_permutation_symrep_ID() const
Definition: Structure.cc:122
const std::shared_ptr< const xtal::BasicStructure > & shared_structure() const
Definition: Structure.hh:96
std::unordered_map< std::string, SymGroupRepID > m_global_dof_symrep_IDs
Definition: Structure.hh:54
std::vector< SymGroupRepID > occupant_symrep_IDs() const
Definition: Structure.cc:128
void _reset_occupant_symrep_IDs()
Definition: Structure.cc:142
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:42
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.
BasicStructure specifies the lattice and atomic basis of a crystal.
const Lattice & lattice() const
const std::vector< Site > & basis() const
Main CASM namespace.
Definition: APICommand.hh:8
std::vector< std::vector< Index > > make_index_converter(const Structure &struc, std::vector< xtal::Molecule > mol_list)
Definition: Structure.cc:322
std::vector< std::vector< Index > > make_index_converter_inverse(const Structure &struc, std::vector< std::string > mol_name_list)
Definition: Structure.cc:363
std::map< DoFKey, std::vector< CASM::DoFSetInfo > > local_dof_info(Structure const &_struc)
Definition: Structure.cc:395
SupercellSymInfo make_supercell_sym_info(Structure const &prim, Lattice const &super_lattice)
Definition: Structure.cc:419
std::map< DoFKey, CASM::DoFSetInfo > global_dof_info(Structure const &_struc)
Definition: Structure.cc:384