1 #define BOOST_TEST_DYN_LINK
2 #include <boost/test/unit_test.hpp>
13 BOOST_AUTO_TEST_SUITE(NeighborListTest)
17 std::set<int> sublat_indices;
18 for(
int i = 0; i < prim.
basis.
size(); i++) {
19 sublat_indices.insert(i);
25 sublat_indices.begin(),
34 BOOST_CHECK_EQUAL(nlist.weight_matrix() == W,
true);
37 std::set<UnitCellCoord> nbors;
39 nlist.
expand(nbors.begin(), nbors.end());
42 BOOST_CHECK_EQUAL(nlist.size(), 177);
46 BOOST_CHECK_EQUAL(nlist2.size(), 177);
50 BOOST_CHECK_EQUAL(ptr1->size(), 177);
51 std::unique_ptr<PrimNeighborList> ptr2 = nlist.clone();
52 BOOST_CHECK_EQUAL(ptr2->size(), 177);
58 std::set<int> sublat_indices;
59 for(
int i = 0; i < prim.
basis.
size(); i++) {
60 sublat_indices.insert(i);
66 sublat_indices.begin(),
71 std::set<UnitCellCoord> nbors;
73 nlist.
expand(nbors.begin(), nbors.end());
76 BOOST_CHECK_EQUAL(nlist.size(), 177);
88 for(
int i = 0; i < grid.size(); ++i) {
89 BOOST_CHECK_EQUAL(super_nlist.sites(i).size(), 177);
92 for(
int i = 0; i < grid.size(); ++i) {
93 BOOST_CHECK_EQUAL(super_nlist.unitcells(i).size(), 177);
97 BOOST_CHECK_EQUAL(super_nlist.overlaps(),
true);
104 std::unique_ptr<SuperNeighborList> ptr2 = super_nlist.clone();
112 latvec.col(0) << 2.955270000000, 0.000000000000, 0.000000000000;
113 latvec.col(1) << 1.477635000000, 2.559338895042, 0.000000000000;
114 latvec.col(2) << 1.477635000000, 0.853112965014, 11.758280000000;
119 W_check.row(0) << 2, 1, 1;
120 W_check.row(1) << 1, 2, 1;
121 W_check.row(2) << 1, 1, 32;
123 BOOST_CHECK_EQUAL(W == W_check,
true);
151 std::set<UnitCellCoord> nbors;
155 nlist.expand(nbors.begin(), nbors.end());
156 BOOST_CHECK_EQUAL(nlist.size(), 177);
161 nlist.expand(nbors.begin(), nbors.end());
162 BOOST_CHECK_EQUAL(nlist.size(), 381);
166 BOOST_AUTO_TEST_SUITE_END()
Eigen::Matrix3l nlist_weight_matrix() const
Get neighbor list weight matrix.
BOOST_AUTO_TEST_CASE(PrimNeighborListBasics)
Structure specifies the lattice and atomic basis of a crystal.
Lattice make_supercell(const Lattice &lat, const Eigen::Matrix3i &transf_mat)
Returns a super Lattice.
const std::set< int > & nlist_sublat_indices() const
Get set of sublattice indices to include in neighbor lists.
const Lattice & lattice() const
void expand(UnitCellCoord uccoord)
Expand the neighbor list to include the given UnitCellCoord.
const Eigen::Matrix3d & lat_column_mat() const
3x3 matrix with lattice vectors as its columne
The SuperNeighborList gives the linear indices of neighboring sites and unitcells in a particular Sup...
bool set_crystallography_tol(double _tol)
Set crystallography tolerance.
double crystallography_tol() const
Read/modify settings of an already existing CASM project.
OutputIterator neighborhood(OutputIterator result, const TreeType &tree, const StrucType &struc, double tol)
Iterate over all sites in an orbitree and insert a UnitCellCoord.
BasicStructure< Site > FCC_ternary_prim()
Array< CoordType > basis
Lattice vectors that specifies periodicity of the crystal.
ProjectSettings & settings()
PrimClex is the top-level data structure for a CASM project.
static Matrix3Type make_weight_matrix(const Eigen::Matrix3d lat_column_mat, Index max_element_value, double tol)
Returns a NeighborList weighting matrix appropriate for a particular lattice.
The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell...
static jsonParser bspecs()
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
Matrix< long int, 3, 3 > Matrix3l
Eigen::Matrix3l Matrix3Type
SiteOrbitree make_orbitree(Structure &prim, const jsonParser &json, double _tol)
Make orbitree. For now specifically global.
virtual void check_init()
Check project initialization.
const Structure & get_prim() const
const Access to primitive Structure