QMCPACK
EwaldRef.h
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 QMCPACK developers.
6 //
7 // File developed by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File created by: Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 /**@file EwaldRef.h
13  *
14  * @brief Computes Ewald sums of the potential energy to a given
15  * tolerance for arbitrary collections of charges.
16  *
17  * The implementation follows formulas 6 and 7 from:
18  *
19  * N. D. Drummond et al., Physical Review B 78 125106 (2008)
20  *
21  * DOI: https://doi.org/10.1103/PhysRevB.78.125106
22  */
23 
24 #ifndef QMCPLUSPLUS_EWALD_REF_H
25 #define QMCPLUSPLUS_EWALD_REF_H
26 
27 #include <vector>
28 #include "OhmmsPETE/TinyVector.h"
29 #include "OhmmsPETE/Tensor.h"
30 
31 namespace qmcplusplus
32 {
33 namespace ewaldref
34 {
35 /// Reference Ewald implemented for 3D only
36 enum
37 {
38  DIM = 3
39 };
40 
41 /// Type for integers
42 using int_t = int;
43 /// Type for floating point numbers
44 using real_t = double;
45 /// Type for integer vectors of length DIM
47 /// Type for floating point vectors of length DIM
49 /// Type for floating point matrices of shape DIM,DIM
51 /// Type for lists of particle positions
52 using PosArray = std::vector<RealVec>;
53 /// Type for lists of particle charges
54 using ChargeArray = std::vector<real_t>;
55 
56 /** Compute the total Ewald potential energy for a collection of charges
57  *
58  * Corresponds to the entirety of Drummond 2008 formula 5, but for
59  * arbitrary charges.
60  *
61  * @param a: Real-space cell axes.
62  *
63  * @param R: List of particle coordinates.
64  *
65  * @param R: List of particle charges.
66  *
67  * @param tol: Tolerance for the total potential energy in Ha.
68  */
69 real_t ewaldEnergy(const RealMat& a, const PosArray& R, const ChargeArray& Q, real_t tol = 1e-10);
70 
71 } // namespace ewaldref
72 } // namespace qmcplusplus
73 
74 #endif
Fixed-size array.
Definition: OhmmsTinyMeta.h:30
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::vector< real_t > ChargeArray
Type for lists of particle charges.
Definition: EwaldRef.h:54
real_t ewaldEnergy(const RealMat &a, const PosArray &R, const ChargeArray &Q, real_t tol)
Compute the total Ewald potential energy for a collection of charges.
Definition: EwaldRef.cpp:337
int int_t
Type for integers.
Definition: EwaldRef.h:42
std::vector< RealVec > PosArray
Type for lists of particle positions.
Definition: EwaldRef.h:52
Tensor<T,D> class for D by D tensor.
Definition: OhmmsTinyMeta.h:32
double real_t
Type for floating point numbers.
Definition: EwaldRef.h:44