Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
a2853ab7
Commit
a2853ab7
authored
7 years ago
by
anikhalder
Browse files
Options
Downloads
Patches
Plain Diff
Update and Add FCCLattice Test
parent
f622c16f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/UnitTests/Core/Sample/LatticeTest.h
+82
-15
82 additions, 15 deletions
Tests/UnitTests/Core/Sample/LatticeTest.h
with
82 additions
and
15 deletions
Tests/UnitTests/Core/Sample/LatticeTest.h
+
82
−
15
View file @
a2853ab7
...
...
@@ -12,6 +12,7 @@ class LatticeTest : public ::testing::Test
virtual
~
LatticeTest
(){}
};
// tests the declaration of Lattice object, copy constructor and the getBasisVector_() functions
TEST_F
(
LatticeTest
,
declarationTest
)
{
...
...
@@ -32,8 +33,15 @@ TEST_F(LatticeTest, declarationTest)
EXPECT_EQ
(
a1
,
l3
.
getBasisVectorA
());
EXPECT_EQ
(
a2
,
l3
.
getBasisVectorB
());
EXPECT_EQ
(
a3
,
l3
.
getBasisVectorC
());
// calls and tests copy constructor
Lattice
l4
=
l3
;
EXPECT_EQ
(
a1
,
l4
.
getBasisVectorA
());
EXPECT_EQ
(
a2
,
l4
.
getBasisVectorB
());
EXPECT_EQ
(
a3
,
l4
.
getBasisVectorC
());
}
// tests volume of the unit cell
TEST_F
(
LatticeTest
,
volumeTest
)
{
...
...
@@ -68,37 +76,96 @@ TEST_F(LatticeTest, reciprocalTest)
}
// REAL
lattice = physical lattice
// tests the nearest REAL LATTICE
coordinates to a vector
given
in
REAL SPACE
TEST_F
(
LatticeTest
,
n
earest
r
ealLattice
coord
sTest
)
// REAL
= real/physical
// tests the nearest REAL LATTICE
point to a
given REAL SPACE
vector
TEST_F
(
LatticeTest
,
N
earest
R
ealLattice
VectorCoordinate
sTest
)
{
kvector_t
a1
(
1
,
0
,
0
),
a2
(
0
,
1
,
0
),
a3
(
0
,
0
,
1
);
Lattice
l1
(
a1
,
a2
,
a3
);
// vector_in is in
real
SPACE coordinates
// vector_in is in
REAL
SPACE coordinates
kvector_t
vector_in
(
3.01
,
1.51
,
1.49
);
//
vector_in
is in
real
LATTICE coordinates
ivector_t
vector
_expected
(
3
,
2
,
1
);
//
point_expected
is in
REAL
LATTICE coordinates
ivector_t
point
_expected
(
3
,
2
,
1
);
EXPECT_EQ
(
vector
_expected
,
l1
.
getNearestLatticeVectorCoordinates
(
vector_in
));
EXPECT_EQ
(
point
_expected
,
l1
.
getNearestLatticeVectorCoordinates
(
vector_in
));
}
// REC. LATTICE = reciprocal lattice
// tests the nearest REC. LATTICE coordinates to a vector given in REC. SPACE
TEST_F
(
LatticeTest
,
nearestrecLatticecoordsTest
)
// REC. = reciprocal
// tests the nearest REC. LATTICE point to a given REC. SPACE vector
TEST_F
(
LatticeTest
,
NearestReciprocalLatticeVectorCoordinatesTest
)
{
kvector_t
a1
(
1
,
0
,
0
),
a2
(
0
,
1
,
0
),
a3
(
0
,
0
,
1
);
Lattice
l1
(
a1
,
a2
,
a3
);
// vector_in is in reciprocal SPACE coordinates
kvector_t
vector_in
(
5.9
,
5.9
,
0
);
// vector_in is in REC. SPACE coordinates
kvector_t
vector_in
(
2.8
*
M_TWOPI
,
0
,
0
);
// point_expected is in REC. LATTICE coordinates
ivector_t
point_expected
(
3
,
0
,
0
);
EXPECT_EQ
(
point_expected
,
l1
.
getNearestReciprocalLatticeVectorCoordinates
(
vector_in
));
}
// tests the list of REC. LATTICE vectors (in REC. SPACE coords) computed within a specified
// radius of a given REC. SPACE vector
TEST_F
(
LatticeTest
,
reciprocalLatticeVectorsWithinRadiusTest
)
{
kvector_t
a1
(
1
,
0
,
0
),
a2
(
0
,
1
,
0
),
a3
(
0
,
0
,
1
);
Lattice
l1
(
a1
,
a2
,
a3
);
kvector_t
b1
,
b2
,
b3
;
l1
.
getReciprocalLatticeBasis
(
b1
,
b2
,
b3
);
// vector_in is in REC. SPACE coordinates
kvector_t
vector_in
(
2.5
*
M_TWOPI
,
0
,
0
);
// list of REC. LATTICE vectors expected within given radius
std
::
vector
<
kvector_t
>
vectors_expected
;
kvector_t
expected_1
=
2
*
b1
;
kvector_t
expected_2
=
3
*
b1
;
vectors_expected
.
push_back
(
expected_1
);
vectors_expected
.
push_back
(
expected_2
);
EXPECT_EQ
(
vectors_expected
,
l1
.
reciprocalLatticeVectorsWithinRadius
(
vector_in
,
M_TWOPI
));
// !!!!!!!!!!!!!!!!!!!!!FAILED TEST!!!!!!!!!DEBUG NEEDED!!!!!!!!!!!!
//EXPECT_EQ(vectors_expected, l1.reciprocalLatticeVectorsWithinRadius(vector_in, M_TWOPI-0.1));
// Should expect both vectors to be present whereas only 1 is present
}
// tests FCC lattice creation
TEST_F
(
LatticeTest
,
FCCLatticeTest
)
{
kvector_t
fcc1
(
0
,
0.5
,
0.5
),
fcc2
(
0.5
,
0
,
0.5
),
fcc3
(
0.5
,
0.5
,
0
);
// creates FCC lattice onto a new Lattice instance l1
Lattice
l1
=
Lattice
::
createFCCLattice
(
1
);
EXPECT_EQ
(
fcc1
,
l1
.
getBasisVectorA
());
EXPECT_EQ
(
fcc2
,
l1
.
getBasisVectorB
());
EXPECT_EQ
(
fcc3
,
l1
.
getBasisVectorC
());
}
/*
// tests trigonal lattice creation
TEST_F(LatticeTest, TrigonalLatticeTest)
{
kvector_t tri1(1,0,0), tri2(-0.5,0,0), tri3(0,0,4);
//
vector_expected is in reciprocal LATTICE coordinates
ivector_t
vector_expected
(
1
,
1
,
0
);
//
creates trigonal lattice onto a new Lattice instance l1
Lattice l1 = Lattice::createTrigonalLattice(1,4
);
EXPECT_EQ
(
vector_expected
,
l1
.
getNearestReciprocalLatticeVectorCoordinates
(
vector_in
));
EXPECT_EQ(tri1, l1.getBasisVectorA());
EXPECT_EQ(tri2, l1.getBasisVectorB());
EXPECT_EQ(tri3, l1.getBasisVectorC());
}
*/
#endif // LATTICETEST_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment