47 volume = fabs(box[0] * (box[1].cross(box[2])));
60 double halfSphere = 1;
64 for (
int i = 0; i <=
n[0]; ++i)
68 for (
int j = sj; j <=
n[1]; ++j)
71 if (i == 0 && j == 0) sk = 0;
72 for (
int k = sk; k <=
n[2]; ++k)
74 if (i == 0 && j == 0 && k == 0)
continue;
76 double knorm2 = kv.
norm2();
92 for (
int i = -
n[0]; i <=
n[0]; ++i)
94 for (
int j = -
n[1]; j <=
n[1]; ++j)
96 for (
int k = -
n[2]; k <=
n[2]; ++k)
98 if (i == 0 && j == 0 && k == 0)
continue;
100 double knorm2 = kv.
norm2();
106 * 2.0 *
pre / knorm2;
120 axb =
kbox[0].cross(
kbox[1]).normalize();
121 axc =
kbox[0].cross(
kbox[2]).normalize();
122 bxc =
kbox[1].cross(
kbox[2]).normalize();
124 double proja = fabs(
kbox[0] * bxc);
125 double projb = fabs(
kbox[1] * axc);
126 double projc = fabs(
kbox[2] * axb);
131 while (
n[0] * proja <= cutoffRadius)
n[0]++;
132 while (
n[1] * projb <= cutoffRadius)
n[1]++;
133 while (
n[2] * projc <= cutoffRadius)
n[2]++;
Setup data for Ewald summation.
std::vector< Kvector > kvectors
Vector containing all k-vectors.
double pre
Ewald sum prefactor .
Vec3D kbox[3]
Reciprocal box vectors.
void setup(Vec3D box[3], EwaldSetup &ewaldSetup)
Set up reciprocal box vectors and eta.
double eta
Ewald summation eta parameter.
void calculatePbcCopies(double cutoffRadius)
Compute box copies in each direction.
double volume
Volume of real box.
double kCut
Cutoff in reciprocal space.
int n[3]
Required box copies in each box vector direction.
Vec3D k
A single k-vector (as Vec3D).
double coeff
Precomputed coefficient for Ewald summation.
double knorm2
Square of norm of k-vector.
double eta
Width of the gaussian screening charges.
double kCut
Cutoff in reciprocal space.
Vector in 3 dimensional real space.
double norm2() const
Calculate square of norm of vector.
Vec3D cross(Vec3D const &v) const
Cross product, argument vector is second in product.