QMCPACK
RealSpacePositions Class Reference

Introduced to handle virtual moves and ratio computations, e.g. More...

+ Inheritance diagram for RealSpacePositions:
+ Collaboration diagram for RealSpacePositions:

Public Types

using ParticlePos = PtclOnLatticeTraits::ParticlePos
 
using RealType = QMCTraits::RealType
 
using PosType = QMCTraits::PosType
 
- Public Types inherited from DynamicCoordinates
using RealType = QMCTraits::RealType
 
using PosType = QMCTraits::PosType
 
using ParticlePos = PtclOnLatticeTraits::ParticlePos
 
using PosVectorSoa = VectorSoaContainer< RealType, QMCTraits::DIM >
 

Public Member Functions

 RealSpacePositions ()
 
std::unique_ptr< DynamicCoordinatesmakeClone () override
 
void resize (size_t n) override
 resize internal storages based on the number of particles More...
 
size_t size () const override
 return the number of particles More...
 
void setAllParticlePos (const ParticlePos &R) override
 overwrite the positions of all the particles. More...
 
void setOneParticlePos (const PosType &pos, size_t iat) override
 overwrite the position of one the particle. More...
 
void mw_acceptParticlePos (const RefVectorWithLeader< DynamicCoordinates > &coords_list, size_t iat, const std::vector< PosType > &new_positions, const std::vector< bool > &isAccepted) const override
 overwrite the positions of particles with a uniform id in all the walkers upon acceptance. More...
 
const PosVectorSoagetAllParticlePos () const override
 all particle position accessor More...
 
PosType getOneParticlePos (size_t iat) const override
 one particle position accessor More...
 
- Public Member Functions inherited from DynamicCoordinates
 DynamicCoordinates (const DynamicCoordinateKind kind_in)
 
 DynamicCoordinates (const DynamicCoordinates &)=default
 
DynamicCoordinatesoperator= (const DynamicCoordinates &)=delete
 
DynamicCoordinateKind getKind () const
 
virtual ~DynamicCoordinates ()=default
 
virtual void mw_copyActivePos (const RefVectorWithLeader< DynamicCoordinates > &coords_list, size_t iat, const std::vector< PosType > &new_positions) const
 copy the active positions of particles with a uniform id in all the walkers to a single internal buffer. More...
 
virtual void donePbyP ()
 secure internal data consistency after p-by-p moves More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to a collection More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< DynamicCoordinates > &coords_list) const
 acquire a shared resource from a collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< DynamicCoordinates > &coords_list) const
 return a shared resource to a collection More...
 

Private Attributes

PosVectorSoa RSoA
 particle positions in SoA layout More...
 

Additional Inherited Members

- Protected Attributes inherited from DynamicCoordinates
const DynamicCoordinateKind variable_kind_
 type of dynamic coordinates More...
 

Detailed Description

Introduced to handle virtual moves and ratio computations, e.g.

for non-local PP evaluations.

Definition at line 25 of file RealSpacePositions.h.

Member Typedef Documentation

◆ ParticlePos

◆ PosType

Definition at line 30 of file RealSpacePositions.h.

◆ RealType

Definition at line 29 of file RealSpacePositions.h.

Constructor & Destructor Documentation

◆ RealSpacePositions()

Member Function Documentation

◆ getAllParticlePos()

const PosVectorSoa& getAllParticlePos ( ) const
inlineoverridevirtual

all particle position accessor

Implements DynamicCoordinates.

Definition at line 57 of file RealSpacePositions.h.

References RealSpacePositions::RSoA.

57 { return RSoA; }
PosVectorSoa RSoA
particle positions in SoA layout

◆ getOneParticlePos()

PosType getOneParticlePos ( size_t  iat) const
inlineoverridevirtual

one particle position accessor

Implements DynamicCoordinates.

Definition at line 58 of file RealSpacePositions.h.

References RealSpacePositions::RSoA.

58 { return RSoA[iat]; }
PosVectorSoa RSoA
particle positions in SoA layout

◆ makeClone()

std::unique_ptr<DynamicCoordinates> makeClone ( )
inlineoverridevirtual

Implements DynamicCoordinates.

Definition at line 34 of file RealSpacePositions.h.

34 { return std::make_unique<RealSpacePositions>(*this); }

◆ mw_acceptParticlePos()

void mw_acceptParticlePos ( const RefVectorWithLeader< DynamicCoordinates > &  coords_list,
size_t  iat,
const std::vector< PosType > &  new_positions,
const std::vector< bool > &  isAccepted 
) const
inlineoverridevirtual

overwrite the positions of particles with a uniform id in all the walkers upon acceptance.

Parameters
coords_lista batch of DynamicCoordinates
iatparicle id, uniform across coords_list
new_positionsproposed positions
isAcceptedaccept/reject info

Implements DynamicCoordinates.

Definition at line 46 of file RealSpacePositions.h.

References RefVectorWithLeader< T >::getLeader().

50  {
51  assert(this == &coords_list.getLeader());
52  for (size_t iw = 0; iw < isAccepted.size(); iw++)
53  if (isAccepted[iw])
54  coords_list[iw].setOneParticlePos(new_positions[iw], iat);
55  }

◆ resize()

void resize ( size_t  n)
inlineoverridevirtual

resize internal storages based on the number of particles

Parameters
nthe number of particles

Implements DynamicCoordinates.

Definition at line 36 of file RealSpacePositions.h.

References qmcplusplus::n, VectorSoaContainer< T, D, Alloc >::resize(), and RealSpacePositions::RSoA.

Referenced by RealSpacePositions::setAllParticlePos().

36 { RSoA.resize(n); }
PosVectorSoa RSoA
particle positions in SoA layout
void resize(size_type n)
resize myData

◆ setAllParticlePos()

void setAllParticlePos ( const ParticlePos R)
inlineoverridevirtual

overwrite the positions of all the particles.

Implements DynamicCoordinates.

Definition at line 39 of file RealSpacePositions.h.

References VectorSoaContainer< T, D, Alloc >::copyIn(), RealSpacePositions::resize(), RealSpacePositions::RSoA, and Vector< T, Alloc >::size().

40  {
41  resize(R.size());
42  RSoA.copyIn(R);
43  }
PosVectorSoa RSoA
particle positions in SoA layout
void copyIn(const Vector< TinyVector< T, D >> &in)
AoS to SoA : copy from Vector<TinyVector<>>
void resize(size_t n) override
resize internal storages based on the number of particles

◆ setOneParticlePos()

void setOneParticlePos ( const PosType pos,
size_t  iat 
)
inlineoverridevirtual

overwrite the position of one the particle.

Implements DynamicCoordinates.

Definition at line 44 of file RealSpacePositions.h.

References RealSpacePositions::RSoA.

44 { RSoA(iat) = pos; }
PosVectorSoa RSoA
particle positions in SoA layout

◆ size()

size_t size ( ) const
inlineoverridevirtual

return the number of particles

Implements DynamicCoordinates.

Definition at line 37 of file RealSpacePositions.h.

References RealSpacePositions::RSoA, and VectorSoaContainer< T, D, Alloc >::size().

37 { return RSoA.size(); }
PosVectorSoa RSoA
particle positions in SoA layout
size_type size() const
return the physical size

Member Data Documentation

◆ RSoA


The documentation for this class was generated from the following file: