forked from QMCPACK/qmcpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a7614a
commit 5613648
Showing
68 changed files
with
17,707 additions
and
19,270 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,8 +9,6 @@ | |
// File created by: Ye Luo, [email protected], Argonne National Laboratory | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** @file DynamicCoordinatesT.h | ||
*/ | ||
#ifndef QMCPLUSPLUS_DYNAMICCOORDINATEST_H | ||
#define QMCPLUSPLUS_DYNAMICCOORDINATEST_H | ||
|
||
|
@@ -34,119 +32,91 @@ enum class DynamicCoordinateKind | |
|
||
/** quantum variables of all the particles | ||
*/ | ||
template <typename T> | ||
template<typename T> | ||
class DynamicCoordinatesT | ||
{ | ||
public: | ||
using RealType = typename ParticleSetTraits<T>::RealType; | ||
using PosType = typename ParticleSetTraits<T>::PosType; | ||
using ParticlePos = typename LatticeParticleTraits<T>::ParticlePos; | ||
using PosVectorSoa = | ||
VectorSoaContainer<RealType, ParticleSetTraits<T>::DIM>; | ||
using RealType = typename ParticleSetTraits<T>::RealType; | ||
using PosType = typename ParticleSetTraits<T>::PosType; | ||
using ParticlePos = typename LatticeParticleTraits<T>::ParticlePos; | ||
using PosVectorSoa = VectorSoaContainer<RealType, ParticleSetTraits<T>::DIM>; | ||
|
||
DynamicCoordinatesT(const DynamicCoordinateKind kind_in) : | ||
variable_kind_(kind_in) | ||
{ | ||
} | ||
DynamicCoordinatesT(const DynamicCoordinateKind kind_in) : variable_kind_(kind_in) {} | ||
|
||
DynamicCoordinatesT(const DynamicCoordinatesT&) = default; | ||
DynamicCoordinatesT& | ||
operator=(const DynamicCoordinatesT&) = delete; | ||
DynamicCoordinatesT(const DynamicCoordinatesT&) = default; | ||
DynamicCoordinatesT& operator=(const DynamicCoordinatesT&) = delete; | ||
|
||
DynamicCoordinateKind | ||
getKind() const | ||
{ | ||
return variable_kind_; | ||
} | ||
DynamicCoordinateKind getKind() const { return variable_kind_; } | ||
|
||
virtual ~DynamicCoordinatesT() = default; | ||
virtual ~DynamicCoordinatesT() = default; | ||
|
||
virtual std::unique_ptr<DynamicCoordinatesT> | ||
makeClone() = 0; | ||
virtual std::unique_ptr<DynamicCoordinatesT> makeClone() = 0; | ||
|
||
/** resize internal storages based on the number of particles | ||
/** resize internal storages based on the number of particles | ||
* @param n the number of particles | ||
*/ | ||
virtual void | ||
resize(size_t n) = 0; | ||
/// return the number of particles | ||
virtual size_t | ||
size() const = 0; | ||
|
||
/// overwrite the positions of all the particles. | ||
virtual void | ||
setAllParticlePos(const ParticlePos& R) = 0; | ||
/// overwrite the position of one the particle. | ||
virtual void | ||
setOneParticlePos(const PosType& pos, size_t iat) = 0; | ||
/** copy the active positions of particles with a uniform id in all the | ||
virtual void resize(size_t n) = 0; | ||
/// return the number of particles | ||
virtual size_t size() const = 0; | ||
|
||
/// overwrite the positions of all the particles. | ||
virtual void setAllParticlePos(const ParticlePos& R) = 0; | ||
/// overwrite the position of one the particle. | ||
virtual void setOneParticlePos(const PosType& pos, size_t iat) = 0; | ||
/** copy the active positions of particles with a uniform id in all the | ||
* walkers to a single internal buffer. | ||
* @param coords_list a batch of DynamicCoordinates | ||
* @param iat paricle id, uniform across coords_list | ||
* @param new_positions proposed positions | ||
*/ | ||
virtual void | ||
mw_copyActivePos( | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list, size_t iat, | ||
const std::vector<PosType>& new_positions) const | ||
{ | ||
assert(this == &coords_list.getLeader()); | ||
} | ||
|
||
/** overwrite the positions of particles with a uniform id in all the | ||
virtual void mw_copyActivePos(const RefVectorWithLeader<DynamicCoordinatesT>& coords_list, | ||
size_t iat, | ||
const std::vector<PosType>& new_positions) const | ||
{ | ||
assert(this == &coords_list.getLeader()); | ||
} | ||
|
||
/** overwrite the positions of particles with a uniform id in all the | ||
* walkers upon acceptance. | ||
* @param coords_list a batch of DynamicCoordinates | ||
* @param iat paricle id, uniform across coords_list | ||
* @param new_positions proposed positions | ||
* @param isAccepted accept/reject info | ||
*/ | ||
virtual void | ||
mw_acceptParticlePos( | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list, size_t iat, | ||
const std::vector<PosType>& new_positions, | ||
const std::vector<bool>& isAccepted) const = 0; | ||
|
||
/// all particle position accessor | ||
virtual const PosVectorSoa& | ||
getAllParticlePos() const = 0; | ||
/// one particle position accessor | ||
virtual PosType | ||
getOneParticlePos(size_t iat) const = 0; | ||
|
||
/// secure internal data consistency after p-by-p moves | ||
virtual void | ||
donePbyP() | ||
{ | ||
} | ||
|
||
/// initialize a shared resource and hand it to a collection | ||
virtual void | ||
createResource(ResourceCollection& collection) const | ||
{ | ||
} | ||
|
||
/// acquire a shared resource from a collection | ||
virtual void | ||
acquireResource(ResourceCollection& collection, | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list) const | ||
{ | ||
} | ||
|
||
/// return a shared resource to a collection | ||
virtual void | ||
releaseResource(ResourceCollection& collection, | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list) const | ||
{ | ||
} | ||
virtual void mw_acceptParticlePos(const RefVectorWithLeader<DynamicCoordinatesT>& coords_list, | ||
size_t iat, | ||
const std::vector<PosType>& new_positions, | ||
const std::vector<bool>& isAccepted) const = 0; | ||
|
||
/// all particle position accessor | ||
virtual const PosVectorSoa& getAllParticlePos() const = 0; | ||
/// one particle position accessor | ||
virtual PosType getOneParticlePos(size_t iat) const = 0; | ||
|
||
/// secure internal data consistency after p-by-p moves | ||
virtual void donePbyP() {} | ||
|
||
/// initialize a shared resource and hand it to a collection | ||
virtual void createResource(ResourceCollection& collection) const {} | ||
|
||
/// acquire a shared resource from a collection | ||
virtual void acquireResource(ResourceCollection& collection, | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list) const | ||
{} | ||
|
||
/// return a shared resource to a collection | ||
virtual void releaseResource(ResourceCollection& collection, | ||
const RefVectorWithLeader<DynamicCoordinatesT>& coords_list) const | ||
{} | ||
|
||
protected: | ||
/// type of dynamic coordinates | ||
const DynamicCoordinateKind variable_kind_; | ||
/// type of dynamic coordinates | ||
const DynamicCoordinateKind variable_kind_; | ||
}; | ||
|
||
/** create DynamicCoordinates based on kind | ||
*/ | ||
template <typename T> | ||
template<typename T> | ||
std::unique_ptr<DynamicCoordinatesT<T>> createDynamicCoordinatesT( | ||
const DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS); | ||
} // namespace qmcplusplus | ||
|
Oops, something went wrong.