QMCPACK
LRBreakupParameters.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: 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 #ifndef OHMMS_LRBREAKUP_PARAMETERS_H
14 #define OHMMS_LRBREAKUP_PARAMETERS_H
15 
16 #include <iostream>
17 #include "config.h"
18 #include "OhmmsPETE/TinyVector.h"
19 
20 namespace qmcplusplus
21 {
22 template<typename T, unsigned D>
24 
25 template<typename T>
27 {
28 public:
29  ///Dimensionless cutoff radius for G/R breakups
31  T LR_rc;
32  T LR_kc;
33  T LR_tol;
34  ///number of strictly enforced periodic spatial dimensions
35  /// ewald_strict2d sets ndim=2, otherwise ndim=3
36  unsigned ndim;
38 
39  ///default constructor
41  : LR_dim_cutoff(15.0), LR_rc(1e6), LR_kc(0.0), LR_tol(3e-4), ndim(3), num_ewald_grid_points(1001)
42  {}
43 
44  ///Set LR_rc = radius of smallest sphere inside box and kc=dim/rc
46  {
47  //Compute rc as the real-space cutoff of 1/2 the unit-cell.
48  //Radius of maximum shere that fits in a...
49  TinyVector<T, 3> b, c, d, x; //Unit vector of each surface will be in here
50  //Compute the coordinate of the box center
51  c = 0.5 * (a[0] + a[1] + a[2]);
52  LR_rc = 1.e+6;
53  Tensor<int, 3> Cyclic(0, 1, 2, 1, 2, 0, 2, 0, 1);
54  for (int i = 0; i < 3; i++)
55  {
56  TinyVector<T, 3> v1 = a[Cyclic(i, 1)];
57  TinyVector<T, 3> v2 = a[Cyclic(i, 2)];
58  T beta1 = (dot(v2, v2) * dot(c, v1) - dot(v1, v2) * dot(c, v2)) /
59  (dot(v1, v1) * dot(v2, v2) - dot(v1, v2) * dot(v1, v2));
60  T beta2 = (dot(v1, v1) * dot(c, v2) - dot(v1, v2) * dot(c, v1)) /
61  (dot(v1, v1) * dot(v2, v2) - dot(v1, v2) * dot(v1, v2));
62  TinyVector<T, 3> p = beta1 * v1 + beta2 * v2;
63  T dist = sqrt(dot(p - c, p - c));
64  LR_rc = std::min(LR_rc, dist);
65  }
66  //Set KC for structure-factor and LRbreakups.
67  LR_kc = LR_dim_cutoff / LR_rc;
68  }
69 
70  void printCutoffs(std::ostream& out)
71  {
72  out << " Long-range breakup parameters:" << std::endl;
73  out << " rc*kc = " << LR_dim_cutoff << "; rc = " << LR_rc << "; kc = " << LR_kc << "; tol = " << LR_tol
74  << std::endl;
75  }
76 };
77 } // namespace qmcplusplus
78 #endif
Fixed-size array.
Definition: OhmmsTinyMeta.h:30
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
unsigned ndim
number of strictly enforced periodic spatial dimensions ewald_strict2d sets ndim=2, otherwise ndim=3
void SetLRCutoffs(const TinyVector< TinyVector< T, 3 >, 3 > &a)
Set LR_rc = radius of smallest sphere inside box and kc=dim/rc.
T min(T a, T b)
Tensor<T,D> class for D by D tensor.
Definition: OhmmsTinyMeta.h:32
T LR_dim_cutoff
Dimensionless cutoff radius for G/R breakups.
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)