CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ScelDatabaseTools.cc
Go to the documentation of this file.
2 
3 #include "casm/clex/PrimClex.hh"
6 
7 namespace CASM {
8 namespace DB {
9 
10 // /// Return const reference to canonical equivalent supercell in the supercell
11 // database
12 // ///
13 // /// Note:
14 // /// - Will insert the canonical supercell into "supercell_db"
15 // /// - The resulting Supercell will have a `PrimClex const*` (this will be
16 // deprecated) Supercell const &canonical_supercell(
17 // Supercell const &supercell,
18 // PrimClex const *primclex,
19 // Database<Supercell> &supercell_db) {
20 // return *(make_canonical_and_insert(
21 // primclex,
22 // supercell.sym_info().supercell_lattice(),
23 // supercell_db).first);
24 // }
25 //
26 // /// Make canonical supercell and insert into supercell database
27 // std::pair<Database<Supercell>::iterator, bool> make_canonical_and_insert(
28 // PrimClex const *primclex,
29 // Lattice const &super_lattice,
30 // Database<Supercell> &supercell_db) {
31 //
32 // auto const &prim = primclex->prim();
33 // auto const &pg = prim.point_group();
34 // double xtal_tol = prim.lattice().tol();
35 // xtal::Lattice canonical_lattice =
36 // xtal::canonical::equivalent(super_lattice, pg, xtal_tol); return
37 // supercell_db.emplace(primclex, canonical_lattice);
38 // }
39 //
40 // /// Make canonical supercell and insert into supercell database
41 // std::pair<Database<Supercell>::iterator, bool> make_canonical_and_insert(
42 // PrimClex const *primclex,
43 // Eigen::Matrix3l const &transformation_matrix_to_super,
44 // Database<Supercell> &supercell_db) {
45 // auto const &prim = primclex->prim();
46 // xtal::Lattice super_lattice = make_superlattice(prim.lattice(),
47 // transformation_matrix_to_super); return make_canonical_and_insert(primclex,
48 // super_lattice, supercell_db);
49 // }
50 
58 Supercell const &canonical_supercell(Supercell const &supercell,
59  Database<Supercell> &supercell_db) {
60  return *(make_canonical_and_insert(supercell.shared_prim(),
61  supercell.sym_info().supercell_lattice(),
62  supercell_db)
63  .first);
64 }
65 
67 std::pair<Database<Supercell>::iterator, bool> make_canonical_and_insert(
68  std::shared_ptr<Structure const> const &shared_prim,
69  Lattice const &super_lattice, Database<Supercell> &supercell_db) {
70  auto const &pg = shared_prim->point_group();
71  double xtal_tol = shared_prim->lattice().tol();
72  xtal::Lattice canonical_lattice =
73  xtal::canonical::equivalent(super_lattice, pg, xtal_tol);
74  return supercell_db.emplace(shared_prim, canonical_lattice);
75 }
76 
78 std::pair<Database<Supercell>::iterator, bool> make_canonical_and_insert(
79  std::shared_ptr<Structure const> const &shared_prim,
81  Database<Supercell> &supercell_db) {
82  xtal::Lattice super_lattice =
84  return make_canonical_and_insert(shared_prim, super_lattice, supercell_db);
85 }
86 
88 std::pair<Database<Supercell>::iterator, bool> make_canonical_and_insert(
89  Supercell const &supercell, Database<Supercell> &supercell_db) {
90  return make_canonical_and_insert(supercell.shared_prim(), supercell.lattice(),
91  supercell_db);
92 }
93 
94 } // namespace DB
95 } // namespace CASM
std::shared_ptr< Structure const > shared_prim
std::pair< iterator, bool > emplace(Args &&... args)
Definition: ScelDatabase.hh:49
Represents a supercell of the primitive parent crystal structure.
Definition: Supercell.hh:51
const Lattice & lattice() const
The super lattice.
Definition: Supercell.cc:239
std::shared_ptr< Structure const > const & shared_prim() const
Definition: Supercell.cc:115
const SupercellSymInfo & sym_info() const
Definition: Supercell.cc:265
const xtal::Lattice & supercell_lattice() const
const reference to supercell lattice
Lattice make_superlattice(const Lattice &lat, const Eigen::Matrix< IntegralType, 3, 3, Options > &transf_mat)
Returns a super Lattice. Transformation matrix must be integer.
Definition: Lattice.hh:287
Supercell const & canonical_supercell(Supercell const &supercell, Database< Supercell > &supercell_db)
ConfigInsertResult make_canonical_and_insert(Configuration const &configuration, Database< Supercell > &supercell_db, Database< Configuration > &configuration_db, bool primitive_only)
Insert this configuration (in primitive & canonical form) in the database.
MatrixXiSupercellSymInfoFormatter transformation_matrix_to_super()
Lattice equivalent(Lattice const &in_lat, SymOpVector const &point_grp, double compare_tol)
Main CASM namespace.
Definition: APICommand.hh:8
Matrix< long int, 3, 3 > Matrix3l
Definition: eigen.hh:12