CASM  1.1.0
A Clusters Approach to Statistical Mechanics
BasicStructure.hh
Go to the documentation of this file.
1 #ifndef BASICSTRUCTURE_HH
2 #define BASICSTRUCTURE_HH
3 
4 #include <cmath>
5 #include <cstdlib>
6 #include <iostream>
7 #include <istream>
8 #include <string>
9 #include <vector>
10 
16 #include "casm/global/enum.hh"
17 
18 namespace CASM {
19 namespace xtal {
20 
21 class Coordinate;
22 class UnitCellCoord;
23 class Molecule;
24 
33  protected:
35 
37  std::string m_title;
38 
40  std::vector<Site> m_basis;
41 
43  std::map<DoFKey, DoFSet> m_global_dof_map;
44 
45  private:
46  void main_print(std::ostream &stream, COORD_TYPE mode, bool version5,
47  int option) const;
48 
49  // TODO: Extract
50  // CASM canonical input/output
51  void read(std::istream &stream, double tol = TOL); // John do this
52 
53  public:
54  // ****Constructors****
55  BasicStructure(const Lattice &init_lat) : m_lattice(init_lat){};
56  BasicStructure() : m_lattice(){}; // added by Ivy (do we need/want this??)
57 
60  BasicStructure(const BasicStructure &RHS);
61 
62  static BasicStructure from_poscar_stream(std::istream &poscar_stream,
63  double tol = TOL);
64 
66 
67  // ****Inspectors/Accessors****
68 
69  const Lattice &lattice() const { return m_lattice; }
70 
71  const std::vector<Site> &basis() const { return m_basis; }
72 
73  std::vector<Site> &set_basis() { return m_basis; }
74 
75  const std::string &title() const { return m_title; }
76 
77  DoFSet const &global_dof(std::string const &dof_type) const;
78 
79  std::map<DoFKey, DoFSet> const &global_dofs() const {
80  return m_global_dof_map;
81  }
82 
86 
88  void within();
89 
95  void set_lattice(const Lattice &lattice, COORD_TYPE mode);
96 
98  void set_title(std::string const &_title);
99 
101  void set_global_dofs(std::map<DoFKey, DoFSet> const &new_dof_map) {
102  m_global_dof_map = new_dof_map;
103  }
104 
106  void set_global_dofs(std::vector<DoFSet> const &new_dof_vec) {
107  m_global_dof_map = make_dofset_map(new_dof_vec);
108  }
109 
111  void set_basis(std::vector<Site> const &_basis, COORD_TYPE mode = CART);
112 
114  void push_back(Site const &_site, COORD_TYPE mode = CART);
115 
117  bool is_time_reversal_active() const;
118 
120  BasicStructure &operator+=(const Coordinate &shift);
121  BasicStructure &operator-=(const Coordinate &shift);
122 
125 
126  // TODO: Extract
128  void print_xyz(std::ostream &stream, bool frac = false) const;
129 };
130 
131 /* BasicStructure operator*(const Lattice &LHS, const BasicStructure &RHS); */
132 
134 std::vector<UnitCellCoord> symop_site_map(SymOp const &_op,
135  BasicStructure const &_struc);
136 
138 template <typename ExternSymOp>
139 std::vector<UnitCellCoord> symop_site_map(ExternSymOp const &_op,
140  BasicStructure const &_struc) {
142 }
143 
145 std::vector<UnitCellCoord> symop_site_map(SymOp const &_op,
146  BasicStructure const &_struc,
147  double _tol);
148 
150 template <typename ExternSymOp>
151 std::vector<UnitCellCoord> symop_site_map(ExternSymOp const &_op,
152  BasicStructure const &_struc,
153  double _tol) {
155  _tol);
156 }
157 
159 std::vector<Molecule> struc_molecule(BasicStructure const &_struc);
160 
162 std::vector<std::string> struc_species(BasicStructure const &_struc);
163 
165 std::vector<std::string> struc_molecule_name(BasicStructure const &_struc);
166 
168 std::vector<std::vector<std::string> > allowed_molecule_unique_names(
169  BasicStructure const &_struc);
170 
172 std::vector<std::vector<std::string> > allowed_molecule_names(
173  BasicStructure const &_struc);
174 
175 std::vector<DoFKey> all_local_dof_types(BasicStructure const &_struc);
176 
177 std::vector<DoFKey> continuous_local_dof_types(BasicStructure const &_struc);
178 
179 std::vector<DoFKey> global_dof_types(BasicStructure const &_struc);
180 
181 std::vector<DoFKey> all_dof_types(BasicStructure const &_struc);
182 
183 std::map<DoFKey, Index> local_dof_dims(BasicStructure const &_struc);
184 
185 std::map<DoFKey, Index> global_dof_dims(BasicStructure const &_struc);
186 
187 Index local_dof_dim(DoFKey const &_name, BasicStructure const &_struc);
188 
190 
192 
193 std::string get_strain_metric(DoFKey strain_dof_key);
194 
196 } // namespace xtal
197 } // namespace CASM
198 
199 #endif
SymOp is the Coordinate representation of a symmetry operation it keeps fraction (FRAC) and Cartesian...
Definition: SymOp.hh:28
BasicStructure specifies the lattice and atomic basis of a crystal.
void set_lattice(const Lattice &lattice, COORD_TYPE mode)
BasicStructure & operator+=(const Coordinate &shift)
Translates all atoms in cell.
BasicStructure & operator-=(const Coordinate &shift)
Index max_possible_vacancies() const
Counts sites that allow vacancies.
std::map< DoFKey, DoFSet > const & global_dofs() const
static BasicStructure from_poscar_stream(std::istream &poscar_stream, double tol=TOL)
std::vector< Site > & set_basis()
const std::string & title() const
void main_print(std::ostream &stream, COORD_TYPE mode, bool version5, int option) const
std::string m_title
User-specified name of this Structure.
std::vector< Site > m_basis
Lattice vectors that specifies periodicity of the crystal.
void read(std::istream &stream, double tol=TOL)
void set_title(std::string const &_title)
Set the title of the structure.
void set_global_dofs(std::vector< DoFSet > const &new_dof_vec)
Manually set the global DoFs.
void print_xyz(std::ostream &stream, bool frac=false) const
Output other formats.
void within()
Translate all basis sites so that they are inside the unit cell.
const Lattice & lattice() const
void push_back(Site const &_site, COORD_TYPE mode=CART)
Manually set the basis sites.
DoFSet const & global_dof(std::string const &dof_type) const
std::map< DoFKey, DoFSet > m_global_dof_map
continuous global degrees of freedom
bool is_time_reversal_active() const
Returns true if structure has attributes affected by time reversal.
BasicStructure(const Lattice &init_lat)
void set_global_dofs(std::map< DoFKey, DoFSet > const &new_dof_map)
Manually set the global DoFs.
const std::vector< Site > & basis() const
BasicStructure & operator=(const BasicStructure &RHS)
Represents cartesian and fractional coordinates.
Definition: Coordinate.hh:34
std::vector< DoFKey > all_local_dof_types(BasicStructure const &_struc)
std::vector< Molecule > struc_molecule(BasicStructure const &_struc)
Returns an Array of each possible Molecule in this Structure.
std::vector< DoFKey > all_dof_types(BasicStructure const &_struc)
std::vector< std::vector< std::string > > allowed_molecule_names(BasicStructure const &_struc)
Returns a vector with a list of allowed molecule names at each site.
bool has_strain_dof(BasicStructure const &structure)
std::vector< std::string > struc_species(BasicStructure const &_struc)
Returns an Array of each possible AtomSpecie in this Structure.
std::vector< std::vector< std::string > > allowed_molecule_unique_names(BasicStructure const &_struc)
Returns an Array of each possible Molecule in this Structure.
std::vector< DoFKey > continuous_local_dof_types(BasicStructure const &_struc)
std::vector< UnitCellCoord > symop_site_map(SymOp const &_op, BasicStructure const &_struc)
To which site a SymOp transforms each basis site.
DoFKey get_strain_dof_key(BasicStructure const &structure)
std::vector< std::string > struc_molecule_name(BasicStructure const &_struc)
Returns an Array of each possible Molecule in this Structure.
Index local_dof_dim(DoFKey const &_name, BasicStructure const &_struc)
std::map< DoFKey, Index > local_dof_dims(BasicStructure const &_struc)
std::vector< DoFKey > global_dof_types(BasicStructure const &_struc)
std::map< DoFKey, Index > global_dof_dims(BasicStructure const &_struc)
std::string get_strain_metric(DoFKey strain_dof_key)
ConfigIO::GenericConfigFormatter< jsonParser > structure()
Definition: ConfigIO.cc:766
std::map< std::string, DoFSetType > make_dofset_map(std::vector< DoFSetType > const &dofset_vec)
Definition: DoFSet.hh:130
Main CASM namespace.
Definition: APICommand.hh:8
COORD_TYPE
Definition: enum.hh:6
const double TOL
Definition: definitions.hh:30
std::string DoFKey
Definition: DoFDecl.hh:7
INDEX_TYPE Index
For long integer indexing:
Definition: definitions.hh:39