CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Structure.hh
Go to the documentation of this file.
1 #ifndef STRUCTURE_HH
2 #define STRUCTURE_HH
3 
4 #include <iostream>
5 #include <cstdlib>
6 #include <cmath>
7 
10 
11 namespace CASM {
12  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 
15  class MasterSymGroup;
16 
17  class SiteCluster;
18 
19  template<typename ClustType>
20  class GenericOrbitree;
21 
22  typedef GenericOrbitree<SiteCluster> SiteOrbitree;
23 
28  class Structure : public BasicStructure<Site> {
30  protected: //PROTECTED DATA MEMBERS
31 
38  bool SD_flag;
39 
40  public: //PUBLIC DATA MEMBERS (Public for now)
41 
43  //std::string title; // user-specified name of this structure
44  //Lattice lattice; // Lattice vectors that specifies periodicity of the crystal
45  //Array<Site> basis; // List of basis sites of the crystal. Each site may host a molecule or a specie
46 
47 
48 
49  private: //PRIVATE METHODS
50 
51  void main_print(std::ostream &stream, COORD_TYPE mode, bool version5, int option) const;
52 
53 
54  public: //PUBLIC METHODS
55 
56  // ****Constructors****
58  explicit Structure(const Lattice &init_lat) : BasicStructure<Site>(init_lat) {}
59  explicit Structure(const BasicStructure<Site> &base) : BasicStructure<Site>(base) {}
60  explicit Structure(const fs::path &filepath);
61 
64  Structure(const Structure &RHS);
65 
66  // ****Inspectors/Accessors****
67  // - non-const versions try to populate data members before access
68  const MasterSymGroup &factor_group() const;
69  //const MasterSymGroup &factor_group();
70  const SymGroup &point_group() const;
71  //const SymGroup &point_group();
74 
75  std::vector<Specie> get_struc_specie() const;
76  std::vector<Molecule> get_struc_molecule() const;
77  std::vector<std::string> get_struc_molecule_name() const;
78  Eigen::VectorXi get_num_each_specie() const;
79  Eigen::VectorXi get_num_each_molecule() const;
80 
81  // ****Mutators****
82 
83  // - Basic assignment/bookkeeping
84 
87  Structure &operator=(const Structure &RHS);
88 
90  void copy_attributes_from(const Structure &RHS);
91 
93  void reset();
94 
98  void set_lattice(const Lattice &lattice, COORD_TYPE mode);
99 
100  // - Symmetry
101 
104  //Structure &apply_sym(const SymOp &op); //Anna do this
105 
108  void generate_factor_group(double map_tol = TOL) const; // TOL is max distance for site equivalence, in Angstr.
109 
111  void generate_factor_group_slow(double map_tol = TOL) const; // TOL is max distance for site equivalence, in Angstr.
112 
114  void fg_converge(double large_tol);
115  void fg_converge(double small_tol, double large_tol, double increment);
116 
118  SymGroupRepID generate_basis_permutation_representation(bool verbose = false) const;
119 
120  void symmetrize(const SymGroup &relaxed_factors);
121  void symmetrize(const double &tolerace);
122 
123 
126  //bool is_primitive(double prim_tol = TOL) const; //Donghee do this
127 
130  //bool is_primitive(Structure &new_prim, double prim_tol = TOL) const; //Donghee do this
131 
133  void fill_supercell(const Structure &prim, double map_tol = TOL); //Ivy
134 
136  Structure create_superstruc(const Lattice &scel_lat, double map_tol = TOL) const;
137 
139  void map_superstruc_to_prim(Structure &prim); //Added by Ivy 06/29/2013
140 
142  void set_occs(Array <int> occ_index);
143 
144  // - Cluster related routines
145 
150  void generate_basis_bouquet(const SiteOrbitree &in_tree, SiteOrbitree &out_tree, Index num_sites, double tol);
151 
156  void generate_asym_bouquet(const SiteOrbitree &in_tree, SiteOrbitree &out_tree, Index num_sites, double tol);
157 
158  //John G 230913
160  void generate_flowertrees_safe(const SiteOrbitree &in_tree, Array<SiteOrbitree> &out_trees, double tol = TOL);
161  void generate_flowertrees(const SiteOrbitree &in_tree, Array<SiteOrbitree> &out_trees, double tol = TOL);
162  //\John G 230913
163 
164 
165  //John G 051112
166  Structure stack_on(const Structure &understruc, bool override = 0) const;
167  //\John G 051112
168 
169  //John G 121212
171  Structure get_reflection() const;
173  void clump_atoms(double maxdist, double tol); //Only for same atom types
175  void sort_basis();
176  //\John G 121212
177 
178  //John G 050513
179  Structure stamp_with(SiteCluster stamp, bool lat_override = 0, bool im_override = 0) const;
180  Array<Structure> bedazzle(Array<SiteCluster> stamps, bool lat_override = 0, bool im_override = 0) const;
181  Array<Array<Array<double> > > get_NN_table(const double &maxr, SiteOrbitree &bouquet, double tol);
182  Array<Array<Array<double> > > get_NN_table(const double &maxr, double tol);
183  //\John G 050513
184 
186  void add_vacuum_shift(Structure &new_surface_struc, double vacuum_thickness, Eigen::Vector3d shift, COORD_TYPE mode) const;
187  void add_vacuum_shift(Structure &new_surface_struc, double vacuum_thickness, Coordinate shift) const; //Because Anton thought a coordinate would be better
189  void add_vacuum(Structure &new_surface_struc, double vacuum_thickness) const;
191  Structure &operator+=(const Coordinate &shift);
192  Structure &operator-=(const Coordinate &shift);
193 
196  void intpol(Structure end_struc, int Nofimag, PERIODICITY_TYPE mode, Array<Structure> &images);
197 
198  // ****Input/Output****
199 
201  void print_site_symmetry(std::ostream &stream, COORD_TYPE mode, int shorttag, double tol);
202  //void print_factor_group(std::ostream &stream) const;
203 
204  bool read_species(); //Ivy 11/27/12
205  void assign_species(Array<std::string> &names, Array<double> &masses, Array<double> &magmoms, Array<double> &Us, Array<double> &Js); //Added by Ivy
206 
207  jsonParser &to_json(jsonParser &json) const;
208  void from_json(const jsonParser &json);
209  };
210 
211  //Structure operator*(const SymOp &LHS, const Structure &RHS);
212 
213  jsonParser &to_json(const Structure &structure, jsonParser &json);
214  void from_json(Structure &structure, const jsonParser &json);
215 
216  Structure operator*(const Lattice &LHS, const Structure &RHS);
217 
218  //Translation operators -- not yet defined
219  Structure operator+(const Coordinate &LHS, const Structure &RHS);
220  Structure operator+(const Structure &LHS, const Coordinate &RHS);
221 
222  //Not yet sure how these will work
223  Structure operator+(const Structure &LHS, const Structure &RHS);
224  Structure operator+(const Structure &LHS, const Lattice &RHS);
225  Structure operator+(const Lattice &LHS, const Structure &RHS);
226 
227 
229 
232  std::vector< std::vector<Index> > get_index_converter(const Structure &struc, std::vector<Molecule> mol_list);
233 
236  std::vector< std::vector<Index> > get_index_converter(const Structure &struc, std::vector<std::string> mol_name_list);
237 
240  std::vector< std::vector<Index> > get_index_converter_inverse(const Structure &struc, std::vector<std::string> mol_name_list);
241 
243 };
244 
245 //#include "casm/clusterography/Orbitree_impl.hh"
246 
247 #endif
SymGroupRepID basis_permutation_symrep_ID() const
Definition: Structure.cc:113
Structure(const Lattice &init_lat)
Definition: Structure.hh:58
MasterSymGroup m_factor_group
Definition: Structure.hh:34
void from_json(ClexDescription &desc, const jsonParser &json)
Type-safe ID object for communicating and accessing Symmetry representation info. ...
void generate_flowertrees_safe(const SiteOrbitree &in_tree, Array< SiteOrbitree > &out_trees, double tol=TOL)
Gets clusters of every size radiating from one site and saves them to a flowertree. A garland for each site is constructed.
Definition: Structure.cc:562
const SymGroup & point_group() const
Definition: Structure.cc:101
Structure & operator+=(const Coordinate &shift)
Translates all atoms in cell.
Definition: Structure.cc:1201
Structure specifies the lattice and atomic basis of a crystal.
Definition: Structure.hh:29
jsonParser & to_json(const ClexDescription &desc, jsonParser &json)
SymGroupRepID generate_basis_permutation_representation(bool verbose=false) const
Obtain the basis permutation representation of factor_group, returns its rep_id, and sets internal ba...
Definition: Structure.cc:1182
void generate_factor_group_slow(double map_tol=TOL) const
Obtain factor group by testing all operations of the lattice point_group and keep.
Definition: Structure.cc:77
void copy_attributes_from(const Structure &RHS)
copy all non-derived members
Definition: Structure.cc:62
void generate_flowertrees(const SiteOrbitree &in_tree, Array< SiteOrbitree > &out_trees, double tol=TOL)
Definition: Structure.cc:410
BasicStructure specifies the lattice and atomic basis of a crystal.
Definition: Cluster.hh:16
std::vector< Molecule > get_struc_molecule() const
Returns an Array of each possible Molecule in this Structure.
Definition: Structure.cc:146
Structure stack_on(const Structure &understruc, bool override=0) const
Definition: Structure.cc:692
void main_print(std::ostream &stream, COORD_TYPE mode, bool version5, int option) const
*** Inherited from BasicStructure
void fg_converge(double large_tol)
generate factor groups for a range of tol values, prints results to screen (for now) ...
Definition: Structure.cc:231
Main CASM namespace.
Definition: complete.cpp:8
const Lattice & lattice() const
const double TOL
void symmetrize(const SymGroup &relaxed_factors)
Definition: Structure.cc:1022
GenericCluster< CoordType > operator+(const GenericCluster< CoordType > &LHS, const Coordinate &RHS)
create translated cluster
void sort_basis()
Rearrange basis by grouping atoms by type.
Definition: Structure.cc:858
void generate_factor_group(double map_tol=TOL) const
Definition: Structure.cc:85
SymGroupRepID basis_perm_rep_ID
This holds the representation id of the permutation representation.
Definition: Structure.hh:36
std::vector< std::string > get_struc_molecule_name() const
Returns an Array of each possible Molecule in this Structure.
Definition: Structure.cc:166
SymGroupRep const * basis_permutation_symrep() const
Definition: Structure.cc:107
bool SD_flag
Specifies whether selectice dynamics is on or of for DFT calculations.
Definition: Structure.hh:38
void reset()
clears symmetry, site internals, and other attributes
Definition: Structure.cc:385
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:33
double tol
Structure(const BasicStructure< Site > &base)
Definition: Structure.hh:59
GenericOrbitree< SiteCluster > SiteOrbitree
Definition: Clex.hh:14
void assign_species(Array< std::string > &names, Array< double > &masses, Array< double > &magmoms, Array< double > &Us, Array< double > &Js)
const MasterSymGroup & factor_group() const
Definition: Structure.cc:94
BasisSet operator*(const SymOp &LHS, const BasisSet &RHS)
Definition: BasisSet.cc:1154
Represents cartesian and fractional coordinates.
Definition: Coordinate.hh:34
void add_vacuum_shift(Structure &new_surface_struc, double vacuum_thickness, Eigen::Vector3d shift, COORD_TYPE mode) const
Add vacuum and shift c vector. The vacuum is always added parallel to c, and the shift vector should ...
Definition: Structure.cc:1088
EigenIndex Index
For long integer indexing:
Structure & operator-=(const Coordinate &shift)
Definition: Structure.cc:1213
void fill_supercell(const Structure &prim, double map_tol=TOL)
fill an empty structure with the basis of its corresponding primitive cell - performs optimized facto...
Definition: Structure.cc:263
void from_json(const jsonParser &json)
Definition: Structure.cc:1241
void add_vacuum(Structure &new_surface_struc, double vacuum_thickness) const
Adds vacuum layer on top of ab plane.
Definition: Structure.cc:1117
void generate_basis_bouquet(const SiteOrbitree &in_tree, SiteOrbitree &out_tree, Index num_sites, double tol)
Definition: Structure.cc:446
Structure stamp_with(SiteCluster stamp, bool lat_override=0, bool im_override=0) const
Definition: Structure.cc:888
void set_lattice(const Lattice &lattice, COORD_TYPE mode)
Definition: Structure.cc:664
void generate_asym_bouquet(const SiteOrbitree &in_tree, SiteOrbitree &out_tree, Index num_sites, double tol)
Definition: Structure.cc:501
Structure create_superstruc(const Lattice &scel_lat, double map_tol=TOL) const
Shortcut routine to create a supercell structure and fill it with sites.
Definition: Structure.cc:335
std::vector< std::vector< Index > > get_index_converter(const Structure &struc, std::vector< Molecule > mol_list)
Helper Functions.
Definition: Structure.cc:1297
Structure get_reflection() const
Return reflection of structure.
Definition: Structure.cc:769
void intpol(Structure end_struc, int Nofimag, PERIODICITY_TYPE mode, Array< Structure > &images)
Definition: Structure.cc:1139
std::vector< Specie > get_struc_specie() const
Returns an Array of each possible Specie in this Structure.
Definition: Structure.cc:123
Array< Array< Array< double > > > get_NN_table(const double &maxr, SiteOrbitree &bouquet, double tol)
Definition: Structure.cc:965
Array< Structure > bedazzle(Array< SiteCluster > stamps, bool lat_override=0, bool im_override=0) const
Definition: Structure.cc:945
Structure & operator=(const Structure &RHS)
Definition: Structure.cc:40
void set_occs(Array< int > occ_index)
Setting the current occupants of the structure to those specified by an array of integers.
Definition: Structure.cc:1190
Eigen::VectorXi get_num_each_molecule() const
Definition: Structure.cc:206
std::vector< std::vector< Index > > get_index_converter_inverse(const Structure &struc, std::vector< std::string > mol_name_list)
Definition: Structure.cc:1335
void map_superstruc_to_prim(Structure &prim)
Figures out which prim basis each superstructure basis corresponds to.
Definition: Structure.cc:605
SymGroupRep is an alternative representation of a SymGroup for something other than real space...
Definition: SymGroupRep.hh:30
void print_site_symmetry(std::ostream &stream, COORD_TYPE mode, int shorttag, double tol)
For each symmetrically distinct site, print the symmetry operations that map it onto itself...
Definition: Structure.cc:348
void clump_atoms(double maxdist, double tol)
If atoms are too close together, average their distance and make them one.
Definition: Structure.cc:793
jsonParser & to_json(jsonParser &json) const
Definition: Structure.cc:1224
Eigen::VectorXi get_num_each_specie() const
Definition: Structure.cc:184