SIRIUS 7.5.0
Electronic structure library and applications
|
A set of G-vectors for FFTs and G+k basis functions. More...
#include <gvec.hpp>
Public Member Functions | |
Gvec (r3::vector< double > vk__, r3::matrix< double > M__, double Gmax__, mpi::Communicator const &comm__, bool reduce_gvec__, double sym_tol__=1e-6) | |
Constructor for G+k vectors. More... | |
Gvec (r3::matrix< double > M__, double Gmax__, mpi::Communicator const &comm__, bool reduce_gvec__, double sym_tol__=1e-6) | |
Constructor for G-vectors. More... | |
Gvec (r3::matrix< double > M__, double Gmax__, fft::Grid const &fft_grid__, mpi::Communicator const &comm__, bool reduce_gvec__, double sym_tol__=1e-6) | |
Constructor for G-vectors. More... | |
Gvec (double Gmax__, Gvec const &gvec_base__) | |
Constructor for G-vector distribution based on a previous set. More... | |
Gvec (r3::matrix< double > M__, double Gmax__, bool reduce_gvec__, double sym_tol__=1e-6) | |
Constructor for G-vectors with mpi_comm_self() More... | |
Gvec (r3::vector< double > vk__, r3::matrix< double > M__, int ngv_loc__, int const *gv__, mpi::Communicator const &comm__, bool reduce_gvec__) | |
Construct with the defined order of G-vectors. More... | |
Gvec (mpi::Communicator const &comm__) | |
Constructor for empty set of G-vectors. More... | |
Gvec & | operator= (Gvec &&src__)=default |
Move assignment operator. | |
Gvec (Gvec &&src__)=default | |
Move constructor. | |
auto const & | vk () const |
mpi::Communicator const & | comm () const |
auto const & | lattice_vectors (r3::matrix< double > lattice_vectors__) |
Set the new reciprocal lattice vectors. More... | |
auto const & | lattice_vectors () const |
Retrn a const reference to the reciprocal lattice vectors. More... | |
auto const | unit_cell_lattice_vectors () const |
double | omega () const |
Return the volume of the real space unit cell that corresponds to the reciprocal lattice of G-vectors. More... | |
int | num_gvec () const |
Return the total number of G-vectors within the cutoff. More... | |
int | zcol_count (int rank__) const |
Number of z-columns for a fine-grained distribution. More... | |
int | zcol_offset (int rank__) const |
Offset in the global index of z-columns for a given rank. More... | |
int | gvec_count (int rank__) const |
Number of G-vectors for a fine-grained distribution. More... | |
int | count () const |
Number of G-vectors for a fine-grained distribution for the current MPI rank. More... | |
int | gvec_offset (int rank__) const |
Offset (in the global index) of G-vectors for a fine-grained distribution. More... | |
int | offset () const |
Offset (in the global index) of G-vectors for a fine-grained distribution for a current MPI rank. More... | |
int | skip_g0 () const |
Local starting index of G-vectors if G=0 is not counted. More... | |
int | num_shells () const |
Return number of G-vector shells. More... | |
template<index_domain_t idx_t> | |
r3::vector< int > | gvec (int ig__) const |
Return G vector in fractional coordinates. More... | |
template<index_domain_t idx_t> | |
r3::vector< double > | gkvec (int ig__) const |
Return G+k vector in fractional coordinates. More... | |
template<index_domain_t idx_t> | |
r3::vector< double > | gvec_cart (int ig__) const |
Return G vector in Cartesian coordinates. More... | |
template<index_domain_t idx_t> | |
r3::vector< double > | gkvec_cart (int ig__) const |
Return G+k vector in fractional coordinates. More... | |
int | shell (int ig__) const |
Return index of the G-vector shell by the G-vector index. More... | |
int | shell (r3::vector< int > const &G__) const |
double | shell_len (int igs__) const |
Return length of the G-vector shell. More... | |
std::vector< double > | shells_len () const |
Get lengths of all G-vector shells. More... | |
template<index_domain_t idx_t> | |
double | gvec_len (int ig__) const |
Return length of the G-vector. More... | |
int | index_g12 (r3::vector< int > const &g1__, r3::vector< int > const &g2__) const |
std::pair< int, bool > | index_g12_safe (r3::vector< int > const &g1__, r3::vector< int > const &g2__) const |
int | index_by_gvec (r3::vector< int > const &G__) const |
Return a global G-vector index in the range [0, num_gvec) by the G-vector. More... | |
bool | reduced () const |
bool | bare () const |
int | num_zcol () const |
Return global number of z-columns. More... | |
int | num_zcol_local () const |
Return local number of z-columns. More... | |
z_column_descriptor const & | zcol (size_t idx__) const |
int | gvec_base_mapping (int igloc_base__) const |
int | num_gvec_shells_local () const |
double | gvec_shell_len_local (int idx__) const |
int | gvec_shell_idx_local (int igloc__) const |
auto const & | gvec_local () const |
Return local list of G-vectors. More... | |
auto | gvec_local (int rank__) const |
Return local list of G-vectors for a given rank. More... | |
auto & | gvec_tp () |
auto const & | gvec_tp () const |
auto & | gkvec_tp () |
auto const & | gkvec_tp () const |
Private Member Functions | |
r3::vector< int > | gvec_by_full_index (uint32_t idx__) const |
Return corresponding G-vector for an index in the range [0, num_gvec). More... | |
void | find_z_columns (double Gmax__, fft::Grid const &fft_box__) |
Find z-columns of G-vectors inside a sphere with Gmax radius. More... | |
void | distribute_z_columns () |
Distribute z-columns between MPI ranks. More... | |
void | find_gvec_shells () |
Find a list of G-vector shells. More... | |
void | init_gvec_local () |
Initialize lattice coordinates of the local fraction of G-vectors. More... | |
void | init_gvec_cart_local () |
Initialize Cartesian coordinates of the local fraction of G-vectors. More... | |
void | init (fft::Grid const &fft_grid) |
Initialize everything. More... | |
Gvec (Gvec const &src__)=delete | |
Gvec & | operator= (Gvec const &src__)=delete |
Private Attributes | |
r3::vector< double > | vk_ {0, 0, 0} |
k-vector of G+k. More... | |
double | Gmax_ {0} |
Cutoff for |G+k| vectors. More... | |
r3::matrix< double > | lattice_vectors_ |
Reciprocal lattice vectors. More... | |
mpi::Communicator | comm_ |
Total communicator which is used to distribute G or G+k vectors. More... | |
bool | reduce_gvec_ {false} |
Indicates that G-vectors are reduced by inversion symmetry. More... | |
bool | bare_gvec_ {true} |
True if this a list of G-vectors without k-point shift. More... | |
int | num_gvec_ {0} |
Total number of G-vectors. More... | |
sddk::mdarray< uint32_t, 1 > | gvec_full_index_ |
Mapping between G-vector index [0:num_gvec_) and a full index. More... | |
sddk::mdarray< int, 1 > | gvec_shell_ |
Index of the shell to which the given G-vector belongs. More... | |
int | num_gvec_shells_ |
Number of G-vector shells (groups of G-vectors with the same length). More... | |
sddk::mdarray< double, 1 > | gvec_shell_len_ |
Radii (or lengths) of G-vector shells in a.u.^-1. More... | |
int | num_gvec_shells_local_ |
Local number of G-vector shells for the local number of G-vectors. More... | |
std::vector< double > | gvec_shell_len_local_ |
Radii of G-vector shells in the local index counting [0, num_gvec_shells_local) More... | |
std::vector< int > | gvec_shell_idx_local_ |
Mapping between local index of G-vector and local G-shell index. More... | |
sddk::mdarray< int, 3 > | gvec_index_by_xy_ |
std::vector< z_column_descriptor > | z_columns_ |
Global list of non-zero z-columns. More... | |
mpi::block_data_descriptor | gvec_distr_ |
Fine-grained distribution of G-vectors. More... | |
mpi::block_data_descriptor | zcol_distr_ |
Fine-grained distribution of z-columns. More... | |
Gvec const * | gvec_base_ {nullptr} |
Set of G-vectors on which the current G-vector distribution can be based. More... | |
sddk::mdarray< int, 1 > | gvec_base_mapping_ |
Mapping between current and base G-vector sets. More... | |
sddk::mdarray< int, 2 > | gvec_ |
Lattice coordinates of a local set of G-vectors. More... | |
sddk::mdarray< double, 2 > | gkvec_ |
Lattice coordinates of a local set of G+k-vectors. More... | |
sddk::mdarray< double, 2 > | gvec_cart_ |
Cartiesian coordinaes of a local set of G-vectors. More... | |
sddk::mdarray< double, 2 > | gkvec_cart_ |
Cartesian coordinaes of a local set of G+k-vectors. More... | |
sddk::mdarray< double, 1 > | gvec_len_ |
Length of the local fraction of G-vectors. More... | |
sddk::mdarray< double, 2 > | gvec_tp_ |
sddk::mdarray< double, 2 > | gkvec_tp_ |
int | offset_ {-1} |
Offset in the global index for the local part of G-vectors. More... | |
int | count_ {-1} |
Local number of G-vectors. More... | |
int | num_zcol_local_ {-1} |
Local number of z-columns. More... | |
double | sym_tol_ {1e-6} |
Symmetry tolerance of the real-space lattice. More... | |
Friends | |
void | serialize (serializer &s__, Gvec const &gv__) |
void | deserialize (serializer &s__, Gvec &gv__) |
A set of G-vectors for FFTs and G+k basis functions.
Current implemntation supports up to 2^12 (4096) z-dimension of the FFT grid and 2^20 (1048576) number of z-columns. The order of z-sticks and G-vectors is not fixed and depends on the number of MPI ranks used for the parallelization.
|
inline |
Constructor for G+k vectors.
[in] | vk | K-point vector of G+k |
[in] | M | Reciprocal lattice vectors in column order |
[in] | Gmax | Cutoff for G+k vectors |
[in] | comm | Total communicator which is used to distribute G-vectors |
[in] | reduce_gvec | True if G-vectors need to be reduced by inversion symmetry. |
[in] | sym_tol | Unit cell lattice symmetry tolerance. |
|
inline |
Constructor for G-vectors.
[in] | M | Reciprocal lattice vectors in column order |
[in] | Gmax | Cutoff for G+k vectors |
[in] | comm | Total communicator which is used to distribute G-vectors |
[in] | reduce_gvec | True if G-vectors need to be reduced by inversion symmetry. |
[in] | sym_tol | Unit cell lattice symmetry tolerance. |
|
inline |
Constructor for G-vectors.
[in] | M | Reciprocal lattice vectors in column order |
[in] | Gmax | Cutoff for G+k vectors |
[in] | fft_grid | Provide explicit boundaries for the G-vector min and max frequencies. |
[in] | comm | Total communicator which is used to distribute G-vectors |
[in] | reduce_gvec | True if G-vectors need to be reduced by inversion symmetry. |
[in] | sym_tol | Unit cell lattice symmetry tolerance. |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
std::pair< int, bool > sirius::fft::Gvec::index_g12_safe | ( | r3::vector< int > const & | g1__, |
r3::vector< int > const & | g2__ | ||
) | const |
int sirius::fft::Gvec::index_by_gvec | ( | r3::vector< int > const & | G__ | ) | const |
Return a global G-vector index in the range [0, num_gvec) by the G-vector.
The information about a G-vector index is encoded by two numbers: a starting index for the column of G-vectors and column's size. Depending on the geometry of the reciprocal lattice, z-columns may have only negative, only positive or both negative and positive frequencies for a given x and y. This information is used to compute the offset which is added to the starting index in order to get a full G-vector index. Check find_z_columns() to see how the z-columns are found and added to the list of columns.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Mapping between G-vector index [0:num_gvec_) and a full index.
Full index is used to store x,y,z coordinates in a packed form in a single integer number. The index is equal to ((i << 12) + j) where i is the global index of z_column and j is the index of G-vector z-coordinate in the column i. This is a global array: each MPI rank stores exactly the same copy of the gvec_full_index_.
Limitations: size of z-dimension of FFT grid: 4096, number of z-columns: 1048576
|
private |
|
private |
|
private |
|
private |
Local number of G-vector shells for the local number of G-vectors.
G-vectors are distributed by sticks, not by G-shells. This means that each rank stores local fraction of G-vectors with a non-consecutive G-shell index and not all G-shells are present at a given rank. This variable stores the number of G-shells which this rank holds.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Mapping between current and base G-vector sets.
This mapping allows for a local-to-local copy of PW coefficients without any MPI communication.
Example:
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |