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

Classes

struct  LineK
 Result of line-mode interpolation between special k-points. More...

Functions

std::string ibz_kpt_table (int nkstot, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const std::vector< int > &ibz_index, const std::vector< ModuleBase::Vector3< double > > &kvec_d_ibz)
 Render the IBZ reduction table ("IBZ" k-point -> originating k-point).
std::string ibz_wk_table (int nkstot_ibz, const std::vector< ModuleBase::Vector3< double > > &kvec_d_ibz, const std::vector< double > &wk_ibz, const std::vector< int > &ibz2bz)
 Render the IBZ weight table (IBZ k-point, weight, multiplicity, origin index).
bool find_kpoints_header (std::ifstream &ifk)
void read_kpt_list (std::ifstream &ifk, const int nkstot, std::vector< ModuleBase::Vector3< double > > &kvec, std::vector< double > &wk)
LineK interp_line (std::ifstream &ifk, const int nks_special)
void build_kstars (const std::vector< ModuleBase::Vector3< double > > &kvec_d, const std::vector< ModuleBase::Matrix3 > &kgmatrix, const int nrotkm, const std::vector< ModuleBase::Vector3< double > > &kvec_d_ibz, const double epsilon, std::vector< std::map< int, ModuleBase::Vector3< double > > > &kstars)
int append_time_reversal_ops (const ModuleSymmetry::Symmetry &symm, std::vector< ModuleBase::Matrix3 > &kgmatrix, const int nrotkm)
void pack_kpts (const std::vector< int > &isk, const std::vector< double > &wk, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const std::vector< ModuleBase::Vector3< double > > &kvec_c_full, const int nkstot, std::vector< int > &isk_aux, std::vector< double > &wk_aux, std::vector< double > &kvec_c_aux, std::vector< double > &kvec_d_aux, std::vector< double > &kvec_c_full_aux)
void unpack_kpts (const std::vector< int > &isk_aux, const std::vector< double > &wk_aux, const std::vector< double > &kvec_c_aux, const std::vector< double > &kvec_d_aux, const std::vector< double > &kvec_c_full_aux, const int nks, const int startk, std::vector< int > &isk, std::vector< double > &wk, std::vector< ModuleBase::Vector3< double > > &kvec_c, std::vector< ModuleBase::Vector3< double > > &kvec_d, std::vector< ModuleBase::Vector3< double > > &kvec_c_full)
void bcast_kstars (std::vector< std::map< int, ModuleBase::Vector3< double > > > &kstars, const int nkstot, const int my_rank)
void fill_full_kvec (const bool kc_done, const bool kd_done, const int nkstot_nospin, const ModuleBase::Matrix3 &reciprocal_vec, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const std::vector< ModuleBase::Vector3< double > > &kvec_d, std::vector< ModuleBase::Vector3< double > > &kvec_c_full)
void build_ik2iktot (const int my_pool, const std::vector< int > &startk_pool, const int spin_mult, const int nks, const int nkstot, std::vector< int > &ik2iktot)
void expand_spin_kpoints (const int spin_mult, std::vector< ModuleBase::Vector3< double > > &kvec_c, std::vector< ModuleBase::Vector3< double > > &kvec_d, std::vector< double > &wk, std::vector< int > &isk, int &nks, int &nkstot)
void write_auto_kfile (const UnitCell &ucell, const std::string &fn, const bool gamma_only_local, const double kspacing[3], const std::string &kmesh_type, const double koffset[3], std::ofstream &ofs_warning)

Detailed Description

this-free helpers extracted from K_Vectors, kept in a separate TU so they can be unit-tested and reused without dragging in the K_Vectors class.

Function Documentation

◆ append_time_reversal_ops()

int KListIO::append_time_reversal_ops ( const ModuleSymmetry::Symmetry & symm,
std::vector< ModuleBase::Matrix3 > & kgmatrix,
int nrotkm )

Append the time-reversal-related k-point symmetry operations into kgmatrix (the slots right after the first nrotkm operations must be available). For magnetic nspin=4 systems the antiunitary Theta*g coset is appended from symm.kgmatrix_anti; otherwise the inverted -g ops are appended unless inversion is already present. Returns the updated total operation count.

Here is the caller graph for this function:

◆ bcast_kstars()

void KListIO::bcast_kstars ( std::vector< std::map< int, ModuleBase::Vector3< double > > > & kstars,
int nkstot,
int my_rank )

Broadcast the EXX k-stars (one (symmetry-index, k-vector) map per IBZ k-point) from my_rank == 0 to every process. Rank 0 holds the filled maps; other ranks resize and rebuild them from the broadcast. MPI wrappers are compiled as no-ops without __MPI, so the call is safe in serial builds (it simply leaves the rank-0 maps untouched).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_ik2iktot()

void KListIO::build_ik2iktot ( int my_pool,
const std::vector< int > & startk_pool,
int spin_mult,
int nks,
int nkstot,
std::vector< int > & ik2iktot )

Build the local-to-global k-point index map ik2iktot for this pool. In MPI runs the global index is offset by the pool start (with the spin_mult == 2 second half offset by nkstot/2); in serial runs it is the local index itself. ik2iktot is resized to nks here. this-free helper called from K_Vectors::set() after the pool distribution.

Here is the caller graph for this function:

◆ build_kstars()

void KListIO::build_kstars ( const std::vector< ModuleBase::Vector3< double > > & kvec_d,
const std::vector< ModuleBase::Matrix3 > & kgmatrix,
int nrotkm,
const std::vector< ModuleBase::Vector3< double > > & kvec_d_ibz,
double epsilon,
std::vector< std::map< int, ModuleBase::Vector3< double > > > & kstars )

Build the EXX k-stars: for every k point, find the symmetry operation (index into kgmatrix) that rotates it onto an irreducible k point, and group k points by that IBZ representative using periodic equivalence. epsilon is the symmetry and k-restriction tolerance. this-free so the heavy triple loop is isolated and testable.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expand_spin_kpoints()

void KListIO::expand_spin_kpoints ( int spin_mult,
std::vector< ModuleBase::Vector3< double > > & kvec_c,
std::vector< ModuleBase::Vector3< double > > & kvec_d,
std::vector< double > & wk,
std::vector< int > & isk,
int & nks,
int & nkstot )

Expand the k-point list for spin-polarized runs (spin_mult == 2): copy coordinates and weights into the second half, tag isk 0 for the first half and 1 for the second, then double nks/nkstot. For spin_mult == 1 only isk is zeroed. The running-log output stays in the K_Vectors wrapper. this-free helper backing K_Vectors::set_kup_and_kdw.

Here is the caller graph for this function:

◆ fill_full_kvec()

void KListIO::fill_full_kvec ( bool kc_done,
bool kd_done,
int nkstot_nospin,
const ModuleBase::Matrix3 & reciprocal_vec,
const std::vector< ModuleBase::Vector3< double > > & kvec_c,
const std::vector< ModuleBase::Vector3< double > > & kvec_d,
std::vector< ModuleBase::Vector3< double > > & kvec_c_full )

Fill the full-list Cartesian k vectors when only one coordinate set is available: direct coordinates are converted via reciprocal_vec when Cartesian points are missing, otherwise the Cartesian points are copied. No-op when both coordinate sets are done. this-free helper called from K_Vectors::set() before IBZ reduction.

Here is the caller graph for this function:

◆ find_kpoints_header()

bool KListIO::find_kpoints_header ( std::ifstream & ifk)

Scan ifk for the "K_POINTS"/"KPOINTS"/"K" header keyword, skipping any leading comment lines. Returns true with the stream positioned after the header line; returns false if the keyword is not found before EOF.

Here is the caller graph for this function:

◆ ibz_kpt_table()

std::string KListIO::ibz_kpt_table ( const int nkstot,
const std::vector< ModuleBase::Vector3< double > > & kvec_d,
const std::vector< int > & ibz_index,
const std::vector< ModuleBase::Vector3< double > > & kvec_d_ibz )

Render the IBZ reduction table ("IBZ" k-point -> originating k-point).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ibz_wk_table()

std::string KListIO::ibz_wk_table ( const int nkstot_ibz,
const std::vector< ModuleBase::Vector3< double > > & kvec_d_ibz,
const std::vector< double > & wk_ibz,
const std::vector< int > & ibz2bz )

Render the IBZ weight table (IBZ k-point, weight, multiplicity, origin index).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ interp_line()

LineK KListIO::interp_line ( std::ifstream & ifk,
int nks_special )

Read the special k points and per-point interpolation counts from ifk, then linearly interpolate the line-mode k points. Pure function of the stream and nks_special; dies via WARNING_QUIT on malformed input.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pack_kpts()

void KListIO::pack_kpts ( const std::vector< int > & isk,
const std::vector< double > & wk,
const std::vector< ModuleBase::Vector3< double > > & kvec_c,
const std::vector< ModuleBase::Vector3< double > > & kvec_d,
const std::vector< ModuleBase::Vector3< double > > & kvec_c_full,
int nkstot,
std::vector< int > & isk_aux,
std::vector< double > & wk_aux,
std::vector< double > & kvec_c_aux,
std::vector< double > & kvec_d_aux,
std::vector< double > & kvec_c_full_aux )

Flatten k-point arrays into contiguous MPI buffers (x,y,z interleaved). this-free; used on rank 0 before broadcasting in K_Vectors::mpi_k.

Here is the caller graph for this function:

◆ read_kpt_list()

void KListIO::read_kpt_list ( std::ifstream & ifk,
int nkstot,
std::vector< ModuleBase::Vector3< double > > & kvec,
std::vector< double > & wk )

Read nkstot explicit k points (three coordinates plus a weight per line) from ifk into kvec and wk. The caller is responsible for sizing the arrays (K_Vectors::renew) before calling.

Here is the caller graph for this function:

◆ unpack_kpts()

void KListIO::unpack_kpts ( const std::vector< int > & isk_aux,
const std::vector< double > & wk_aux,
const std::vector< double > & kvec_c_aux,
const std::vector< double > & kvec_d_aux,
const std::vector< double > & kvec_c_full_aux,
int nks,
int startk,
std::vector< int > & isk,
std::vector< double > & wk,
std::vector< ModuleBase::Vector3< double > > & kvec_c,
std::vector< ModuleBase::Vector3< double > > & kvec_d,
std::vector< ModuleBase::Vector3< double > > & kvec_c_full )

Scatter the broadcast buffers into this pool's k-point slice, starting at global index startk. this-free; mirrors pack_kpts after the broadcast.

Here is the caller graph for this function:

◆ write_auto_kfile()

void KListIO::write_auto_kfile ( const UnitCell & ucell,
const std::string & fn,
bool gamma_only_local,
const double kspacing[3],
const std::string & kmesh_type,
const double koffset[3],
std::ofstream & ofs_warning )

Overwrite the KPT file with an auto-generated mesh when requested: a single Gamma point if gamma_only_local, or a KSPACING-derived Gamma/Monkhorst-Pack mesh if kspacing[0] > 0 (quits if kspacing[1] or kspacing[2] is non-positive); does nothing otherwise. this-free helper backing K_Vectors::generate_kfile.

Here is the call graph for this function:
Here is the caller graph for this function: