ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Functions
KVectorUtils Namespace Reference

Functions

void kvec_d2c (K_Vectors &kv, const ModuleBase::Matrix3 &reciprocal_vec)
 
void kvec_c2d (K_Vectors &kv, const ModuleBase::Matrix3 &latvec)
 
void set_both_kvec (K_Vectors &kv, const ModuleBase::Matrix3 &G, const ModuleBase::Matrix3 &R, std::string &skpt)
 Sets both the direct and Cartesian k-vectors.
 
void set_after_vc (K_Vectors &kv, const int &nspin, const ModuleBase::Matrix3 &G)
 Sets up the k-points after a volume change.
 
void print_klists (const K_Vectors &kv, std::ofstream &ofs)
 Prints the k-points in both Cartesian and direct coordinates.
 
void kvec_mpi_k (K_Vectors &kv)
 Distributes k-points among MPI processes.
 
void kvec_ibz_kpoint (K_Vectors &kv, const ModuleSymmetry::Symmetry &symm, bool use_symm, std::string &skpt, const UnitCell &ucell, bool &match)
 Generates irreducible k-points in the Brillouin zone considering symmetry operations.
 

Function Documentation

◆ kvec_c2d()

void KVectorUtils::kvec_c2d ( K_Vectors kv,
const ModuleBase::Matrix3 latvec 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvec_d2c()

void KVectorUtils::kvec_d2c ( K_Vectors kv,
const ModuleBase::Matrix3 reciprocal_vec 
)
Here is the caller graph for this function:

◆ kvec_ibz_kpoint()

void KVectorUtils::kvec_ibz_kpoint ( K_Vectors kv,
const ModuleSymmetry::Symmetry symm,
bool  use_symm,
std::string &  skpt,
const UnitCell ucell,
bool &  match 
)

Generates irreducible k-points in the Brillouin zone considering symmetry operations.

This function calculates the irreducible k-points (IBZ) from the given k-points, taking into account the symmetry of the unit cell. It updates the symmetry-matched k-points and generates the corresponding weight for each k-point.

Parameters
symmThe symmetry information of the system.
use_symmA flag indicating whether to use symmetry operations.
skptA string to store the formatted k-points information.
ucellThe unit cell of the crystal.
matchA boolean flag that indicates if the results matches the real condition.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvec_mpi_k()

void KVectorUtils::kvec_mpi_k ( K_Vectors kv)

Distributes k-points among MPI processes.

This function distributes the k-points among the MPI processes. Each process gets a subset of the k-points to work on. The function also broadcasts various variables related to the k-points to all processes.

Parameters
kvThe K_Vectors object containing the k-point information.
Returns
void
Note
This function is only compiled and used if MPI is enabled.
The function assumes that the number of k-points (nkstot) is greater than 0.
The function broadcasts the flags kc_done and kd_done, the number of spins (nspin), the total number of k-points (nkstot), the full number of k-points (nkstot_full), the Monkhorst-Pack grid (nmp), the k-point offsets (koffset), and the segment IDs of the k-points (kl_segids).
The function also broadcasts the indices of the k-points (isk), their weights (wk), and their Cartesian and direct coordinates (kvec_c and kvec_d).
If a process has no k-points to work on, the function will quit with an error message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_klists()

void KVectorUtils::print_klists ( const K_Vectors kv,
std::ofstream &  ofs 
)

Prints the k-points in both Cartesian and direct coordinates.

This function prints the k-points in both Cartesian and direct coordinates to the output file stream. The output includes the index, x, y, and z coordinates, and the weight of each k-point.

Parameters
ofsThe output file stream to which the k-points are printed.
Returns
void
Note
The function first checks if the total number of k-points (nkstot) is less than the number of k-points for the current spin (nks). If so, it prints an error message and quits.
The function prints the k-points in a table format, with separate tables for Cartesian and direct coordinates.
The function uses the FmtCore::format function to format the output.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_after_vc()

void KVectorUtils::set_after_vc ( K_Vectors kv,
const int &  nspin,
const ModuleBase::Matrix3 G 
)

Sets up the k-points after a volume change.

This function sets up the k-points after a volume change in the system. It sets the Cartesian and direct k-vectors based on the new reciprocal and real space lattice vectors.

Parameters
kvThe K_Vectors object containing the k-point information.
nspin_inThe number of spins. 1 for non-spin-polarized calculations and 2 for spin-polarized calculations.
reciprocal_vecThe new reciprocal lattice matrix.
Returns
void
Note
The function first sets the number of spins (nspin) to the input value.
The direct k-vectors have been set (kd_done = true) but the Cartesian k-vectors have not (kc_done = false) after a volume change. The function calculates the Cartesian k-vectors by multiplying the direct k-vectors with the reciprocal lattice matrix.
The function also prints a table of the direct k-vectors and their weights.
The function calls the print_klists function to print the k-points in both Cartesian and direct coordinates.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_both_kvec()

void KVectorUtils::set_both_kvec ( K_Vectors kv,
const ModuleBase::Matrix3 G,
const ModuleBase::Matrix3 R,
std::string &  skpt 
)

Sets both the direct and Cartesian k-vectors.

This function sets both the direct and Cartesian k-vectors based on the input parameters. It also checks the k-point type and sets the corresponding flags.

Parameters
kvThe K_Vectors object containing the k-point information.
GThe reciprocal lattice matrix.
RThe real space lattice matrix.
skptA string to store the k-point table.
Returns
void
Note
If the k-point type is neither "Cartesian" nor "Direct", an error message will be printed.
The function sets the flags kd_done and kc_done to indicate whether the direct and Cartesian k-vectors have been set, respectively.
The function also prints a table of the direct k-vectors and their weights.
If the function is called by the master process (MY_RANK == 0), the k-point table is also stored in the string skpt.
Here is the call graph for this function:
Here is the caller graph for this function: