QMCPACK
test_CrystalLattice.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2019 and QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include <stdio.h>
14 #include <string>
15 
16 #include "catch.hpp"
17 
18 #include "Configuration.h"
19 #include "OhmmsPETE/TinyVector.h"
20 #include "Lattice/CrystalLattice.h"
21 
22 namespace qmcplusplus
23 {
25 
26 /** Lattice is defined but Open BC is also used.
27  */
28 TEST_CASE("Crystal_lattice_periodic_bulk", "[lattice]")
29 {
31  Lattice.BoxBConds = false; // Open BC
32  Lattice.R.diagonal(0.4);
33  Lattice.reset();
34 
35  CHECK(Lattice.Volume == Approx(0.4 * 0.4 * 0.4));
36 
37  vec_t v3(0.6, 1.2, -1.7);
38  REQUIRE(Lattice.isValid(v3) == false);
39  REQUIRE(Lattice.outOfBound(v3) == true);
40 
41  vec_t v4(0.45, 0.2, 0.1);
42  REQUIRE(Lattice.isValid(v4) == true);
43  REQUIRE(Lattice.outOfBound(v4) == false);
44 }
45 
46 } // namespace qmcplusplus
a class that defines a supercell in D-dimensional Euclean space.
bool isValid(const TinyVector< T, D > &u) const
return true if all the open direction of reduced coordinates u are in the range [0,1)
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
TEST_CASE("complex_helper", "[type_traits]")
Declaration of CrystalLattice<T,D>
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
REQUIRE(std::filesystem::exists(filename))
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool outOfBound(const TinyVector< T, D > &u) const
return true if any direction of reduced coordinates u goes larger than 0.5
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.