PSCF v1.2
Pscf::Rpg::WaveList< D > Class Template Reference

Class to calculate and store properties of wavevectors. More...

#include <WaveList.h>

Public Member Functions

 WaveList ()
 Constructor.
 
 ~WaveList ()
 Destructor.
 
void allocate (Mesh< D > const &m, UnitCell< D > const &c)
 Allocate memory and set association with a Mesh and UnitCell object.
 
void clearUnitCellData ()
 Clear all internal data that depends on lattice parameters.
 
void computeMinimumImages ()
 Compute minimum images of wavevectors.
 
void computeKSq ()
 Compute sq.
 
void computedKSq ()
 Compute derivatives of |k|^2 w/ respect to unit cell parameters.
 
DeviceArray< int > const & minImages () const
 Get the array of minimum images on the device by reference.
 
RField< D > const & kSq () const
 Get the kSq array on the device by reference.
 
DeviceArray< cudaReal > const & dKSq () const
 Get the full dKSq array on the device by reference.
 
RField< D > const & dKSq (int i) const
 Get the slice of the dKSq array for parameter i by reference.
 
DeviceArray< bool > const & implicitInverse () const
 Get the implicitInverse array by reference.
 
bool hasVariableAngle () const
 Does this unit cell have an angle that can change?
 
bool isAllocated () const
 Has memory been allocated for arrays?
 
bool hasMinimumImages () const
 Have minimum images been computed?
 
bool hasKSq () const
 Has the kSq array been computed?
 
bool hasdKSq () const
 Has the dKSq array been computed?
 

Detailed Description

template<int D>
class Pscf::Rpg::WaveList< D >

Class to calculate and store properties of wavevectors.

In particular, minimum images, square norms of wavevectors (kSq), and derivatives of the square norms of wavevectors with respect to the lattice parameters (dKSq) are calculated and stored by this class. Any time the lattice parameters change the clearUnitCellData() method should be called, which will effectively reset the WaveList object so that the wavevector properties will need to be recalculated before being used.

Definition at line 38 of file WaveList.h.

Constructor & Destructor Documentation

◆ WaveList()

template<int D>
Pscf::Rpg::WaveList< D >::WaveList ( )

Constructor.

Definition at line 410 of file WaveList.tpp.

◆ ~WaveList()

template<int D>
Pscf::Rpg::WaveList< D >::~WaveList ( )

Destructor.

Definition at line 421 of file WaveList.tpp.

Member Function Documentation

◆ allocate()

template<int D>
void Pscf::Rpg::WaveList< D >::allocate ( Mesh< D > const & m,
UnitCell< D > const & c )

Allocate memory and set association with a Mesh and UnitCell object.

Parameters
mspatial discretization mesh (input)
ccrystallographic unit cell (input)

Definition at line 425 of file WaveList.tpp.

References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Pscf::Prdc::UnitCellBase< D >::nParameter(), Pscf::MeshIterator< D >::position(), Pscf::MeshIterator< D >::rank(), Pscf::Mesh< D >::size(), and UTIL_CHECK.

◆ clearUnitCellData()

template<int D>
void Pscf::Rpg::WaveList< D >::clearUnitCellData ( )

Clear all internal data that depends on lattice parameters.

Sets hasKSq_ and hasdKSq_ to false, and sets hasMinimumImages_ to false if hasVariableAngle == true.

Definition at line 479 of file WaveList.tpp.

◆ computeMinimumImages()

template<int D>
void Pscf::Rpg::WaveList< D >::computeMinimumImages ( )

Compute minimum images of wavevectors.

(Also calculates kSq.)

The minimum images may change if a lattice angle in the unit cell is changed, so this method should be called whenever such changes occur. The method hasVariableAngle() identifies whether the minimum images may change under changes in the lattice parameters.

In the process of computing the minimum images, the square norm |k|^2 for all wavevectors is also calculated and stored, so it is not necessary to call computeKSq after calling this method. computeKSq is provided to allow calculation of kSq without recalculating minimum images.

Definition at line 489 of file WaveList.tpp.

References Pscf::MeshIterator< D >::atEnd(), Pscf::MeshIterator< D >::begin(), Pscf::DeviceArray< Data >::cArray(), Util::Log::file(), Pscf::MeshIterator< D >::position(), Pscf::MeshIterator< D >::rank(), Pscf::ThreadArray::setThreadsLogical(), Pscf::ThreadArray::setThreadsPerBlock(), and UTIL_CHECK.

◆ computeKSq()

template<int D>
void Pscf::Rpg::WaveList< D >::computeKSq ( )

Compute sq.

norm |k|^2 for all wavevectors, using existing min images.

Definition at line 561 of file WaveList.tpp.

References Pscf::DeviceArray< Data >::cArray(), Pscf::ThreadArray::setThreadsLogical(), and UTIL_CHECK.

◆ computedKSq()

template<int D>
void Pscf::Rpg::WaveList< D >::computedKSq ( )

Compute derivatives of |k|^2 w/ respect to unit cell parameters.

Definition at line 602 of file WaveList.tpp.

References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::ThreadArray::setThreadsLogical(), and UTIL_CHECK.

◆ minImages()

template<int D>
DeviceArray< int > const & Pscf::Rpg::WaveList< D >::minImages ( ) const
inline

Get the array of minimum images on the device by reference.

The array has size kSize * D, where kSize is the number of grid points in reciprocal space. The array is unwrapped into a linear array in an index-by-index manner, in which the first kSize elements of the array contain the first index of each minimum image, and so on.

Definition at line 230 of file WaveList.h.

References UTIL_CHECK.

◆ kSq()

template<int D>
RField< D > const & Pscf::Rpg::WaveList< D >::kSq ( ) const
inline

Get the kSq array on the device by reference.

Definition at line 238 of file WaveList.h.

References UTIL_CHECK.

◆ dKSq() [1/2]

template<int D>
DeviceArray< cudaReal > const & Pscf::Rpg::WaveList< D >::dKSq ( ) const
inline

Get the full dKSq array on the device by reference.

The array has size kSize * nParams, where kSize is the number of grid points in reciprocal space and nParams is the number of lattice parameters. The array is unwrapped into a linear array in which the first kSize elements of the array contain dKSq for the first lattice parameter, and so on.

Definition at line 246 of file WaveList.h.

References UTIL_CHECK.

◆ dKSq() [2/2]

template<int D>
RField< D > const & Pscf::Rpg::WaveList< D >::dKSq ( int i) const
inline

Get the slice of the dKSq array for parameter i by reference.

Parameters
iindex of lattice parameter

Definition at line 254 of file WaveList.h.

References UTIL_CHECK.

◆ implicitInverse()

template<int D>
DeviceArray< bool > const & Pscf::Rpg::WaveList< D >::implicitInverse ( ) const
inline

Get the implicitInverse array by reference.

This array is defined on a k-grid mesh, with a boolean value for each gridpoint. The boolean represents whether the inverse of the wave at the given gridpoint is an implicit wave. Implicit here is used to mean any wave that is outside the bounds of the k-grid.

Definition at line 262 of file WaveList.h.

References UTIL_CHECK.

◆ hasVariableAngle()

template<int D>
bool Pscf::Rpg::WaveList< D >::hasVariableAngle ( ) const

Does this unit cell have an angle that can change?

The minimum images can only change if one of the lattice parameters is an angle that may vary. Therefore, this method checks the crystal system and returns true if there are any angles that may vary.

◆ isAllocated()

template<int D>
bool Pscf::Rpg::WaveList< D >::isAllocated ( ) const
inline

Has memory been allocated for arrays?

Definition at line 149 of file WaveList.h.

◆ hasMinimumImages()

template<int D>
bool Pscf::Rpg::WaveList< D >::hasMinimumImages ( ) const
inline

Have minimum images been computed?

Definition at line 155 of file WaveList.h.

◆ hasKSq()

template<int D>
bool Pscf::Rpg::WaveList< D >::hasKSq ( ) const
inline

Has the kSq array been computed?

Definition at line 161 of file WaveList.h.

◆ hasdKSq()

template<int D>
bool Pscf::Rpg::WaveList< D >::hasdKSq ( ) const
inline

Has the dKSq array been computed?

Definition at line 167 of file WaveList.h.


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