CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Lattice_test.cpp
Go to the documentation of this file.
1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
3 
6 
10 
11 using namespace CASM;
12 
14 
15  double tol = 1e-5;
16 
17  {
18  SymGroup pg;
20  BOOST_CHECK_EQUAL(pg.size(), 48);
21  }
22  {
23  SymGroup pg;
25  BOOST_CHECK_EQUAL(pg.size(), 48);
26  }
27  {
28  SymGroup pg;
30  BOOST_CHECK_EQUAL(pg.size(), 48);
31  }
32  {
33  SymGroup pg;
35  BOOST_CHECK_EQUAL(pg.size(), 24);
36  }
37 }
38 
40 
41  double tol = TOL;
42 
43  {
44  SymGroup pg;
45  Lattice fcc = Lattice::fcc();
46  fcc.generate_point_group(pg, tol);
47 
48  for(const auto &op : pg) {
49  BOOST_CHECK_EQUAL(fcc.is_equivalent(copy_apply(op, fcc), tol), 1);
50  }
51  }
52  {
53  SymGroup pg;
54  Lattice bcc = Lattice::bcc();
55  bcc.generate_point_group(pg, tol);
56 
57  for(const auto &op : pg) {
58  BOOST_CHECK_EQUAL(bcc.is_equivalent(copy_apply(op, bcc), tol), 1);
59  }
60  }
61  {
62  SymGroup pg;
63  Lattice cubic = Lattice::cubic();
64  cubic.generate_point_group(pg, tol);
65 
66  for(const auto &op : pg) {
67  BOOST_CHECK_EQUAL(cubic.is_equivalent(copy_apply(op, cubic), tol), 1);
68  }
69  }
70  {
71  SymGroup pg;
73  hex.generate_point_group(pg, tol);
74 
75  for(const auto &op : pg) {
76  BOOST_CHECK_EQUAL(hex.is_equivalent(copy_apply(op, hex), tol), 1);
77  }
78  }
79 }
80 
82  std::stringstream lat_stream(" 2.5000\n"
83  " 1.1 1.2 1.3\n"
84  " 1.4 1.5 1.6\n"
85  " 1.7 1.8 1.9\n");
86  Lattice testlat;
87  testlat.read(lat_stream);
88  Eigen::Matrix3d latmat;
89  latmat <<
90  2.75, 3.5, 4.25,
91  3.0, 3.75, 4.5,
92  3.25, 4.0, 4.75;
93  BOOST_CHECK(almost_equal(testlat.lat_column_mat(), latmat, 1e-8));
94 
95 }
96 
98  //This point group will remain empty so that it checks more cases
99  SymGroup pg;
100  Lattice lat(Lattice::fcc());
101 
102  ScelEnumProps enum_props(1, 6);
103  SupercellEnumerator<Lattice> enumerator(lat, pg, enum_props);
104 
105  std::vector<Lattice> lat_list(enumerator.begin(), enumerator.end());
106 
107  for(auto it1 = lat_list.cbegin(); it1 != lat_list.cend(); ++it1) {
108  for(auto it2 = it1 + 1; it2 != lat_list.cend(); ++it2) {
109  Lattice sdlat = superdupercell(*it1, *it2);
110  BOOST_CHECK(sdlat.is_supercell_of(*it1));
111  BOOST_CHECK(sdlat.is_supercell_of(*it2));
112  }
113  }
114 
115 }
116 
117 
118 BOOST_AUTO_TEST_SUITE(LatticeTest)
119 
122 }
123 
124 BOOST_AUTO_TEST_CASE(PointGroupTest) {
125  lattice_pg_test();
126 }
127 
128 BOOST_AUTO_TEST_CASE(IsEquivalentTest) {
130 }
131 
132 BOOST_AUTO_TEST_CASE(SuperDuperTest) {
134 
135 }
136 
137 
138 BOOST_AUTO_TEST_SUITE_END()
Lattice superdupercell(const Lattice &lat1, const Lattice &lat2)
returns Lattice that is smallest possible supercell of both input Lattice
Definition: Lattice.cc:1161
void lattice_read_test()
Index size() const
Definition: Array.hh:145
void generate_point_group(SymGroup &point_group, double pg_tol=TOL) const
Populate.
Definition: Lattice.cc:304
static Lattice hexagonal()
Construct cubic primitive cell of unit volume.
Definition: Lattice.cc:75
bool is_equivalent(const Lattice &RHS, double tol) const
Are two lattices the same, even if they have different lattice vectors.
Definition: Lattice.cc:1002
Data structure for holding supercell enumeration properties.
Object copy_apply(const Transform &f, Object obj, Args &&...args)
void lattice_superduper_test()
const_iterator end() const
A const iterator to the past-the-last volume.
A fake container of supercell matrices.
Definition: Enumerator.hh:407
Main CASM namespace.
Definition: complete.cpp:8
static Lattice bcc()
Construct BCC primitive cell of unit volume.
Definition: Lattice.cc:57
const double TOL
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
Definition: Lattice.hh:104
void lattice_is_equivalent_test()
SymGroup is a collection of symmetry operations that satisfy the group property The symmetry operatio...
Definition: SymGroup.hh:33
double tol
const_iterator begin() const
A const iterator to the beginning volume, specify here how the iterator should jump through the enume...
static Lattice cubic()
Construct simple cubic primitive cell of unit volume.
Definition: Lattice.cc:69
void read(std::istream &stream)
Definition: Lattice.cc:116
BOOST_AUTO_TEST_CASE(ReadTest)
bool is_supercell_of(const Lattice &tile, Eigen::Matrix3d &multimat, double _tol=TOL) const
Matrix that relates two lattices (e.g., strain or slat)
Definition: Lattice.cc:655
Eigen::Matrix3d Matrix3d
void lattice_pg_test()
static Lattice fcc()
Construct FCC primitive cell of unit volume.
Definition: Lattice.cc:45
bool almost_equal(const GenericCluster< CoordType > &LHS, const GenericCluster< CoordType > &RHS, double tol)