Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RotatedSPOsT with mw #38

Open
wants to merge 36 commits into
base: ref-add-SPOSetT
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c04b48d
Implement SPOSetT template class
williamfgc Jul 24, 2023
7a7034a
Mark todo for purely virtual functions
williamfgc Jul 24, 2023
26ce50b
Add FakeSPOT class
quantumsteve Aug 4, 2023
1368143
Revert test_RotatedSPOs.cpp
williamfgc Aug 18, 2023
3721d46
Reorder specialized function definitions to appease OMP target compil…
PhilipFackler Aug 18, 2023
321dc07
Add ConstantSPOSetT
williamfgc Aug 18, 2023
9a31e50
Refactor BsplineSet and SplineC2C
williamfgc Aug 22, 2023
ee065a8
PWOribitalSetT and PWBasisT
PhilipFackler Aug 16, 2023
13a6e73
Add templated class LCAOrbitalSetT
quantumsteve Aug 17, 2023
fda3f2b
Add templated class LCAOrbitalSetWithCorrectionT
quantumsteve Aug 24, 2023
40c8179
Fix LCAOrbitalSetWithCorrectionT. Add SPOSetBuilderT and SoaCuspCorre…
quantumsteve Aug 24, 2023
4527547
Add SHOSetBuilderT
quantumsteve Aug 24, 2023
5e16c5a
Fix PWOrbitalSet alias types
williamfgc Aug 25, 2023
97cbde5
Implement CompositeSPOSetT class
PhilipFackler Aug 4, 2023
154e7a8
added initial missing API
camelto2 Aug 25, 2023
86036b2
finish mw_ APIs
camelto2 Aug 25, 2023
aa153a5
add timer
camelto2 Aug 25, 2023
ae8a226
Implement SPOSetT template class
williamfgc Jul 24, 2023
61d6cc0
Add FakeSPOT class
quantumsteve Aug 4, 2023
2c6cd19
Revert test_RotatedSPOs.cpp
williamfgc Aug 18, 2023
8f1f53b
Reorder specialized function definitions to appease OMP target compil…
PhilipFackler Aug 18, 2023
c045401
Add ConstantSPOSetT
williamfgc Aug 18, 2023
b1fbc2f
Refactor BsplineSet and SplineC2C
williamfgc Aug 22, 2023
ad82241
PWOribitalSetT and PWBasisT
PhilipFackler Aug 16, 2023
a79d7f0
Add LCAOrbitalSetT
quantumsteve Aug 17, 2023
09ccc3a
Add SPOSetBuilderT, SHOSetBuilderT and SoaCuspCorrectionT
quantumsteve Aug 24, 2023
94342e8
Implement CompositeSPOSetT class
PhilipFackler Aug 4, 2023
1d72b82
Specialize functions in RotatedSPOsT
williamfgc Aug 28, 2023
85d3fa7
Implement SPOSetBuilderFactoryT and most required builders
PhilipFackler Aug 25, 2023
499aa59
Add CI to WIP refactoring branch
williamfgc Sep 6, 2023
6f50ae2
add SplineR2RT
walshmm Sep 1, 2023
abcc626
Further template propagation to fix offload build
PhilipFackler Sep 1, 2023
4f2c455
Implement SplineC2RTOMPTarget template class
PhilipFackler Sep 18, 2023
332ca8b
RESETME
PhilipFackler Oct 25, 2023
6e4910d
Merge commit '4f2c45539' into update_RotatedSPOsT_with_mw
PhilipFackler Oct 27, 2023
b4f0ded
Merge remote-tracking branch 'williamfgc/ref-add-SPOSetT' into update…
PhilipFackler Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci-github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- develop
- main
- ref-add-SPOSetT
pull_request:
branches:
- develop
- main
- ref-add-SPOSetT

jobs:
linux:
Expand Down
5 changes: 2 additions & 3 deletions src/QMCWaveFunctions/BasisSetBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ struct SoaBasisSetBase
using vgl_type = VectorSoaContainer<T, OHMMS_DIM + 2>;
using vgh_type = VectorSoaContainer<T, 10>;
using vghgh_type = VectorSoaContainer<T, 20>;
using ValueType = QMCTraits::ValueType;
using OffloadMWVGLArray = Array<ValueType, 3, OffloadPinnedAllocator<ValueType>>; // [VGL, walker, Orbs]
using OffloadMWVArray = Array<ValueType, 2, OffloadPinnedAllocator<ValueType>>; // [walker, Orbs]
using OffloadMWVGLArray = Array<T, 3, OffloadPinnedAllocator<T>>; // [VGL, walker, Orbs]
using OffloadMWVArray = Array<T, 2, OffloadPinnedAllocator<T>>; // [walker, Orbs]

///size of the basis set
int BasisSetSize;
Expand Down
222 changes: 222 additions & 0 deletions src/QMCWaveFunctions/BasisSetBaseT.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
//////////////////////////////////////////////////////////////////////////////////////
// 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.
//
// File developed by: Ken Esler, [email protected], University of Illinois at
// Urbana-Champaign
// Miguel Morales, [email protected], Lawrence Livermore
// National Laboratory Jeremy McMinnis, [email protected],
// University of Illinois at Urbana-Champaign Jaron T.
// Krogel, [email protected], Oak Ridge National Laboratory
// Jeongnim Kim, [email protected], University of
// Illinois at Urbana-Champaign Mark A. Berrill,
// [email protected], Oak Ridge National Laboratory
//
// File created by: Jeongnim Kim, [email protected], University of Illinois
// at Urbana-Champaign
//////////////////////////////////////////////////////////////////////////////////////

#ifndef QMCPLUSPLUS_BASISSETBASET_H
#define QMCPLUSPLUS_BASISSETBASET_H

#include "OMPTarget/OffloadAlignedAllocators.hpp"
#include "Particle/ParticleSetT.h"
#include "QMCWaveFunctions/OrbitalSetTraits.h"

namespace qmcplusplus
{
/** base class for a basis set
*
* Define a common storage for the derived classes and
* provides a minimal set of interfaces to get/set BasisSetSize.
*/
template <typename T>
struct BasisSetBaseT : public OrbitalSetTraits<T>
{
enum
{
MAXINDEX = 2 + OHMMS_DIM
};
using RealType = typename OrbitalSetTraits<T>::RealType;
using ValueType = typename OrbitalSetTraits<T>::ValueType;
using IndexType = typename OrbitalSetTraits<T>::IndexType;
using HessType = typename OrbitalSetTraits<T>::HessType;
using IndexVector = typename OrbitalSetTraits<T>::IndexVector;
using ValueVector = typename OrbitalSetTraits<T>::ValueVector;
using ValueMatrix = typename OrbitalSetTraits<T>::ValueMatrix;
using GradVector = typename OrbitalSetTraits<T>::GradVector;
using GradMatrix = typename OrbitalSetTraits<T>::GradMatrix;
using HessVector = typename OrbitalSetTraits<T>::HessVector;
using HessMatrix = typename OrbitalSetTraits<T>::HessMatrix;
using GGGType = TinyVector<HessType, OHMMS_DIM>;
using GGGVector = Vector<GGGType>;
using GGGMatrix = Matrix<GGGType>;

/// size of the basis set
IndexType BasisSetSize;
/// index of the particle
IndexType ActivePtcl;
/// counter to keep track
unsigned long Counter;
/// phi[i] the value of the i-th basis set
ValueVector Phi;
/// dphi[i] the gradient of the i-th basis set
GradVector dPhi;
/// d2phi[i] the laplacian of the i-th basis set
ValueVector d2Phi;
/// grad_grad_Phi[i] the full hessian of the i-th basis set
HessVector grad_grad_Phi;
/// grad_grad_grad_Phi the full hessian of the i-th basis set
GGGVector grad_grad_grad_Phi;
/// container to store value, laplacian and gradient
ValueMatrix Temp;

ValueMatrix Y;
GradMatrix dY;
ValueMatrix d2Y;

/// default constructor
BasisSetBaseT() : BasisSetSize(0), ActivePtcl(-1), Counter(0)
{
}
/// virtual destructor
virtual ~BasisSetBaseT()
{
}
/** resize the container */
void
resize(int ntargets)
{
if (BasisSetSize) {
Phi.resize(BasisSetSize);
dPhi.resize(BasisSetSize);
d2Phi.resize(BasisSetSize);
grad_grad_Phi.resize(BasisSetSize);
grad_grad_grad_Phi.resize(BasisSetSize);
Temp.resize(BasisSetSize, MAXINDEX);
Y.resize(ntargets, BasisSetSize);
dY.resize(ntargets, BasisSetSize);
d2Y.resize(ntargets, BasisSetSize);
}
else {
app_error() << " BasisSetBase::BasisSetSize == 0" << std::endl;
}
}

/// clone the basis set
virtual BasisSetBaseT*
makeClone() const = 0;
/** return the basis set size */
inline IndexType
getBasisSetSize() const
{
return BasisSetSize;
}

/// resize the basis set
virtual void
setBasisSetSize(int nbs) = 0;

virtual void
evaluateWithHessian(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateWithThirdDeriv(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateThirdDerivOnly(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateForWalkerMove(const ParticleSetT<T>& P) = 0;
virtual void
evaluateForWalkerMove(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateForPtclMove(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateAllForPtclMove(const ParticleSetT<T>& P, int iat) = 0;
virtual void
evaluateForPtclMoveWithHessian(const ParticleSetT<T>& P, int iat) = 0;
};

/** Base for real basis set
*
* Equivalent to BasisSetBase with minimum requirements
* Used by LCAO
*/
template <typename T>
struct SoaBasisSetBaseT
{
using value_type = T;
using vgl_type = VectorSoaContainer<T, OHMMS_DIM + 2>;
using vgh_type = VectorSoaContainer<T, 10>;
using vghgh_type = VectorSoaContainer<T, 20>;
using OffloadMWVGLArray =
Array<T, 3, OffloadPinnedAllocator<T>>; // [VGL, walker, Orbs]
using OffloadMWVArray =
Array<T, 2, OffloadPinnedAllocator<T>>; // [walker, Orbs]

/// size of the basis set
int BasisSetSize;

virtual ~SoaBasisSetBaseT() = default;
inline int
getBasisSetSize()
{
return BasisSetSize;
}

virtual SoaBasisSetBaseT<T>*
makeClone() const = 0;
virtual void
setBasisSetSize(int nbs) = 0;

// Evaluates value, gradient, and laplacian for electron "iat". Parks them
// into a temporary data structure "vgl".
virtual void
evaluateVGL(const ParticleSetT<T>& P, int iat, vgl_type& vgl) = 0;
// Evaluates value, gradient, and laplacian for electron "iat". places them
// in a offload array for batched code.
virtual void
mw_evaluateVGL(const RefVectorWithLeader<ParticleSetT<T>>& P_list, int iat,
OffloadMWVGLArray& vgl) = 0;
// Evaluates value for electron "iat". places it in a offload array for
// batched code.
virtual void
mw_evaluateValue(const RefVectorWithLeader<ParticleSetT<T>>& P_list,
int iat, OffloadMWVArray& v) = 0;
// Evaluates value, gradient, and Hessian for electron "iat". Parks them
// into a temporary data structure "vgh".
virtual void
evaluateVGH(const ParticleSetT<T>& P, int iat, vgh_type& vgh) = 0;
// Evaluates value, gradient, and Hessian, and Gradient Hessian for electron
// "iat". Parks them into a temporary data structure "vghgh".
virtual void
evaluateVGHGH(const ParticleSetT<T>& P, int iat, vghgh_type& vghgh) = 0;
// Evaluates the x,y, and z components of ionic gradient associated with
// "jion" of value. Parks the raw data into "vgl" container.
virtual void
evaluateGradSourceV(const ParticleSetT<T>& P, int iat,
const ParticleSetT<T>& ions, int jion, vgl_type& vgl) = 0;
// Evaluates the x,y, and z components of ionic gradient associated with
// "jion" value, gradient, and laplacian.
// Parks the raw data into "vghgh" container.
virtual void
evaluateGradSourceVGL(const ParticleSetT<T>& P, int iat,
const ParticleSetT<T>& ions, int jion, vghgh_type& vghgh) = 0;
virtual void
evaluateV(const ParticleSetT<T>& P, int iat, value_type* restrict vals) = 0;
virtual bool
is_S_orbital(int mo_idx, int ao_idx)
{
return false;
}

/// Determine which orbitals are S-type. Used for cusp correction.
virtual void
queryOrbitalsForSType(const std::vector<bool>& corrCenter,
std::vector<bool>& is_s_orbital) const
{
}
};

} // namespace qmcplusplus
#endif
Loading