Skip to content

Commit

Permalink
Merge pull request #15 from PhilipFackler/reorder-FreeOrbitalT
Browse files Browse the repository at this point in the history
Reorder specialized function definitions to appease OMP target compilation
  • Loading branch information
williamfgc authored Aug 18, 2023
2 parents 2394c74 + ca2ecbc commit bc91f11
Showing 1 changed file with 53 additions and 57 deletions.
110 changes: 53 additions & 57 deletions src/QMCWaveFunctions/ElectronGas/FreeOrbitalT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,6 @@
namespace qmcplusplus
{

template<class T>
FreeOrbitalT<T>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart) : SPOSetT<T>(my_name)
{}

//Explicit template specialization
template<>
FreeOrbitalT<float>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<float>(my_name),
kvecs(kpts_cart),
mink(1), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = 2 * maxk - 1; // k=0 has no (cos, sin) split, SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<double>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<double>(my_name),
kvecs(kpts_cart),
mink(1), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = 2 * maxk - 1; // k=0 has no (cos, sin) split, SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<std::complex<float>>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<std::complex<float>>(my_name),
kvecs(kpts_cart),
mink(0), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = maxk; // SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<std::complex<double>>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<std::complex<double>>(my_name),
kvecs(kpts_cart),
mink(0), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = maxk; // SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}


template<class T>
void FreeOrbitalT<T>::evaluateVGL(const ParticleSet& P,
Expand Down Expand Up @@ -696,6 +639,59 @@ void FreeOrbitalT<T>::evaluate_notranspose(const ParticleSet& P,
}
}

//Explicit template specialization
template<>
FreeOrbitalT<float>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<float>(my_name),
kvecs(kpts_cart),
mink(1), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = 2 * maxk - 1; // k=0 has no (cos, sin) split, SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<double>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<double>(my_name),
kvecs(kpts_cart),
mink(1), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = 2 * maxk - 1; // k=0 has no (cos, sin) split, SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<std::complex<float>>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<std::complex<float>>(my_name),
kvecs(kpts_cart),
mink(0), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = maxk; // SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}

template<>
FreeOrbitalT<std::complex<double>>::FreeOrbitalT(const std::string& my_name, const std::vector<PosType>& kpts_cart)
: SPOSetT<std::complex<double>>(my_name),
kvecs(kpts_cart),
mink(0), // treat k=0 as special case
maxk(kpts_cart.size()),
k2neg(maxk)
{
this->OrbitalSetSize = maxk; // SPOSet member
for (int ik = 0; ik < maxk; ik++)
k2neg[ik] = -dot(kvecs[ik], kvecs[ik]);
}


template<class T>
void FreeOrbitalT<T>::report(const std::string& pad) const
Expand Down

0 comments on commit bc91f11

Please sign in to comment.