Skip to content

Commit

Permalink
clang-format-16 on new files
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfgc committed Oct 26, 2023
1 parent 7a7614a commit 5613648
Show file tree
Hide file tree
Showing 68 changed files with 17,707 additions and 19,270 deletions.
558 changes: 217 additions & 341 deletions src/Particle/DistanceTableT.h

Large diffs are not rendered by default.

30 changes: 13 additions & 17 deletions src/Particle/DynamicCoordinatesT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,22 @@ namespace qmcplusplus
{
/** create DynamicCoordinates based on kind
*/
template <typename T>
std::unique_ptr<DynamicCoordinatesT<T>>
createDynamicCoordinatesT(const DynamicCoordinateKind kind)
template<typename T>
std::unique_ptr<DynamicCoordinatesT<T>> createDynamicCoordinatesT(const DynamicCoordinateKind kind)
{
if (kind == DynamicCoordinateKind::DC_POS)
return std::make_unique<RealSpacePositionsT<T>>();
else if (kind == DynamicCoordinateKind::DC_POS_OFFLOAD)
return std::make_unique<RealSpacePositionsTOMPTarget<T>>();
// dummy return
return std::unique_ptr<RealSpacePositionsT<T>>();
if (kind == DynamicCoordinateKind::DC_POS)
return std::make_unique<RealSpacePositionsT<T>>();
else if (kind == DynamicCoordinateKind::DC_POS_OFFLOAD)
return std::make_unique<RealSpacePositionsTOMPTarget<T>>();
// dummy return
return std::unique_ptr<RealSpacePositionsT<T>>();
}

template std::unique_ptr<DynamicCoordinatesT<double>>
createDynamicCoordinatesT<double>(const DynamicCoordinateKind kind);
template std::unique_ptr<DynamicCoordinatesT<float>>
createDynamicCoordinatesT<float>(const DynamicCoordinateKind kind);
template std::unique_ptr<DynamicCoordinatesT<std::complex<double>>>
createDynamicCoordinatesT<std::complex<double>>(
template std::unique_ptr<DynamicCoordinatesT<double>> createDynamicCoordinatesT<double>(
const DynamicCoordinateKind kind);
template std::unique_ptr<DynamicCoordinatesT<std::complex<float>>>
createDynamicCoordinatesT<std::complex<float>>(
template std::unique_ptr<DynamicCoordinatesT<float>> createDynamicCoordinatesT<float>(const DynamicCoordinateKind kind);
template std::unique_ptr<DynamicCoordinatesT<std::complex<double>>> createDynamicCoordinatesT<std::complex<double>>(
const DynamicCoordinateKind kind);
template std::unique_ptr<DynamicCoordinatesT<std::complex<float>>> createDynamicCoordinatesT<std::complex<float>>(
const DynamicCoordinateKind kind);
} // namespace qmcplusplus
144 changes: 57 additions & 87 deletions src/Particle/DynamicCoordinatesT.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Loading

0 comments on commit 5613648

Please sign in to comment.