-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2329 from camelto2/qmcFScorr
adding qmcfinitesize tool
- Loading branch information
Showing
29 changed files
with
10,511 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Jeongnim Kim, [email protected], University of Illinois at Urbana-Champaign | ||
// Jeremy McMinnis, [email protected], University of Illinois at Urbana-Champaign | ||
|
@@ -78,8 +78,8 @@ void EwaldHandler::fillFk(KContainer& KList) | |
else | ||
{ | ||
#if OHMMS_DIM == 2 | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 2 * M_PI / Volume; | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 2 * M_PI / Volume; | ||
for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++) | ||
{ | ||
mRealType t2e = KList.ksq[ki] * kgauss; | ||
|
@@ -90,8 +90,8 @@ void EwaldHandler::fillFk(KContainer& KList) | |
} | ||
PreFactors[3] = 0.0; | ||
#elif OHMMS_DIM == 3 | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++) | ||
{ | ||
mRealType t2e = KList.ksq[ki] * kgauss; | ||
|
@@ -100,27 +100,51 @@ void EwaldHandler::fillFk(KContainer& KList) | |
while (ki < KList.kshell[ks + 1] && ki < Fk.size()) | ||
Fk[ki++] = uk; | ||
} | ||
PreFactors[3] = 0.0; | ||
PreFactors[3] = 0.0; | ||
#endif | ||
} | ||
app_log().flush(); | ||
} | ||
|
||
EwaldHandler::mRealType EwaldHandler::evaluate_slab(mRealType z, | ||
const std::vector<int>& kshell, | ||
const pComplexType* restrict eikr_i, | ||
const pComplexType* restrict eikr_j) | ||
EwaldHandler::mRealType EwaldHandler::evaluate_vlr_k(mRealType k) | ||
{ | ||
mRealType zp = z * Sigma; | ||
mRealType vk = -SlabFunc0(z, zp); | ||
//cout << "### SLAB " << z << " " << zp << std::endl; | ||
for (int ks = 0, ki = 0; ks < MaxKshell; ks++) | ||
mRealType uk = 0.0; | ||
if (SuperCellEnum == SUPERCELL_SLAB) | ||
{ | ||
mRealType u = 0; //\sum Real (e^ikr_i e^(-ikr_j)) | ||
for (; ki < kshell[ks + 1]; ki++, eikr_i++, eikr_j++) | ||
u += ((*eikr_i).real() * (*eikr_j).real() + (*eikr_i).imag() * (*eikr_j).imag()); | ||
vk += u * Fk_symm[ks] * SlabFuncK(ks, z, zp); | ||
mRealType knorm = M_PI / Area; | ||
uk = knorm / k; //pi/(A*k) | ||
} | ||
else | ||
{ | ||
#if OHMMS_DIM == 2 | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 2 * M_PI / Volume; | ||
mRealType k2 = k * k; | ||
uk = knorm * std::exp(-k2 * kgauss) / k2; | ||
#elif OHMMS_DIM == 3 | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
mRealType k2 = k * k; | ||
uk = knorm * std::exp(-k2 * kgauss) / k2; | ||
} | ||
#endif | ||
return uk; | ||
} | ||
|
||
EwaldHandler::mRealType EwaldHandler::evaluate_slab(mRealType z, const std::vector<int>& kshell, | ||
const pComplexType* restrict eikr_i, | ||
const pComplexType* restrict eikr_j) | ||
{ | ||
mRealType zp = z * Sigma; | ||
mRealType vk = -SlabFunc0(z, zp); | ||
//cout << "### SLAB " << z << " " << zp << std::endl; | ||
for (int ks = 0, ki = 0; ks < MaxKshell; ks++) | ||
{ | ||
mRealType u = 0; //\sum Real (e^ikr_i e^(-ikr_j)) | ||
for (; ki < kshell[ks + 1]; ki++, eikr_i++, eikr_j++) | ||
u += ((*eikr_i).real() * (*eikr_j).real() + (*eikr_i).imag() * (*eikr_j).imag()); | ||
vk += u * Fk_symm[ks] * SlabFuncK(ks, z, zp); | ||
} | ||
return vk; | ||
} | ||
return vk; | ||
} | ||
} // namespace qmcplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Jeongnim Kim, [email protected], University of Illinois at Urbana-Champaign | ||
// Jeremy McMinnis, [email protected], University of Illinois at Urbana-Champaign | ||
|
@@ -93,6 +93,8 @@ class EwaldHandler : public LRHandlerBase | |
*/ | ||
inline mRealType srDf(mRealType r, mRealType rinv) { return 0.0; } | ||
|
||
inline mRealType evaluate_vlr_k(mRealType k) override; | ||
|
||
void fillFk(KContainer& KList); | ||
|
||
/** evaluate k-dependent | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Raymond Clay III, [email protected], Lawrence Livermore National Laboratory | ||
// | ||
|
@@ -61,8 +61,8 @@ void EwaldHandler3D::fillFk(KContainer& KList) | |
|
||
Fk_symm.resize(MaxKshell); | ||
kMag.resize(MaxKshell); | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
for (int ks = 0, ki = 0; ks < Fk_symm.size(); ks++) | ||
{ | ||
mRealType t2e = KList.ksq[ki] * kgauss; | ||
|
@@ -78,4 +78,13 @@ void EwaldHandler3D::fillFk(KContainer& KList) | |
PreFactors[3] = 0.0; | ||
app_log().flush(); | ||
} | ||
|
||
EwaldHandler3D::mRealType EwaldHandler3D::evaluate_vlr_k(mRealType k) | ||
{ | ||
mRealType kgauss = 1.0 / (4 * Sigma * Sigma); | ||
mRealType knorm = 4 * M_PI / Volume; | ||
mRealType k2 = k * k; | ||
return knorm * std::exp(-k2 * kgauss) / k2; | ||
} | ||
|
||
} // namespace qmcplusplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Raymond Clay III, [email protected], Lawrence Livermore National Laboratory | ||
// | ||
|
@@ -75,7 +75,9 @@ class EwaldHandler3D : public LRHandlerBase | |
return v0; | ||
} | ||
|
||
inline mRealType evaluateLR_r0() { return 2.0 * Sigma / std::sqrt(M_PI); } | ||
mRealType evaluate_vlr_k(mRealType k) override; | ||
|
||
mRealType evaluateLR_r0() { return 2.0 * Sigma / std::sqrt(M_PI); } | ||
|
||
/** evaluate the first derivative of the short range part at r | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Jeongnim Kim, [email protected], University of Illinois at Urbana-Champaign | ||
// Jeremy McMinnis, [email protected], University of Illinois at Urbana-Champaign | ||
|
@@ -55,6 +55,8 @@ struct LRHandlerBase | |
///Coefficient for strain fit. | ||
std::vector<mRealType> gstraincoefs; | ||
|
||
virtual mRealType evaluate_vlr_k(mRealType k) = 0; | ||
|
||
|
||
//constructor | ||
explicit LRHandlerBase(mRealType kc) : MaxKshell(0), LR_kc(kc), LR_rc(0), ClassName("LRHandlerBase") {} | ||
|
@@ -89,6 +91,19 @@ struct LRHandlerBase | |
return vk; | ||
} | ||
|
||
inline mRealType evaluate_w_sk(const std::vector<int>& kshell, const pRealType* restrict sk) | ||
{ | ||
mRealType vk = 0.0; | ||
for (int ks = 0, ki = 0; ks < MaxKshell; ks++) | ||
{ | ||
mRealType u = 0; | ||
for (; ki < kshell[ks + 1]; ki++) | ||
u += (*sk++); | ||
vk += Fk_symm[ks] * u; | ||
} | ||
return vk; | ||
} | ||
|
||
inline mRealType evaluate(const std::vector<int>& kshell, | ||
const pRealType* restrict rk1_r, | ||
const pRealType* restrict rk1_i, | ||
|
@@ -303,19 +318,20 @@ struct DummyLRHandler : public LRHandlerBase | |
Fk.resize(KList.kpts_cart.size()); | ||
for (ksh = 0, ik = 0; ksh < MaxKshell; ksh++, ik++) | ||
{ | ||
mRealType v = norm * myFunc(kk[KList.kshell[ksh]]); //rpa=u0/kk[ik]; | ||
mRealType v = norm * myFunc(kk[KList.kshell[ksh]]); //rpa=u0/kk[ik]; | ||
Fk_symm[ksh] = v; | ||
for (; ik < KList.kshell[ksh + 1]; ik++) | ||
Fk[ik] = v; | ||
} | ||
} | ||
|
||
mRealType evaluate_vlr_k(mRealType k) override { return 0.0; } | ||
mRealType evaluate(mRealType r, mRealType rinv) { return 0.0; } | ||
mRealType evaluateLR(mRealType r) { return 0.0; } | ||
mRealType srDf(mRealType r, mRealType rinv) { return 0.0; } | ||
void Breakup(ParticleSet& ref, mRealType rs_in) {} | ||
void resetTargetParticleSet(ParticleSet& ref) {} | ||
virtual LRHandlerBase* makeClone(ParticleSet& ref){return new DummyLRHandler<Func>(LR_kc);} | ||
void resetTargetParticleSet(ParticleSet& ref) {} | ||
virtual LRHandlerBase* makeClone(ParticleSet& ref) { return new DummyLRHandler<Func>(LR_kc); } | ||
}; | ||
|
||
} // namespace qmcplusplus | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Raymond Clay III, [email protected], Lawrence Livermore National Laboratory | ||
// Mark A. Berrill, [email protected], Oak Ridge National Laboratory | ||
|
@@ -117,6 +117,8 @@ class LRHandlerSRCoulomb : public LRHandlerBase | |
return v; | ||
} | ||
|
||
inline mRealType evaluate_vlr_k(mRealType k) { return evalYk(k); } | ||
|
||
/** evaluate the first derivative of the short range part at r | ||
* | ||
* @param r radius | ||
|
@@ -282,7 +284,7 @@ class LRHandlerSRCoulomb : public LRHandlerBase | |
LRBreakup<BreakupBasis> breakuphandler(Basis); | ||
//Find size of basis from cutoffs | ||
mRealType kc = (LR_kc < 0) ? ref.LR_kc : LR_kc; | ||
LR_kc = kc; // set internal kc | ||
LR_kc = kc; // set internal kc | ||
//mRealType kc(ref.LR_kc); //User cutoff parameter... | ||
//kcut is the cutoff for switching to approximate k-point degeneracies for | ||
//better performance in making the breakup. A good bet is 30*K-spacing so that | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Ken Esler, [email protected], University of Illinois at Urbana-Champaign | ||
// Bryan Clark, [email protected], Princeton University | ||
|
@@ -102,7 +102,8 @@ class LRHandlerTemp : public LRHandlerBase | |
inline mRealType evaluate(mRealType r, mRealType rinv) | ||
{ | ||
mRealType v = 0.0; | ||
if (r>=LR_rc) return v; | ||
if (r >= LR_rc) | ||
return v; | ||
v = myFunc(r, rinv); | ||
for (int n = 0; n < coefs.size(); n++) | ||
v -= coefs[n] * Basis.h(n, r); | ||
|
@@ -118,21 +119,25 @@ class LRHandlerTemp : public LRHandlerBase | |
{ | ||
APP_ABORT("LRHandlerTemp::srDF not implemented (missing gcoefs)"); | ||
mRealType df = 0.0; | ||
if (r>=LR_rc) return df; | ||
if (r >= LR_rc) | ||
return df; | ||
df = myFunc.df(r); | ||
//RealType df = myFunc.df(r, rinv); | ||
for (int n = 0; n < coefs.size(); n++) | ||
df -= gcoefs[n] * Basis.dh_dr(n, r); | ||
return df; | ||
} | ||
|
||
inline mRealType evaluate_vlr_k(mRealType k) { return evalFk(k); } | ||
|
||
|
||
/** evaluate the contribution from the long-range part for for spline | ||
*/ | ||
inline mRealType evaluateLR(mRealType r) | ||
{ | ||
mRealType v = 0.0; | ||
if (r>=LR_rc) return myFunc(r, 1./r); | ||
if (r >= LR_rc) | ||
return myFunc(r, 1. / r); | ||
for (int n = 0; n < coefs.size(); n++) | ||
v += coefs[n] * Basis.h(n, r); | ||
return v; | ||
|
@@ -208,7 +213,7 @@ class LRHandlerTemp : public LRHandlerBase | |
LRBreakup<BreakupBasis> breakuphandler(Basis); | ||
//Find size of basis from cutoffs | ||
mRealType kc = (LR_kc < 0) ? ref.LR_kc : LR_kc; | ||
LR_kc = kc; // set internal kc | ||
LR_kc = kc; // set internal kc | ||
//RealType kc(ref.LR_kc); //User cutoff parameter... | ||
//kcut is the cutoff for switching to approximate k-point degeneracies for | ||
//better performance in making the breakup. A good bet is 30*K-spacing so that | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Miguel Morales, [email protected], Lawrence Livermore National Laboratory | ||
// Jeremy McMinnis, [email protected], University of Illinois at Urbana-Champaign | ||
|
@@ -155,6 +155,8 @@ struct LRRPABFeeHandlerTemp : public LRHandlerBase | |
return vk; | ||
} | ||
|
||
inline mRealType evaluate_vlr_k(mRealType k) override { return evalFk(k); } | ||
|
||
private: | ||
inline mRealType evalFk(mRealType k) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// This file is distributed under the University of Illinois/NCSA Open Source License. | ||
// See LICENSE file in top directory for details. | ||
// | ||
// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. | ||
// Copyright (c) 2020 QMCPACK developers. | ||
// | ||
// File developed by: Jeongnim Kim, [email protected], University of Illinois at Urbana-Champaign | ||
// Jeremy McMinnis, [email protected], University of Illinois at Urbana-Champaign | ||
|
@@ -156,6 +156,9 @@ struct LRRPAHandlerTemp : public LRHandlerBase | |
return vk; | ||
} | ||
|
||
// use what is put in fillFk. Multiplies evalFk by -1 | ||
inline mRealType evaluate_vlr_k(mRealType k) override { return -1.0 * evalFk(k); } | ||
|
||
private: | ||
inline mRealType evalFk(mRealType k) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.