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

Internal helpers shared by the R-space sparse text writers. Declared here (instead of duplicated in each anonymous namespace) so the header layout, R records and file-append rules cannot diverge between hs_sparse_io.cpp, dhs_sparse_writer.cpp, pos_op_csr.cpp, hsr_writer.cpp and write_dmr.cpp. More...

Namespaces

namespace  detail

Classes

class  csrFileReader
 Class to read CSR file. More...
class  FileReader
 A base class of file reader. More...
class  SparseMatrix
 Sparse matrix class designed mainly for csr format input and output. More...
class  CifParser
class  UcellIO
 A class for unit cell I/O operations. More...
 Metadata for a single INPUT parameter. More...
class  ParameterHelp
 Help system for ABACUS INPUT parameters. More...
class  Get_pchg_pw
 Write band-resolved PW partial charges on the dense real-space grid. More...
struct  WriteDHParams
class  Cal_ldos
struct  EijOutputInfo
 Eij output settings and one-based identifiers for one electronic state. More...
class  Angmom_op
struct  SparseWriteOptions
struct  MatROutputOptions
struct  HTermSpec
struct  WriteHParams
struct  MatSparseOutputOptions
class  Cal_MLKEDF_Descriptors
 A class to calculate the descriptors for ML KEDF. Sun, Liang, and Mohan Chen. Physical Review B 109.11 (2024): 115135. Sun, Liang, and Mohan Chen. Electronic Structure 6.4 (2024): 045006. More...
class  Write_MLKEDF_Descriptors
class  Output_DMK
class  Output_Sk
class  Output_Mulliken
 the output interface to write the Mulliken population charges More...
struct  AvailabilityCondition
struct  AvailabilityExpr
struct  InputValue
struct  InputRequirement
class  InputDomain
class  Input_Item
class  ReadInput
class  Get_wf_pw
 Write real-space norms and complex components of selected PW states. More...
struct  CommandLineArgs
class  OutputMullikenNspin4Test

Typedefs

using DosSpectrum = std::vector<std::array<double, 5>>
using RCoordinate = Abfs::Vector3_Order<int>
template<typename T>
using SparseRBlock = std::map<size_t, std::map<size_t, T>>
template<typename T>
using SparseRMatrix = std::map<RCoordinate, SparseRBlock<T>>
using InputValues = std::map<std::string, InputValue>
using TC = std::array<int, 3>
using TAC = std::pair<int, TC>

Enumerations

enum class  AvailabilityValueKind {
  Unknown , Boolean , Integer , Real ,
  String , BooleanVector , IntegerVector , RealVector ,
  StringVector
}

Functions

std::string filename_output (const std::string &directory, const std::string &property, const std::string &basis, const int ik_local, const std::vector< int > &ik2iktot, const int nspin, const int nkstot, const int out_type, const int out_app_flag, const bool gamma_only, const int istep, const int iter)
void read_abacus_orb (std::ifstream &ifs, std::string &elem, double &ecut, int &nr, double &dr, std::vector< int > &nzeta, std::vector< std::vector< double > > &radials, const int rank=0)
 static version of read_abacus_orb. A delete-new operation may cause the memory leak, it is better to use std::vector to replace the raw pointer.
void write_abacus_orb (std::ofstream &ofs, const std::string &elem, const double &ecut, const int nr, const double dr, const std::vector< int > &nzeta, const std::vector< std::vector< double > > &radials, const int rank=0)
int read_exit_file (const int &my_rank, const std::string &filename, std::ofstream &ofs_running)
 read file to determine whether to stop the current execution
void write_csr_banner (std::ostream &ofs)
 Write the CSR-format description banner used by every text CSR output (H(R)/S(R), DM(R), dH/dR, r(R), T(R), Vxc(R), L(R)).
void write_elecstat_pot (const int &bz, const int &nbz, const std::string &fn, const int &istep, ModulePW::PW_Basis *rho_basis, const Charge *const chr, const UnitCell *ucell_, const double *v_eff_fixed, const surchem &solvent, const std::vector< double > *pcc_potential, const std::vector< double > *solvent_potential, const int precision, const bool append, std::ofstream &ofs_running)
 write electric static potential to file
std::string gen_ini_filename (const std::string &prefix, const std::string &out_dir, const int nspin, const int is, const int istep, const bool include_geom_step)
void write_chg_init (const UnitCell &ucell, const Parallel_Grid &para_grid, const Charge &chr, const elecstate::Efermi &efermi, const int istep, const std::string &out_dir, const Input_para &inp, const bool two_fermi, std::ofstream &ofs_running)
void write_pot_init (const UnitCell &ucell, const Parallel_Grid &para_grid, elecstate::ElecState *pelec, const int istep, const std::string &out_dir, const Input_para &inp, const bool two_fermi, std::ofstream &ofs_running)
std::vector< std::string > libxc_r_channel_suffixes (const std::string &data_name, int nspin)
 Build the channel suffixes appended to the cube file names of one Libxc quantity.
template<typename TK, typename TR>
void ctrl_iter_lcao (UnitCell &ucell, const Input_para &inp, K_Vectors &kv, elecstate::ElecState *pelec, module_dm::DensityMatrix< TK, double > &dm, Parallel_Orbitals &pv, Grid_Driver &gd, psi::Psi< TK > *psi, Charge &chr, Charge_Mixing *p_chgmix, hamilt::HamiltLCAO< TK, TR > *p_hamilt, LCAO_Orbitals &orb, Setup_DeePKS< TK > &deepks, Exx_NAO< TK > &exx_nao, const Exx_Info &exx_info, int &iter, const int istep, bool &conv_esolver, const double &scf_ene_thr)
template void ctrl_iter_lcao< double, double > (UnitCell &ucell, const Input_para &inp, K_Vectors &kv, elecstate::ElecState *pelec, module_dm::DensityMatrix< double, double > &dm, Parallel_Orbitals &pv, Grid_Driver &gd, psi::Psi< double > *psi, Charge &chr, Charge_Mixing *p_chgmix, hamilt::HamiltLCAO< double, double > *p_hamilt, LCAO_Orbitals &orb, Setup_DeePKS< double > &deepks, Exx_NAO< double > &exx_nao, const Exx_Info &exx_info, int &iter, const int istep, bool &conv_esolver, const double &scf_ene_thr)
template void ctrl_iter_lcao< std::complex< double >, double > (UnitCell &ucell, const Input_para &inp, K_Vectors &kv, elecstate::ElecState *pelec, module_dm::DensityMatrix< std::complex< double >, double > &dm, Parallel_Orbitals &pv, Grid_Driver &gd, psi::Psi< std::complex< double > > *psi, Charge &chr, Charge_Mixing *p_chgmix, hamilt::HamiltLCAO< std::complex< double >, double > *p_hamilt, LCAO_Orbitals &orb, Setup_DeePKS< std::complex< double > > &deepks, Exx_NAO< std::complex< double > > &exx_nao, const Exx_Info &exx_info, int &iter, const int istep, bool &conv_esolver, const double &scf_ene_thr)
void ctrl_output_fp (UnitCell &ucell, const Input_para &inp, elecstate::ElecState *pelec, ModulePW::PW_Basis_Big *pw_big, ModulePW::PW_Basis *pw_rhod, Charge &chr, surchem &solvent, Parallel_Grid &para_grid, const int istep, std::ofstream &ofs_running)
void ctrl_iter_pw (const int istep, const int iter, const double &conv_esolver, Setup_Psi_pw &stp, const K_Vectors &kv, const ModulePW::PW_Basis_K *pw_wfc, const Input_para &inp, bool final_output, std::ofstream &ofs_running)
template<typename T, typename Device>
void ctrl_scf_pw (const int istep, UnitCell &ucell, elecstate::ElecState *pelec, const Charge &chr, const pseudopot_cell_vnl &ppcell, const K_Vectors &kv, const ModulePW::PW_Basis_K *pw_wfc, const ModulePW::PW_Basis *pw_rho, const ModulePW::PW_Basis *pw_rhod, const ModulePW::PW_Basis_Big *pw_big, Setup_Psi_pw &stp, const Parallel_Grid &para_grid, const Input_para &inp, std::ofstream &ofs_running)
template<typename T, typename Device>
void ctrl_runner_pw (UnitCell &ucell, elecstate::ElecState *pelec, ModulePW::PW_Basis_K *pw_wfc, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis *pw_rhod, Charge &chr, K_Vectors &kv, Setup_Psi_pw &stp, Structure_Factor &sf, pseudopot_cell_vnl &ppcell, surchem &solvent, Parallel_Grid &para_grid, const int istep, const Input_para &inp, std::ofstream &ofs_running)
template<typename T, typename Device>
void ctrl_runner_pw (UnitCell &ucell, elecstate::ElecState *pelec, ModulePW::PW_Basis_K *pw_wfc, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis *pw_rhod, Charge &chr, K_Vectors &kv, Setup_Psi_pw &stp, Structure_Factor &sf, pseudopot_cell_vnl &ppcell, surchem &solvent, const base_device::DeviceContext *ctx, Parallel_Grid &para_grid, const Input_para &inp, std::ofstream &ofs_running)
template<typename TR>
void ctrl_output_td (const UnitCell &ucell, double **rho_save, const ModulePW::PW_Basis *rhopw, const int istep, const psi::Psi< std::complex< double > > *psi, const elecstate::ElecState *pelec, const K_Vectors &kv, const TwoCenterIntegrator *intor, const Parallel_Orbitals *pv, const LCAO_Orbitals &orb, const Velocity_op< TR > *velocity_mat, const Grid_Driver &grid, hamilt::HamiltLCAO< std::complex< double >, TR > *p_hamilt, Record_adj &RA, TD_info *td_p, const Exx_NAO< std::complex< double > > &exx_nao, const Exx_Info &exx_info)
template void ctrl_output_td< double > (const UnitCell &, double **, const ModulePW::PW_Basis *, const int, const psi::Psi< std::complex< double > > *, const elecstate::ElecState *, const K_Vectors &, const TwoCenterIntegrator *, const Parallel_Orbitals *, const LCAO_Orbitals &, const Velocity_op< double > *, const Grid_Driver &, hamilt::HamiltLCAO< std::complex< double >, double > *, Record_adj &, TD_info *, const Exx_NAO< std::complex< double > > &, const Exx_Info &)
template void ctrl_output_td< std::complex< double > > (const UnitCell &, double **, const ModulePW::PW_Basis *, const int, const psi::Psi< std::complex< double > > *, const elecstate::ElecState *, const K_Vectors &, const TwoCenterIntegrator *, const Parallel_Orbitals *, const LCAO_Orbitals &, const Velocity_op< std::complex< double > > *, const Grid_Driver &, hamilt::HamiltLCAO< std::complex< double >, std::complex< double > > *, Record_adj &, TD_info *, const Exx_NAO< std::complex< double > > &, const Exx_Info &)
void ctrl_output_td_pw (const pw::TDVelResultPW &currents, const pw::TDSpinResultPW &moments, const pw::CurrentRequest &request, const std::string &mag_partition, const std::string &orbital_dir, double onsite_radius, bool calc_torque, const std::vector< std::string > &orbital_fn, int step, double dt_ha, int nspin, int nkstot, int rank, const std::string &directory, std::ostream &log)
 Write precomputed endpoint observables on the designated output rank.
template<typename TK, typename TR>
void ctrl_runner_lcao (UnitCell &ucell, const Input_para &inp, const int istep, K_Vectors &kv, elecstate::ElecState *pelec, const module_dm::Setup_DM< TK > &dmat, Parallel_Orbitals &pv, Parallel_Grid &pgrid, Grid_Driver &gd, psi::Psi< TK > *psi, Charge &chr, hamilt::HamiltLCAO< TK, TR > *p_hamilt, TwoCenterBundle &two_center_bundle, LCAO_Orbitals &orb, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis *pw_rhod, Structure_Factor &sf, ModuleBase::matrix &vloc, Exx_NAO< TK > &exx_nao, const Exx_Info &exx_info, surchem &solvent, std::ofstream &ofs_running)
template void ctrl_runner_lcao< double, double > (UnitCell &ucell, const Input_para &inp, const int istep, K_Vectors &kv, elecstate::ElecState *pelec, const module_dm::Setup_DM< double > &dmat, Parallel_Orbitals &pv, Parallel_Grid &pgrid, Grid_Driver &gd, psi::Psi< double > *psi, Charge &chr, hamilt::HamiltLCAO< double, double > *p_hamilt, TwoCenterBundle &two_center_bundle, LCAO_Orbitals &orb, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis *pw_rhod, Structure_Factor &sf, ModuleBase::matrix &vloc, Exx_NAO< double > &exx_nao, const Exx_Info &exx_info, surchem &solvent, std::ofstream &ofs_running)
template void ctrl_runner_lcao< std::complex< double >, double > (UnitCell &ucell, const Input_para &inp, const int istep, K_Vectors &kv, elecstate::ElecState *pelec, const module_dm::Setup_DM< std::complex< double > > &dmat, Parallel_Orbitals &pv, Parallel_Grid &pgrid, Grid_Driver &gd, psi::Psi< std::complex< double > > *psi, Charge &chr, hamilt::HamiltLCAO< std::complex< double >, double > *p_hamilt, TwoCenterBundle &two_center_bundle, LCAO_Orbitals &orb, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis *pw_rhod, Structure_Factor &sf, ModuleBase::matrix &vloc, Exx_NAO< std::complex< double > > &exx_nao, const Exx_Info &exx_info, surchem &solvent, std::ofstream &ofs_running)
template<typename TK, typename TR>
void ctrl_scf_lcao (UnitCell &ucell, const Input_para &inp, K_Vectors &kv, elecstate::ElecState *pelec, module_dm::DensityMatrix< TK, double > *dm, Parallel_Orbitals &pv, Grid_Driver &gd, psi::Psi< TK > *psi, hamilt::HamiltLCAO< TK, TR > *p_hamilt, Plus_U_Base &dftu, TwoCenterBundle &two_center_bundle, LCAO_Orbitals &orb, const ModulePW::PW_Basis_K *pw_wfc, const ModulePW::PW_Basis *pw_rho, const ModulePW::PW_Basis_Big *pw_big, Structure_Factor &sf, const ModulePW::PW_Basis *pw_rhod, const ModuleBase::matrix &vloc, surchem &solvent, rdmft::RDMFT< TK, TR > &rdmft_solver, Setup_DeePKS< TK > &deepks, Exx_NAO< TK > &exx_nao, const Exx_Info &exx_info, const bool conv_esolver, const bool scf_nmax_flag, const bool last_ion_step, const int istep, std::ofstream &ofs_running)
void write_current_pw (const pw::TDVelResultPW &current, int istep, int nk_per_spin, bool out_current_k, const std::string &out_dir)
 Write reduced charge currents on the output rank; performs no collectives.
void write_td_spin_pw (const std::string &directory, int step, double time_fs, const std::vector< std::string > &orbitals, const std::string &mag_partition, const std::string &orbital_dir, double onsite_radius, bool calc_torque, bool spin_current, const pw::TDSpinResultPW &spin, const pw::TDVelResultPW &current, std::ostream &log)
 Write globally reduced endpoint data on the designated output rank only.
void write_dh_perI (WriteDHParams &params, int ispin, const std::string &rprefix, const std::string &kprefix, const std::string &label, const std::string &term_name, std::array< std::vector< hamilt::HContainer< double > * >, 3 > &g, const std::vector< int > &atom_filter)
void write_dH_components (WriteDHParams &params, const Exx_Info &exx_info)
std::vector< int > dh_atom_filter (const std::vector< int > &param)
bool write_dH_t (WriteDHParams &params)
bool write_dH_vnl (WriteDHParams &params)
bool write_dH_vl (WriteDHParams &params)
bool write_dH_vh (WriteDHParams &params)
bool write_dH_vh_pulay (WriteDHParams &params)
bool write_dH_vxc (WriteDHParams &params)
bool write_dH_vxc_pulay (WriteDHParams &params)
bool write_dH_sum (WriteDHParams &params)
void write_dipole (const UnitCell &ucell, const double *rho, const ModulePW::PW_Basis *rhopw, const int &istep, const std::string &fn, std::ofstream &ofs_running, const int &precision=13)
 Write aligned electronic dipoles; precision counts significant digits.
void print_dipole_moment (std::ofstream &ofs_running, const std::string &name, double px, double py, double pz)
std::string dmk_gen_fname (const bool gamma_only, const int ispin, const int nspin, const int ik, const int istep)
 Generates the filename for the DMK file based on the given parameters.
bool dmk_readData (std::ifstream &ifs, double &data)
 Read one double from a file.
bool dmk_readData (std::ifstream &ifs, std::complex< double > &data)
 Read one complex double from a file.
template<typename T>
bool read_dmk (const int nspin, const int nk, const K_Vectors &kv, const Parallel_Blkcyclic &pv, const bool column_major, const std::string &dmk_dir, const int istep, const int out_app_flag, std::vector< std::vector< T > > &dmk, std::ofstream &ofs_running)
 Reads the DMK data from a file.
template<typename T>
void write_dmk (const std::vector< std::vector< T > > &dmk, const K_Vectors &kv, const int precision, const std::vector< double > &efs, const UnitCell *ucell, const Parallel_Blkcyclic &pv, const bool column_major, const std::string &dmk_dir, const int istep, const int out_app_flag, std::ofstream &ofs_running)
 Writes the DMK data to a file.
std::string dmr_gen_fname (const int out_type, const int ispin, const bool numbered, const int istep)
void write_dmr_csr (std::string &fname, const UnitCell *ucell, const int precision, hamilt::HContainer< double > *dm_serial, const int istep, const int ispin, const int nspin, const bool append)
void write_dmr (const std::vector< hamilt::HContainer< double > * > dmr, const UnitCell *ucell, const int precision, const Parallel_Blkcyclic &paraV, const int out_app_flag, const int *iat2iwt, const int nat, const std::string &dmr_dir, const int istep, std::ofstream &ofs_running)
void prepare_dos (std::ofstream &ofs_running, const elecstate::Efermi &energy_fermi, const ModuleBase::matrix &ekb, const int nks, const int nbands, const double &dos_edelta_ev, const double &dos_scale, double &emax, double &emin, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi)
bool cal_dos (const int &is, const std::string &fn, const double &de_ev, const double &emax_ev, const double &emin_ev, const double &bcoeff, const int &nks, const int &nkstot, const std::vector< double > &wk, const std::vector< int > &isk, const int &nbands, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const int istep_in, const int out_app_flag, const int precision, const int bndpar, DosSpectrum *spectrum)
template<typename Device>
void cal_ldos_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double >, Device > &psi, const Device *ctx, const Parallel_Grid &pgrid, const UnitCell &ucell, const std::vector< int > &out_ldos, const std::vector< double > &stm_bias, const int nspin, const int istep, const std::string &global_out_dir, const bool two_fermi, const int nbands, const double dos_edelta_ev, const double dos_scale, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const double dos_sigma, const std::vector< double > &ldos_line, std::ofstream &ofs_running)
template<typename Device>
void stm_mode_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double >, Device > &psi, const Device *ctx, const Parallel_Grid &pgrid, const UnitCell &ucell, const std::vector< double > &stm_bias, const int nspin, const int istep, const std::string &global_out_dir, const bool two_fermi, const int out_ldos_precision, std::ofstream &ofs_running)
template<typename Device>
void ldos_mode_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double >, Device > &psi, const Device *ctx, const Parallel_Grid &pgrid, const UnitCell &ucell, const int istep, const std::string &global_out_dir, const int nbands, const double dos_edelta_ev, const double dos_scale, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi, const double dos_sigma, const std::vector< double > &ldos_line, std::ofstream &ofs_running)
void get_grid_points (const std::vector< double > &start, const std::vector< double > &end, const int &npoints, const int &nx, const int &ny, const int &nz, std::vector< std::vector< int > > &points, std::vector< std::vector< double > > &shifts)
void trilinear_interpolate (const std::vector< std::vector< int > > &points, const std::vector< std::vector< double > > &shifts, const Parallel_Grid &pgrid, const std::vector< double > &data, std::vector< double > &results)
template void cal_ldos_pw< base_device::DEVICE_CPU > (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &psi, const base_device::DEVICE_CPU *ctx, const Parallel_Grid &pgrid, const UnitCell &ucell, const std::vector< int > &out_ldos, const std::vector< double > &stm_bias, const int nspin, const int istep, const std::string &global_out_dir, const bool two_fermi, const int nbands, const double dos_edelta_ev, const double dos_scale, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const double dos_sigma, const std::vector< double > &ldos_line, std::ofstream &ofs_running)
std::vector< ModuleBase::matrix > cal_pdos (const psi::Psi< double > *psi, hamilt::Hamilt< double > *p_ham, const Parallel_Orbitals &pv, const K_Vectors &kv, const int nspin0, const int nbands, const ModuleBase::matrix &ekb, const double &emax, const double &emin, const double &dos_edelta_ev, const double &bcoeff, const int nlocal, const int nspin)
std::vector< ModuleBase::matrix > cal_pdos (const psi::Psi< std::complex< double > > *psi, hamilt::Hamilt< std::complex< double > > *p_ham, const Parallel_Orbitals &pv, const K_Vectors &kv, const int nspin0, const int nbands, const ModuleBase::matrix &ekb, const double &emax, const double &emin, const double &dos_edelta_ev, const double &bcoeff, const int nlocal, const int nspin)
void write_dos_npy_header (std::ostream &out, const std::string &fields, std::size_t count)
 Write the NPY v1 header for a one-dimensional array of structured records.
template<typename T>
void write_dos_lcao (const psi::Psi< T > *psi, hamilt::Hamilt< T > *p_ham, const Parallel_Orbitals &pv, const UnitCell &ucell, const K_Vectors &kv, const int nbands, const elecstate::Efermi &energy_fermi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const double &dos_edelta_ev, const double &dos_scale, const double &bcoeff, const int out_dos, const int out_app_flag, const int precision, const int istep, const int nspin, const int nlocal, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi, const int bndpar, const std::string &global_out_dir, std::ofstream &ofs_running)
 calculate density of states(DOS), partial density of states(PDOS), and mulliken charge for LCAO base
template void write_dos_lcao (const psi::Psi< double > *psi, hamilt::Hamilt< double > *p_ham, const Parallel_Orbitals &pv, const UnitCell &ucell, const K_Vectors &kv, const int nbands, const elecstate::Efermi &energy_fermi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const double &dos_edelta_ev, const double &dos_scale, const double &bcoeff, const int out_dos, const int out_app_flag, const int precision, const int istep, const int nspin, const int nlocal, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi, const int bndpar, const std::string &global_out_dir, std::ofstream &ofs_running)
template void write_dos_lcao (const psi::Psi< std::complex< double > > *psi, hamilt::Hamilt< std::complex< double > > *p_ham, const Parallel_Orbitals &pv, const UnitCell &ucell, const K_Vectors &kv, const int nbands, const elecstate::Efermi &energy_fermi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const double &dos_edelta_ev, const double &dos_scale, const double &bcoeff, const int out_dos, const int out_app_flag, const int precision, const int istep, const int nspin, const int nlocal, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi, const int bndpar, const std::string &global_out_dir, std::ofstream &ofs_running)
void write_dos_pw (const UnitCell &ucell, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors &kv, const int nbands, const int istep_in, const elecstate::Efermi &energy_fermi, const double &dos_edelta_ev, const double &dos_scale, const double &bcoeff, const int nspin, const int out_dos, const bool dos_setemax, const double dos_emax_ev, const bool dos_setemin, const double dos_emin_ev, const bool two_fermi, const int out_app_flag, const int precision, const int bndpar, const std::string &global_out_dir, std::ofstream &ofs_running)
 calculate density of states(DOS) for PW base
void write_pdos_text (const UnitCell &ucell, const ModuleBase::matrix *pdos, const int nspin, const int nlocal, const int npoints, const double &emin, const double &dos_edelta_ev, const std::string &out_dir, const int istep, const int out_app_flag, const int precision, std::ofstream &ofs_running)
void write_pdos_npy (const UnitCell &cell, const std::vector< ModuleBase::matrix > &pdos, int nspin, double emin, double de, const std::string &path)
 Write one NPY array of atom- and orbital-projected spin spectra.
void prep_td_field_out (const std::string &output_dir, std::size_t field_count, bool restart)
 Prepare electric-field output files for an RT-TDDFT calculation.
void prep_td_field_out (const std::string &output_dir, const elecstate::TDFieldManager &manager, bool restart)
 Prepare total endpoint E and, for analytic fields, the configured waveform files.
void write_td_field (const elecstate::TDFieldManager &manager, const std::string &output_dir)
 Append the current electric-field samples to their output files. Times are written in fs with six decimal places, starting at physical time zero. Field components use scientific notation with twelve decimal places; columns are right-aligned.
std::vector< ModuleBase::Vector3< double > > read_td_vecpot (const std::string &input_dir)
 Read Cartesian vector potentials for an RT-TDDFT calculation.
void check_td_vecpot_paths (const std::string &input_dir, const std::string &output_dir)
 Reject output that aliases the input file, including symbolic and hard links.
void prep_td_vecpot_out (const std::string &output_dir, bool restart)
 Prepare the vector-potential output file for an RT-TDDFT calculation.
void write_td_vecpot (const std::string &output_dir, int electronic_step, const ModuleBase::Vector3< double > &vector_pot)
 Append one Cartesian vector-potential sample.
void write_elf (const std::string &out_dir, const int &istep_in, const int &nspin, const double *const *rho, const double *const *tau, ModulePW::PW_Basis *const rho_basis, const Parallel_Grid &pgrid, const UnitCell *ucell_, const int &precision, const std::string &geom_block, const bool two_fermi, const bool append, std::ofstream &ofs_running)
void print_eij (const std::complex< double > *eij, const int nband, const int leading_dimension, const EijOutputInfo &output_info, std::ostream &ofs)
 Print selected elements of a column-major Hamiltonian in the orbital basis, in Ry.
template<typename T, typename Device>
void print_eij_pw (hsolver::HSOperator< T, Device > &op, hsolver::TDOrbOps< T, Device > &orbitals, psi::Psi< T, Device > &current, const K_Vectors &kv, int nspin, int step, int iter, double threshold, std::ostream &log)
 Collect and print Eij from an already bound endpoint Hamiltonian. All ranks participate; both k-point cursors are restored before returning.
template void print_eij_pw (hsolver::HSOperator< std::complex< float >, base_device::DEVICE_CPU > &, hsolver::TDOrbOps< std::complex< float >, base_device::DEVICE_CPU > &, psi::Psi< std::complex< float >, base_device::DEVICE_CPU > &, const K_Vectors &, int, int, int, double, std::ostream &)
template void print_eij_pw (hsolver::HSOperator< std::complex< double >, base_device::DEVICE_CPU > &, hsolver::TDOrbOps< std::complex< double >, base_device::DEVICE_CPU > &, psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &, const K_Vectors &, int, int, int, double, std::ostream &)
void write_bands (const Input_para &inp, const ModuleBase::matrix &ekb, const K_Vectors &kv, std::ofstream &ofs_running, const std::string &band_dir, const int istep)
 write the eigenvalues of every spin channel to band.txt (nspin=1/4) or to bands1.txt/bands2.txt (nspin=2).
void nscf_bands (const int &is, const std::string &eig_file, const int &nband, const double &fermie, const int &precision, const ModuleBase::matrix &ekb, const K_Vectors &kv, const std::string &header, const int out_app_flag)
 calculate the band structure
template<typename TK, typename TR>
void write_eband_terms (const int nspin, const int istep, const int out_app_flag, const double etot, const int my_rank, const int nbasis, const Parallel_Orbitals *pv, const psi::Psi< TK > &psi, const UnitCell &ucell, Structure_Factor &sf, surchem &solvent, const ModulePW::PW_Basis &rho_basis, const ModulePW::PW_Basis &rhod_basis, const ModuleBase::matrix &vloc, const Charge &chg, const K_Vectors &kv, const ModuleBase::matrix &wg, Grid_Driver &gd, const std::vector< double > &orb_cutoff, const LCAO_Orbitals &orb, const TwoCenterBundle &two_center_bundle, std::ofstream &ofs_running)
 Write the band-decomposed energy of each Hamiltonian term (kinetic, local/nonlocal pp, Hartree) in KS orbital representation. The XC term is handled by write_Vxc from ctrl_scf_lcao.cpp instead.
template void write_eband_terms< double, double > (const int, const int, const int, const double, const int, const int, const Parallel_Orbitals *, const psi::Psi< double > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const ModuleBase::matrix &, Grid_Driver &, const std::vector< double > &, const LCAO_Orbitals &, const TwoCenterBundle &, std::ofstream &)
template void write_eband_terms< std::complex< double >, double > (const int, const int, const int, const double, const int, const int, const Parallel_Orbitals *, const psi::Psi< std::complex< double > > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const ModuleBase::matrix &, Grid_Driver &, const std::vector< double > &, const LCAO_Orbitals &, const TwoCenterBundle &, std::ofstream &)
void write_eig_iter (const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors &kv, const int nbands, const int nspin)
 print eigenvalues and occupations to the running log
void write_eig_file (const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors &kv, const int nbands, const int nspin, const std::string &out_dir, const int istep, const int out_app_flag)
 write eigenvalues and occupations to <out_dir>/eig_occ.txt
template<typename TK>
void write_proj_band_lcao (const psi::Psi< TK > *psi, const Parallel_Orbitals &pv, const elecstate::ElecState *pelec, const K_Vectors &kv, const UnitCell &ucell, hamilt::Hamilt< TK > *p_ham, const int istep, const int out_app_flag)
std::complex< double > cal_LzijR (const std::unique_ptr< TwoCenterIntegrator > &calculator, const int it, const int ia, const int il, const int iz, const int mi, const int jt, const int ja, const int jl, const int jz, const int mj, const ModuleBase::Vector3< double > &vR)
 calculate the <phi_i|Lz|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).
std::complex< double > cal_LyijR (const std::unique_ptr< TwoCenterIntegrator > &calculator, const int it, const int ia, const int il, const int iz, const int im, const int jt, const int ja, const int jl, const int jz, const int jm, const ModuleBase::Vector3< double > &vR)
 calculate the <phi_i|Ly|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).
std::complex< double > cal_LxijR (const std::unique_ptr< TwoCenterIntegrator > &calculator, const int it, const int ia, const int il, const int iz, const int im, const int jt, const int ja, const int jl, const int jz, const int jm, const ModuleBase::Vector3< double > &vR)
 calculate the <phi_i|Lx|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).
std::size_t dense_buffer_index (const int i, const int j, const int nlocal, const bool column_major)
 Flat index of matrix element (i, j) in a gathered buffer.
void write_dense_text_body (std::ofstream &ofs, const std::vector< double > &mat, const int nlocal, const int precision, const bool column_major)
 Write a dense square matrix body in the flat NAO text layout shared by the DM(k), H(k)/S(k) and T(k) writers.
void write_dense_text_body (std::ofstream &ofs, const std::vector< std::complex< double > > &mat, const int nlocal, const int precision, const bool column_major)
 Complex overload of write_dense_text_body.
void save_dH_sparse (const int &istep, const Parallel_Orbitals &pv, const UnitCell *ucell, LCAO_HS_Arrays &HS_Arrays, const double &sparse_thr, const bool &binary, const std::string &fileflag, const int precision, const std::string &global_matrix_dir, const std::string &calculation, const int out_app_flag, const int nspin, const int nlocal, std::ofstream &ofs_running)
template<typename T>
void save_mat (const int istep, const T *mat, const int dim, const bool bit, const int precision, const bool tri, const bool app, const std::string &file_name, const Parallel_Blkcyclic &pv, const int drank, const std::string &ks_solver, const bool reduce=true)
 save a square matrix, such as H(k) and S(k)
template<typename Tdata>
void save_sparse (const SparseRMatrix< Tdata > &smat, const std::set< RCoordinate > &all_R_coor, const Parallel_Orbitals &pv, const SparseWriteOptions &options)
template<typename T>
void write_hsk (const std::string &global_out_dir, const int nspin, const int nks, const int nkstot, const std::vector< int > &ik2iktot, const std::vector< int > &isk, hamilt::Hamilt< T > *p_hamilt, const Parallel_Orbitals &pv, const K_Vectors &kv, const UnitCell *ucell, const std::vector< double > &efs, const bool gamma_only, const int out_app_flag, const int istep, const int out_type, const int precision, const int nlocal, const std::string &ks_solver, const int drank, std::ofstream &ofs_running)
 Write H(k) and S(k) matrices for each k-point to disk.
void output_dHR (const int &istep, const ModuleBase::matrix &v_eff, const UnitCell &ucell, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const Grid_Driver &grid, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, const MatROutputOptions &options, const bool gamma_only_local, const int npol, const int nlocal, std::ofstream &ofs_running)
void output_dSR (const int &istep, const UnitCell &ucell, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const Grid_Driver &grid, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, const MatROutputOptions &options, const bool gamma_only_local, const int npol, const int nlocal, std::ofstream &ofs_running)
void output_TR (const int istep, const UnitCell &ucell, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const Grid_Driver &grid, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, const std::string &TR_filename, const MatROutputOptions &options, std::ofstream &ofs_running)
template<typename TK>
void output_SR (const UnitCell &ucell, Parallel_Orbitals &pv, const Grid_Driver &grid, hamilt::Hamilt< TK > *p_ham, const bool &binary, const double &sparse_threshold, const int precision, const std::string &global_matrix_dir, const std::string &calculation, const int out_app_flag, const int nspin, const int istep, std::ofstream &ofs_running)
std::string hsr_gen_fname (const std::string &prefix, const int ispin, const bool numbered, const int istep)
std::string hsr_gen_fname (const std::string &prefix, const int ispin, const bool numbered, const int istep, const int out_type)
 Generate filename for spin-dependent HR output in the selected format.
std::string sr_gen_fname (const bool numbered, const int istep)
 Generate filename for spin-independent SR output.
std::string sr_gen_fname (const bool numbered, const int istep, const int out_type)
 Generate filename for spin-independent SR output in the selected format.
std::string dhr_gen_fname (const std::string &prefix, const int ispin, const bool numbered, const int istep)
 Generate filename for derivative matrices (dH/dR, dS/dR).
std::string dhk_gen_fname (const std::string &prefix, const int ispin, const int nspin, const bool numbered, const int istep)
template<typename TR>
bool write_hcontainer_csr (const std::string &fname, const UnitCell *ucell, const int precision, hamilt::HContainer< TR > *mat_serial, const int istep, const bool append, const int ispin, const int nspin, const std::string &label, const std::string &representation_note, const double efermi_eV, const bool has_efermi)
template<typename TR>
void write_hcontainer_csr_binary (const std::string &fname, hamilt::HContainer< TR > *mat_serial, const int istep, const bool append)
 Write one HContainer record in the native binary CSR format.
template<typename TR>
void write_hsr (const std::vector< hamilt::HContainer< TR > * > &hr_vec, const hamilt::HContainer< TR > *sr, const UnitCell *ucell, const int out_type, const int precision, const Parallel_Blkcyclic &paraV, const int out_app_flag, const bool gamma_only, const int *iat2iwt, const int nat, const int istep, const std::string &global_out_dir, const elecstate::Efermi &eferm, std::ofstream &ofs_running)
void write_h_vnl (WriteHParams &params)
void write_h_vl (WriteHParams &params)
void write_h_vh (WriteHParams &params)
void write_h_vxc (WriteHParams &params)
template<typename T>
void save_lat_r (std::ofstream &ofs, const SparseRBlock< T > &XR, const Parallel_Blkcyclic &layout, const SparseWriteOptions &options)
template<typename T>
void save_lat_r_csr (std::ofstream &ofs, const SparseRBlock< T > &XR, const Parallel_Blkcyclic &layout, const SparseWriteOptions &options)
 Write one R block in the H(R)/S(R)/r(R) CSR text layout.
template<typename T>
void save_lat_r_empty_csr (std::ofstream &ofs, int nlocal, const SparseWriteOptions &options)
 Write an all-zero R block in the H(R)/S(R)/r(R) CSR text layout.
template<typename T>
void output_mat_sparse (const MatSparseOutputOptions &options, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< T > *p_ham, Plus_U_Base *p_dftu, const std::string &global_out_dir, const std::string &global_matrix_dir, const std::string &calculation, const int out_app_flag, const int nspin, const bool gamma_only_local, const int npol, const int nlocal, const bool cal_force, std::ofstream &ofs_running)
 the output interface to write the sparse matrix of dH, dS, T, and r
template void output_mat_sparse< double > (const MatSparseOutputOptions &options, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< double > *p_ham, Plus_U_Base *p_dftu, const std::string &global_out_dir, const std::string &global_matrix_dir, const std::string &calculation, const int out_app_flag, const int nspin, const bool gamma_only_local, const int npol, const int nlocal, const bool cal_force, std::ofstream &ofs_running)
template void output_mat_sparse< std::complex< double > > (const MatSparseOutputOptions &options, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< std::complex< double > > *p_ham, Plus_U_Base *p_dftu, const std::string &global_out_dir, const std::string &global_matrix_dir, const std::string &calculation, const int out_app_flag, const int nspin, const bool gamma_only_local, const int npol, const int nlocal, const bool cal_force, std::ofstream &ofs_running)
template<typename FPTYPE>
void write_Vxc_LIP (int nspin, const int istep, const double etot, int naos, int drank, const psi::Psi< std::complex< FPTYPE > > &psi_pw, const UnitCell &ucell, Structure_Factor &sf, surchem &solvent, const ModulePW::PW_Basis_K &wfc_basis, const ModulePW::PW_Basis &rho_basis, const ModulePW::PW_Basis &rhod_basis, const ModuleBase::matrix &vloc, const Charge &chg, const K_Vectors &kv, const ModuleBase::matrix &wg, const bool gamma_only, const std::string &global_out_dir, const int out_ndigits, const std::string &ks_solver, bool cal_exx, double hybrid_alpha)
 Write the Vxc matrix in KS orbital representation for LIP (LCAO-in-PW), useful for GW calculation including terms: local/semi-local XC and EXX. The band-decomposed diagonal energies (eband_vxc.txt and, with EXX, eband_vxc_local.txt and eband_vxc_exx.txt) are written to global_out_dir.
template void write_Vxc_LIP< float > (int, const int, const double, int, int, const psi::Psi< std::complex< float > > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis_K &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const ModuleBase::matrix &, const bool, const std::string &, const int, const std::string &, bool, double)
template void write_Vxc_LIP< double > (int, const int, const double, int, int, const psi::Psi< std::complex< double > > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis_K &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const ModuleBase::matrix &, const bool, const std::string &, const int, const std::string &, bool, double)
template<typename TK, typename TR>
void write_Vxc (const int nspin, const int istep, const double etot, const int nbasis, const int drank, const Parallel_Orbitals *pv, const psi::Psi< TK > &psi, const UnitCell &ucell, Structure_Factor &sf, surchem &solvent, const ModulePW::PW_Basis &rho_basis, const ModulePW::PW_Basis &rhod_basis, const ModuleBase::matrix &vloc, const Charge &chg, const K_Vectors &kv, const std::vector< double > &orb_cutoff, const ModuleBase::matrix &wg, Grid_Driver &gd, const bool dft_plus_u, const bool gamma_only, const bool out_mat, const int out_app_flag, const std::string &mat_dir, const std::string &global_out_dir, const int out_ndigits, const std::string &ks_solver, bool cal_exx, const Exx_Info &exx_info, std::ofstream &ofs_running)
 Write the Vxc matrix in KS orbital representation, useful for GW calculation including terms: local/semi-local XC, EXX, DFTU. The band-decomposed diagonal energies (eband_vxc.txt and, with EXX, eband_vxc_local.txt and eband_vxc_exx.txt) are always written to global_out_dir; the full MO-basis matrices (vxcmok*_nao.txt) are written to mat_dir only when out_mat is true. The MO-basis name keeps the "vxcmo" property so that it never collides with the NAO-basis "vxck*_nao.txt" produced by out_mat_vxck.
template void write_Vxc< double, double > (const int, const int, const double, const int, const int, const Parallel_Orbitals *, const psi::Psi< double > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const std::vector< double > &, const ModuleBase::matrix &, Grid_Driver &, const bool, const bool, const bool, const int, const std::string &, const std::string &, const int, const std::string &, bool, const Exx_Info &, std::ofstream &)
template void write_Vxc< std::complex< double >, double > (const int, const int, const double, const int, const int, const Parallel_Orbitals *, const psi::Psi< std::complex< double > > &, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const std::vector< double > &, const ModuleBase::matrix &, Grid_Driver &, const bool, const bool, const bool, const int, const std::string &, const std::string &, const int, const std::string &, bool, const Exx_Info &, std::ofstream &)
template<typename T>
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, T > > > cal_HR_sparse (const hamilt::HContainer< T > &hR, const double sparse_thr)
 Helper to calculate sparse HR representation.
template<typename TK, typename TR>
void write_Vxc_R (const int nspin, const Parallel_Orbitals *pv, const UnitCell &ucell, Structure_Factor &sf, surchem &solvent, const ModulePW::PW_Basis &rho_basis, const ModulePW::PW_Basis &rhod_basis, const ModuleBase::matrix &vloc, const Charge &chg, const K_Vectors &kv, const std::vector< double > &orb_cutoff, Grid_Driver &gd, const std::string &global_out_dir, bool cal_exx, double hybrid_alpha, bool real_number, const int istep, const double sparse_thr, const int precision, std::ofstream &ofs_running)
 Write the Vxc matrix in real space (R), useful for GW calculation including terms: local/semi-local XC, EXX, DFTU The files are named vxcrs{spin}_nao.csr as a final-step snapshot; the spin index is one-based.
template void write_Vxc_R< double, double > (const int, const Parallel_Orbitals *, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const std::vector< double > &, Grid_Driver &, const std::string &, bool, double, bool, const int, const double, const int, std::ofstream &)
template void write_Vxc_R< std::complex< double >, double > (const int, const Parallel_Orbitals *, const UnitCell &, Structure_Factor &, surchem &, const ModulePW::PW_Basis &, const ModulePW::PW_Basis &, const ModuleBase::matrix &, const Charge &, const K_Vectors &, const std::vector< double > &, Grid_Driver &, const std::string &, bool, double, bool, const int, const double, const int, std::ofstream &)
void set_para2d_MO (const Parallel_Orbitals &pv, const int nbands, Parallel_Blkcyclic &p2d)
 Set up a 2D parallel distribution for MO-space matrices (nbands x nbands).
template<typename T>
std::vector< T > cVc (const T *V, const T *c, const int nbasis, const int nbands, const Parallel_Orbitals &pv, const Parallel_Blkcyclic &p2d)
 Compute c^dagger * V * c in MO basis.
template<typename T>
double all_band_energy (const int ik, const std::vector< T > &mat_mo, const Parallel_Blkcyclic &p2d, const ModuleBase::matrix &wg)
 Sum over bands with occupation weights.
template<typename T>
std::vector< double > orbital_energy (const int ik, const int nbands, const std::vector< T > &mat_mo, const Parallel_Blkcyclic &p2d)
 Extract diagonal elements (orbital energies) from MO matrix.
void write_orb_energy (const K_Vectors &kv, const int nspin0, const int nbands, const std::vector< std::vector< double > > &e_orb, const std::string &out_name, const std::string &header, const std::string &global_out_dir, const bool app=false)
 Write orbital energies to file in LibRPA format.
std::string eband_filename (const std::string &stem, const int istep, const int out_app_flag)
 Compose the name of a band-decomposed energy file.
std::string build_eband_header (const int istep, const double etot_eV, const std::string &term_symbol, const std::string &time_stamp)
 Build the five comment lines preceding band-decomposed energy data.
template std::vector< double > cVc< double > (const double *, const double *, const int, const int, const Parallel_Orbitals &, const Parallel_Blkcyclic &)
template std::vector< std::complex< double > > cVc< std::complex< double > > (const std::complex< double > *, const std::complex< double > *, const int, const int, const Parallel_Orbitals &, const Parallel_Blkcyclic &)
template double all_band_energy< double > (const int, const std::vector< double > &, const Parallel_Blkcyclic &, const ModuleBase::matrix &)
template double all_band_energy< std::complex< double > > (const int, const std::vector< std::complex< double > > &, const Parallel_Blkcyclic &, const ModuleBase::matrix &)
template std::vector< double > orbital_energy< double > (const int, const int, const std::vector< double > &, const Parallel_Blkcyclic &)
template std::vector< double > orbital_energy< std::complex< double > > (const int, const int, const std::vector< std::complex< double > > &, const Parallel_Blkcyclic &)
double get_real (const std::complex< double > &c)
 Extract real part (for complex numbers).
double get_real (const double &d)
 Extract real part (for real numbers, identity).
void read_mat_npz (const Parallel_Orbitals *paraV, const UnitCell &ucell, std::string &zipname, hamilt::HContainer< double > &hR)
template<typename T>
void output_mat_npz_impl (const UnitCell &ucell, std::string &zipname, const hamilt::HContainer< T > &hR)
void output_mat_npz (const UnitCell &ucell, std::string &zipname, const hamilt::HContainer< double > &hR)
void output_mat_npz (const UnitCell &ucell, std::string &zipname, const hamilt::HContainer< std::complex< double > > &hR)
template<typename TK>
void cal_mag (Parallel_Orbitals *pv, hamilt::Hamilt< TK > *p_ham, K_Vectors &kv, module_dm::DensityMatrix< TK, double > *dm, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &gd, const int istep, const int out_app_flag, const bool print)
void collect_MW_nspin4 (ModuleBase::matrix &MecMulP, const ModuleBase::ComplexMatrix &mud, int nw, const Parallel_Orbitals *pv)
 Accumulate the nspin=4 Mulliken charge and Mx/My/Mz components.
std::string make_data_desc (const std::string &base, const std::string &mag_base, const int is, const int nspin)
bool read_vdata_palgrid (const Parallel_Grid &pgrid, const int my_rank, std::ostream &ofs_running, const std::string &fn, double *const data, const int nat)
 read volumetric data from .cube file into the parallel distributed grid.
void write_vdata_palgrid (const Parallel_Grid &pgrid, const double *const data, const int is, const int nspin, const int iter, const std::string &fn, const double ef, const UnitCell *const ucell, const int precision, const int out_fermi, const bool two_fermi, const bool reduce_all_pool, const bool append, std::ofstream &ofs_running, const std::string &data_desc)
bool read_cube (const std::string &file, std::vector< std::string > &comment, int &natom, std::vector< double > &origin, int &nx, int &ny, int &nz, std::vector< double > &dx, std::vector< double > &dy, std::vector< double > &dz, std::vector< int > &atom_type, std::vector< double > &atom_charge, std::vector< std::vector< double > > &atom_pos, std::vector< double > &data)
 read the full data from a cube file
void write_cube (const std::string &file, const std::vector< std::string > &comment, const int &natom, const std::vector< double > &origin, const int &nx, const int &ny, const int &nz, const std::vector< double > &dx, const std::vector< double > &dy, const std::vector< double > &dz, const std::vector< int > &atom_type, const std::vector< double > &atom_charge, const std::vector< std::vector< double > > &atom_pos, const std::vector< double > &data, const int precision, const bool append, const int ndata_line=6)
void write_cube_header (std::ofstream &ofs, const std::vector< std::string > &comment, const int &natom, const std::vector< double > &origin, const int &nx, const int &ny, const int &nz, const std::vector< double > &dx, const std::vector< double > &dy, const std::vector< double > &dz, const std::vector< int > &atom_type, const std::vector< double > &atom_charge, const std::vector< std::vector< double > > &atom_pos, const int precision)
void write_cube_header_for_cell (std::ofstream &ofs, const UnitCell &ucell, const int nx, const int ny, const int nz, const std::vector< std::string > &comment, const int precision)
void trilinear_interpolate (const double *const data_in, const int &nx_read, const int &ny_read, const int &nz_read, const int &nx, const int &ny, const int &nz, double *data_out)
 The trilinear interpolation method.
bool frame_appends (const int out_app_flag, const int istep)
 Tell whether an output written for ionic step istep should append.
std::string stru_frame_filename (const std::string &directory, const int out_app_flag, const int istep)
 Fixed STRU for overwrite/append modes; numbered STRU for mode 2.
void output_convergence_after_scf (const bool &convergence, double &energy, std::ofstream &ofs_running)
 output if is convergence and energy after scf
void output_after_relax (bool conv_ion, bool conv_esolver, std::ofstream &ofs_running)
 output after relaxation
void output_efermi (const bool &convergence, const elecstate::Efermi &eferm, std::ofstream &ofs_running)
 output the fermi energy
void output_vacuum_level (const UnitCell *ucell, const double *const *rho, const double *v_elecstat, const int &nx, const int &ny, const int &nz, const int &nxyz, const int &nrxx, const int &nplane, const int &startz_current, std::ofstream &ofs_running)
 calculate and output the vacuum level We first determine the vacuum direction, then get the vacuum position based on the minimum of charge density, finally output the vacuum level, i.e., the electrostatic potential at the vacuum position.
void print_force (std::ofstream &ofs, const UnitCell &cell, const std::string &name, const ModuleBase::matrix &force, bool ry=true)
 output atomic forces
void print_net_force (std::ofstream &ofs, const ModuleBase::Vector3< double > &net_force)
 output the net force vector and the magnitude of the force drift
void print_stress (const std::string &name, const ModuleBase::matrix &scs, const bool screen, const bool ry, std::ofstream &ofs)
 output stress components
void write_head (std::ofstream &ofs_running, const int &istep, const int &iter, const std::string &basisname)
 write head for scf iteration
void write_head_td (std::ofstream &ofs_running, const int &istep, const int &estep, const int &iter, const std::string &basisname)
 write head for scf iteration
void print_parameters (const UnitCell &ucell, K_Vectors &kv, const Input_para &inp)
void print_time (time_t &time_start, time_t &time_finish)
void print_rhofft (ModulePW::PW_Basis *pw_rhod, ModulePW::PW_Basis *pw_rho, ModulePW::PW_Basis_Big *pw_big, std::ofstream &ofs)
 Print charge density using FFT.
void print_wfcfft (const Input_para &inp, ModulePW::PW_Basis_K &pw_wfc, std::ofstream &ofs)
void print_screen (const int &stress_step, const int &force_step, const int &istep)
void print_kpar (const int &nks, const int &kpar_lcao)
std::string local_timestamp ()
std::string provenance_header (const std::string &time_stamp)
std::string prov_step (const int istep_one_based, const std::string &time_stamp)
 Two provenance lines followed by the unified "# Ionic_Step N" marker.
std::string prov_inline (const std::string &time_stamp)
std::string make_spin_tag (const int is, const int nspin)
std::string make_compact_spin_tag (const int is, const int nspin)
void print_conserv (const pw::TDConserv &values, double npsi0, double nrho0, int step, bool full_gram, const std::string &orth, std::ofstream &log)
 Print endpoint conservation relative to the caller's initial counts.
void write_notice (std::ofstream &ofs_running, const std::string &property, const std::string &file_name)
 Announce a written output file in the running log.
void write_notice (std::ofstream &ofs_running, const std::string &property, const int is, const int nspin, const std::string &file_name)
 Announce a spin-resolved output file in the running log.
void write_matrix_notice (std::ofstream &ofs_running, const std::string &property, const std::string &file_name)
 Announce a written NAO-basis matrix file in the running log.
void write_matrix_notice (std::ofstream &ofs_running, const std::string &property, const int is, const int nspin, const std::string &file_name)
 Announce a written spin-resolved NAO-basis matrix file in the log.
void write_orb_info (const UnitCell *ucell, std::ofstream &ofs_running)
void print_PAOs (const UnitCell &ucell)
 print chi (PAO) in pseudopotential file
AvailabilityExpr parse_availability (const std::string &raw)
AvailabilityValueKind availability_value_kind (const std::string &type)
void validate_availability_expr (const std::string &owner, const AvailabilityExpr &expression, const std::map< std::string, AvailabilityValueKind > &parameter_types)
void validate_availability_self_contained (const std::string &owner, const AvailabilityExpr &expression, const std::map< std::string, AvailabilityExpr > &expressions)
bool evaluate_input_condition (const AvailabilityExpr &expression, const InputValues &values)
std::string input_manual_link (const std::string &label)
std::string input_diagnostic (const std::string &label, const std::string &value, const std::string &origin, const std::string &expected)
bool parse_imp_sol (const std::string &value, int &model, std::string &error)
bool check_sccs_inp (const Input_para &input, std::string &error)
bool parse_spreads (const std::vector< std::string > &words, std::vector< double > &spreads, std::string &error)
void check_td_efield_parameters (const Input_para &input)
 Validate the structure and waveform-defining constraints of RT-TDDFT fields.
std::string longstring (const std::vector< std::string > &words)
bool assume_as_boolean (const std::string &val)
std::string to_dir (const std::string &str)
void read_information (std::stringstream &ifs, std::vector< std::string > &output, const std::string &delimiters)
bool filter_nonascii_and_comment (std::ifstream &ifs, std::stringstream &out_ascii_stream)
std::string nofound_str (std::vector< std::string > init_chgs, const std::string &str)
bool dsp_layout_check_needed (const std::string &esolver_type)
 Whether the DSP kpar/bndpar layout constraint applies.
int dsp_effective_kpar (const std::string &basis_type, const int kpar, const int kpar_lcao)
 The k-point pool count actually consumed by the current basis.
bool dsp_kpar_layout_valid (const int nproc, const std::string &basis_type, const int kpar, const int kpar_lcao, const int bndpar, const std::string &esolver_type)
 Check whether a k-point/band parallel layout satisfies the DSP vendor library constraint.
 TEST (AvailabilityParser, LeafEqualityRoundTrip)
 TEST (AvailabilityParser, SlashRemainsPartOfSingleEqualityValue)
 TEST (AvailabilityParser, InListRoundTrip)
 TEST (AvailabilityParser, VectorContainmentSemantics)
 TEST (AvailabilityParser, QuotedMultiTokenValueRoundTrip)
 TEST (AvailabilityParser, AndGroup)
 TEST (AvailabilityParser, ParenthesisedOrNesting)
 TEST (AvailabilityParser, EmptyIsAlwaysAvailable)
 TEST (AvailabilityParser, InvalidExpressionsAreRejected)
 TEST (AvailabilityParser, NonCanonicalSpellingIsRejected)
 TEST (AvailabilityParser, SetterPreservesStateOnParseFailure)
 TEST (AvailabilityValidator, AcceptsKnownTypedReferences)
 TEST (AvailabilityValidator, InfersDocumentedTypes)
 TEST (AvailabilityValidator, RejectsUnknownAndIncompatibleReferences)
 TEST (AvailabilityValidator, AcceptsDependenciesOfDependencies)
 TEST (AvailabilityValidator, RejectsMissingTransitiveRequirement)
 TEST (AvailabilityValidator, AcceptsOrPrerequisiteImpliedByPath)
 TEST (AvailabilityValidator, RequiresExactNonEqualityPrerequisite)
 TEST (AvailabilityValidator, ChecksPrerequisitesTransitivelyThroughOr)
 TEST (AvailabilityValidator, RejectsSelfReference)
template<typename Tdata>
void read_Hexxs_csr (const std::string &file_name, const UnitCell &ucell, const int nspin, const int nbasis, std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > &Hexxs)
 read Hexxs in CSR format
template<typename Tdata>
void read_Hexxs_cereal (const std::string &file_name, std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > &Hexxs)
 read Hexxs in cereal format
template<typename Tdata>
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, Tdata > > > calculate_RI_Tensor_sparse (const double &sparse_threshold, const std::map< int, std::map< TAC, RI::Tensor< Tdata > > > &Hexxs, const UnitCell &ucell)
template<typename Tdata>
void write_Hexxs_csr (const std::string &file_name, const UnitCell &ucell, const std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > &Hexxs)
 write Hexxs in CSR format
template void read_Hexxs_csr< double > (const std::string &, const UnitCell &, const int, const int, std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &)
template void read_Hexxs_csr< std::complex< double > > (const std::string &, const UnitCell &, const int, const int, std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &)
template void read_Hexxs_cereal< double > (const std::string &, std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &)
template void read_Hexxs_cereal< std::complex< double > > (const std::string &, std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &)
template std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, double > > > calculate_RI_Tensor_sparse< double > (const double &, const std::map< int, std::map< TAC, RI::Tensor< double > > > &, const UnitCell &)
template std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, std::complex< double > > > > calculate_RI_Tensor_sparse< std::complex< double > > (const double &, const std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > &, const UnitCell &)
template void write_Hexxs_csr< double > (const std::string &, const UnitCell &, const std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &)
template void write_Hexxs_csr< std::complex< double > > (const std::string &, const UnitCell &, const std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &)
void read_wf2rho_pw (const ModulePW::PW_Basis_K *pw_wfc, ModuleSymmetry::Symmetry &symm, Charge &chg, const std::string &readin_dir, const int kpar, const int my_pool, const int my_rank, const int nproc_in_pool, const int rank_in_pool, const int nbands, const int nspin, const int npol, const int nkstot, const std::vector< int > &ik2iktot, const std::vector< int > &isk, std::ofstream &ofs_running)
 read wave functions and occupation numbers to charge density
template<typename Device>
void read_wf2rho_pw_impl (const ModulePW::PW_Basis_K *pw_wfc, ModuleSymmetry::Symmetry &symm, Charge &chg, const std::string &readin_dir, const int kpar, const int my_pool, const int my_rank, const int nproc_in_pool, const int rank_in_pool, const int nbands, const int nspin, const int npol, const int nkstot, const std::vector< int > &ik2iktot, const std::vector< int > &isk, std::ofstream &ofs_running)
bool read_wfc_nao_spin_populations (const std::string &readin_dir, int nkstot, int nspin, bool gamma_only, bool binary, int my_rank, std::vector< double > &populations)
void read_wfc_nao_one_data (std::ifstream &ifs, float &data)
 Reads a single data value from an input file stream.
void read_wfc_nao_one_data (std::ifstream &ifs, double &data)
void read_wfc_nao_one_data (std::ifstream &ifs, std::complex< float > &data)
 Reads a single complex data value from an input file stream.
void read_wfc_nao_one_data (std::ifstream &ifs, std::complex< double > &data)
template<typename T>
bool read_wfc_nao (const std::string &global_readin_dir, const Parallel_Orbitals &ParaV, psi::Psi< T > &psid, ModuleBase::matrix &ekb, ModuleBase::matrix &wg, const std::vector< int > &ik2iktot, const int nkstot, const int nspin, const bool binary, const int skip_band=0, const int istep=-1)
 Reads the wavefunction coefficients from an input file.
void read_wfc_pw (const std::string &filedir, const ModulePW::PW_Basis_K *pw_wfc, const int rank_in_pool, const int nproc_in_pool, const int nbands, const int npol, const int &ik, const int &ikstot, const int &nkstot, ModuleBase::ComplexMatrix &wfc)
 read wave functions from binary file
void wfc_nao_write2file (const std::string &name, const double *ctot, const int nlocal, const int ik, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const bool &writeBinary, const bool &append_flag, const std::string &header)
 write real-valued Gamma-only wavefunction coefficients to a file.
void wfc_nao_write2file_complex (const std::string &name, const std::complex< double > *ctot, const int nlocal, const int &ik, const ModuleBase::Vector3< double > &kvec_c, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const bool &writeBinary, const bool &append_flag, const std::string &header)
 write complex wavefunction coefficients to a file.
template<typename T>
void write_wfc_nao (const int out_type, const int out_app_flag, const psi::Psi< T > &psi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const std::vector< int > &ik2iktot, const int nkstot, const Parallel_Orbitals &pv, const int nspin, std::ofstream &ofs_running, const int istep)
template void write_wfc_nao< double > (const int out_type, const int out_app_flag, const psi::Psi< double > &psi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const std::vector< int > &ik2iktot, const int nkstot, const Parallel_Orbitals &pv, const int nspin, std::ofstream &ofs_running, const int istep)
template void write_wfc_nao< std::complex< double > > (const int out_type, const int out_app_flag, const psi::Psi< std::complex< double > > &psi, const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const std::vector< ModuleBase::Vector3< double > > &kvec_c, const std::vector< int > &ik2iktot, const int nkstot, const Parallel_Orbitals &pv, const int nspin, std::ofstream &ofs_running, const int istep)
void write_wfc_pw (const int istep, const int iter, const int append_step, const int kpar, const int my_pool, const int my_rank, const int nbands, const int nspin, const int npol, const int rank_in_pool, const int nproc_in_pool, const int out_wfc_pw, const int out_app_flag, const double &ecutwfc, const std::string &global_out_dir, const psi::Psi< std::complex< double > > &psi, const K_Vectors &kv, const ModulePW::PW_Basis_K *wfcpw, std::ofstream &ofs_running)
void print_build_info ()
void parse_args (int argc, char **argv)
 This function returns the version information when using command "abacus --version", "abacus -v" or "abacus -V"; returns the compilation details when using command "abacus --info", "abacus -i" or "abacus -I"; otherwise, it returns usage.
int run_control_option_size (int argc, char *argv[], int index)
CommandLineArgs parse_command_line (int argc, char *argv[])
void print_help (const std::string &bin_name)
 Prints a short pointer to the canonical general help on standard error.
std::vector< double > read_k (std::string filename, int ik)

Detailed Description

Internal helpers shared by the R-space sparse text writers. Declared here (instead of duplicated in each anonymous namespace) so the header layout, R records and file-append rules cannot diverge between hs_sparse_io.cpp, dhs_sparse_writer.cpp, pos_op_csr.cpp, hsr_writer.cpp and write_dmr.cpp.

Unit tests for the INPUT availability parser and metadata validator.

Typedef Documentation

◆ DosSpectrum

using ModuleIO::DosSpectrum = std::vector<std::array<double, 5>>

◆ InputValues

using ModuleIO::InputValues = std::map<std::string, InputValue>

◆ RCoordinate

◆ SparseRBlock

template<typename T>
using ModuleIO::SparseRBlock = std::map<size_t, std::map<size_t, T>>

◆ SparseRMatrix

template<typename T>
using ModuleIO::SparseRMatrix = std::map<RCoordinate, SparseRBlock<T>>

◆ TAC

using ModuleIO::TAC = std::pair<int, TC>

◆ TC

using ModuleIO::TC = std::array<int, 3>

Enumeration Type Documentation

◆ AvailabilityValueKind

Enumerator
Unknown 
Boolean 
Integer 
Real 
String 
BooleanVector 
IntegerVector 
RealVector 
StringVector 

Function Documentation

◆ all_band_energy()

template<typename T>
double ModuleIO::all_band_energy ( const int ik,
const std::vector< T > & mat_mo,
const Parallel_Blkcyclic & p2d,
const ModuleBase::matrix & wg )

Sum over bands with occupation weights.

Template Parameters
TData type (double or std::complex<double>)
Parameters
ikK-point index
mat_moMO-space matrix
p2dParallel_Blkcyclic distribution
wgOccupation weights
Returns
Weighted sum of diagonal elements
Here is the call graph for this function:
Here is the caller graph for this function:

◆ all_band_energy< double >()

template double ModuleIO::all_band_energy< double > ( const int ,
const std::vector< double > & ,
const Parallel_Blkcyclic & ,
const ModuleBase::matrix &  )

◆ all_band_energy< std::complex< double > >()

template double ModuleIO::all_band_energy< std::complex< double > > ( const int ,
const std::vector< std::complex< double > > & ,
const Parallel_Blkcyclic & ,
const ModuleBase::matrix &  )
Here is the call graph for this function:

◆ assume_as_boolean()

bool ModuleIO::assume_as_boolean ( const std::string & val)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ availability_value_kind()

AvailabilityValueKind ModuleIO::availability_value_kind ( const std::string & type)

Convert the documentation type of an Input_Item into the type information needed to validate availability operators and literals.

Here is the caller graph for this function:

◆ build_eband_header()

std::string ModuleIO::build_eband_header ( const int istep,
const double etot_eV,
const std::string & term_symbol,
const std::string & time_stamp )

Build the five comment lines preceding band-decomposed energy data.

Parameters
istepZero-based ionic step index, printed one-based.
etot_eVTotal energy of the written frame in eV.
term_symbolOperator symbol used in the expectation value expression.
time_stampTimestamp shared by all files of the same run.
Returns
Comment block terminated by a newline.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_dos()

bool ModuleIO::cal_dos ( const int & is,
const std::string & fn,
const double & de_ev,
const double & emax_ev,
const double & emin_ev,
const double & bcoeff,
const int & nks,
const int & nkstot,
const std::vector< double > & wk,
const std::vector< int > & isk,
const int & nbands,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const int istep_in,
const int out_app_flag,
const int precision,
const int bndpar,
DosSpectrum * spectrum )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_HR_sparse()

template<typename T>
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, T > > > ModuleIO::cal_HR_sparse ( const hamilt::HContainer< T > & hR,
const double sparse_thr )

Helper to calculate sparse HR representation.

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

◆ cal_ldos_pw()

template<typename Device>
void ModuleIO::cal_ldos_pw ( const elecstate::ElecStatePW< std::complex< double > > * pelec,
const psi::Psi< std::complex< double >, Device > & psi,
const Device * ctx,
const Parallel_Grid & pgrid,
const UnitCell & ucell,
const std::vector< int > & out_ldos,
const std::vector< double > & stm_bias,
const int nspin,
const int istep,
const std::string & global_out_dir,
const bool two_fermi,
const int nbands,
const double dos_edelta_ev,
const double dos_scale,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const double dos_sigma,
const std::vector< double > & ldos_line,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_ldos_pw< base_device::DEVICE_CPU >()

template void ModuleIO::cal_ldos_pw< base_device::DEVICE_CPU > ( const elecstate::ElecStatePW< std::complex< double > > * pelec,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & psi,
const base_device::DEVICE_CPU * ctx,
const Parallel_Grid & pgrid,
const UnitCell & ucell,
const std::vector< int > & out_ldos,
const std::vector< double > & stm_bias,
const int nspin,
const int istep,
const std::string & global_out_dir,
const bool two_fermi,
const int nbands,
const double dos_edelta_ev,
const double dos_scale,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const double dos_sigma,
const std::vector< double > & ldos_line,
std::ofstream & ofs_running )

◆ cal_LxijR()

std::complex< double > ModuleIO::cal_LxijR ( const std::unique_ptr< TwoCenterIntegrator > & calculator,
const int it,
const int ia,
const int il,
const int iz,
const int im,
const int jt,
const int ja,
const int jl,
const int jz,
const int jm,
const ModuleBase::Vector3< double > & vR )

calculate the <phi_i|Lx|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).

Parameters
calculatorthe std::unique_ptr<TwoCenterIntegrator> instance
itatomtype index of the first atom
iaatomic index of the first atom within the atomtype
ilangular momentum index of the first atom
izzeta function index of the first atom
mimagnetic quantum number of the first atom
jtatomtype index of the second atom
jaatomic index of the second atom within the atomtype
jlangular momentum index of the second atom
jzzeta function index of the second atom
mjmagnetic quantum number of the second atom
vRthe vector from the first atom to the second atom
Returns
std::complex<double>
Here is the caller graph for this function:

◆ cal_LyijR()

std::complex< double > ModuleIO::cal_LyijR ( const std::unique_ptr< TwoCenterIntegrator > & calculator,
const int it,
const int ia,
const int il,
const int iz,
const int im,
const int jt,
const int ja,
const int jl,
const int jz,
const int jm,
const ModuleBase::Vector3< double > & vR )

calculate the <phi_i|Ly|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).

Parameters
calculatorthe std::unique_ptr<TwoCenterIntegrator> instance
itatomtype index of the first atom
iaatomic index of the first atom within the atomtype
ilangular momentum index of the first atom
izzeta function index of the first atom
mimagnetic quantum number of the first atom
jtatomtype index of the second atom
jaatomic index of the second atom within the atomtype
jlangular momentum index of the second atom
jzzeta function index of the second atom
mjmagnetic quantum number of the second atom
vRthe vector from the first atom to the second atom
Returns
std::complex<double>
Here is the caller graph for this function:

◆ cal_LzijR()

std::complex< double > ModuleIO::cal_LzijR ( const std::unique_ptr< TwoCenterIntegrator > & calculator,
const int it,
const int ia,
const int il,
const int iz,
const int mi,
const int jt,
const int ja,
const int jl,
const int jz,
const int mj,
const ModuleBase::Vector3< double > & vR )

calculate the <phi_i|Lz|phi_j> matrix elements, in which the Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).

Parameters
calculatorthe std::unique_ptr<TwoCenterIntegrator> instance
itatomtype index of the first atom
iaatomic index of the first atom within the atomtype
ilangular momentum index of the first atom
izzeta function index of the first atom
mimagnetic quantum number of the first atom
jtatomtype index of the second atom
jaatomic index of the second atom within the atomtype
jlangular momentum index of the second atom
jzzeta function index of the second atom
mjmagnetic quantum number of the second atom
vRthe vector from the first atom to the second atom
Returns
std::complex<double>
Here is the caller graph for this function:

◆ cal_mag()

template<typename TK>
void ModuleIO::cal_mag ( Parallel_Orbitals * pv,
hamilt::Hamilt< TK > * p_ham,
K_Vectors & kv,
module_dm::DensityMatrix< TK, double > * dm,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
UnitCell & ucell,
const Grid_Driver & gd,
const int istep,
const int out_app_flag,
const bool print )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_pdos() [1/2]

std::vector< ModuleBase::matrix > ModuleIO::cal_pdos ( const psi::Psi< double > * psi,
hamilt::Hamilt< double > * p_ham,
const Parallel_Orbitals & pv,
const K_Vectors & kv,
const int nspin0,
const int nbands,
const ModuleBase::matrix & ekb,
const double & emax,
const double & emin,
const double & dos_edelta_ev,
const double & bcoeff,
const int nlocal,
const int nspin )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_pdos() [2/2]

std::vector< ModuleBase::matrix > ModuleIO::cal_pdos ( const psi::Psi< std::complex< double > > * psi,
hamilt::Hamilt< std::complex< double > > * p_ham,
const Parallel_Orbitals & pv,
const K_Vectors & kv,
const int nspin0,
const int nbands,
const ModuleBase::matrix & ekb,
const double & emax,
const double & emin,
const double & dos_edelta_ev,
const double & bcoeff,
const int nlocal,
const int nspin )
Here is the call graph for this function:

◆ calculate_RI_Tensor_sparse()

template<typename Tdata>
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, Tdata > > > ModuleIO::calculate_RI_Tensor_sparse ( const double & sparse_threshold,
const std::map< int, std::map< TAC, RI::Tensor< Tdata > > > & Hexxs,
const UnitCell & ucell )

calculate CSR sparse matrix from the global matrix stored with RI::Tensor the return type is same as SR_sparse, HR_sparse, etc.

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

◆ calculate_RI_Tensor_sparse< double >()

template std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, double > > > ModuleIO::calculate_RI_Tensor_sparse< double > ( const double & ,
const std::map< int, std::map< TAC, RI::Tensor< double > > > & ,
const UnitCell &  )

◆ calculate_RI_Tensor_sparse< std::complex< double > >()

template std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, std::complex< double > > > > ModuleIO::calculate_RI_Tensor_sparse< std::complex< double > > ( const double & ,
const std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > & ,
const UnitCell &  )
Here is the call graph for this function:

◆ check_sccs_inp()

bool ModuleIO::check_sccs_inp ( const Input_para & input,
std::string & error )
Here is the caller graph for this function:

◆ check_td_efield_parameters()

void ModuleIO::check_td_efield_parameters ( const Input_para & input)

Validate the structure and waveform-defining constraints of RT-TDDFT fields.

Parameters
inputInput parameters after all values and dynamic defaults are resolved.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_td_vecpot_paths()

void ModuleIO::check_td_vecpot_paths ( const std::string & input_dir,
const std::string & output_dir )

Reject output that aliases the input file, including symbolic and hard links.

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

◆ collect_MW_nspin4()

void ModuleIO::collect_MW_nspin4 ( ModuleBase::matrix & MecMulP,
const ModuleBase::ComplexMatrix & mud,
int nw,
const Parallel_Orbitals * pv )

Accumulate the nspin=4 Mulliken charge and Mx/My/Mz components.

Decomposes one k-point mud = DM*S^T into the Pauli components using the conj-first DM convention (DM = conj(P), see dm_from_psi.h): Mx = Re(mud_ud + mud_du), My = Im(mud_ud - mud_du), Mz = Re(mud_uu - mud_dd).

Parameters
MecMulPaccumulators [4 x nw/2]: 0 = charge, 1/2/3 = Mx/My/Mz
mudDM*S^T stored in ScaLAPACK column-major layout
nwtotal number of spinor orbitals (2 * number of spatial orbitals)
pvorbital distribution mapping
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_iter_lcao()

template<typename TK, typename TR>
void ModuleIO::ctrl_iter_lcao ( UnitCell & ucell,
const Input_para & inp,
K_Vectors & kv,
elecstate::ElecState * pelec,
module_dm::DensityMatrix< TK, double > & dm,
Parallel_Orbitals & pv,
Grid_Driver & gd,
psi::Psi< TK > * psi,
Charge & chr,
Charge_Mixing * p_chgmix,
hamilt::HamiltLCAO< TK, TR > * p_hamilt,
LCAO_Orbitals & orb,
Setup_DeePKS< TK > & deepks,
Exx_NAO< TK > & exx_nao,
const Exx_Info & exx_info,
int & iter,
const int istep,
bool & conv_esolver,
const double & scf_ene_thr )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_iter_lcao< double, double >()

template void ModuleIO::ctrl_iter_lcao< double, double > ( UnitCell & ucell,
const Input_para & inp,
K_Vectors & kv,
elecstate::ElecState * pelec,
module_dm::DensityMatrix< double, double > & dm,
Parallel_Orbitals & pv,
Grid_Driver & gd,
psi::Psi< double > * psi,
Charge & chr,
Charge_Mixing * p_chgmix,
hamilt::HamiltLCAO< double, double > * p_hamilt,
LCAO_Orbitals & orb,
Setup_DeePKS< double > & deepks,
Exx_NAO< double > & exx_nao,
const Exx_Info & exx_info,
int & iter,
const int istep,
bool & conv_esolver,
const double & scf_ene_thr )

◆ ctrl_iter_lcao< std::complex< double >, double >()

template void ModuleIO::ctrl_iter_lcao< std::complex< double >, double > ( UnitCell & ucell,
const Input_para & inp,
K_Vectors & kv,
elecstate::ElecState * pelec,
module_dm::DensityMatrix< std::complex< double >, double > & dm,
Parallel_Orbitals & pv,
Grid_Driver & gd,
psi::Psi< std::complex< double > > * psi,
Charge & chr,
Charge_Mixing * p_chgmix,
hamilt::HamiltLCAO< std::complex< double >, double > * p_hamilt,
LCAO_Orbitals & orb,
Setup_DeePKS< std::complex< double > > & deepks,
Exx_NAO< std::complex< double > > & exx_nao,
const Exx_Info & exx_info,
int & iter,
const int istep,
bool & conv_esolver,
const double & scf_ene_thr )
Here is the call graph for this function:

◆ ctrl_iter_pw()

void ModuleIO::ctrl_iter_pw ( const int istep,
const int iter,
const double & conv_esolver,
Setup_Psi_pw & stp,
const K_Vectors & kv,
const ModulePW::PW_Basis_K * pw_wfc,
const Input_para & inp,
bool final_output,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_output_fp()

void ModuleIO::ctrl_output_fp ( UnitCell & ucell,
const Input_para & inp,
elecstate::ElecState * pelec,
ModulePW::PW_Basis_Big * pw_big,
ModulePW::PW_Basis * pw_rhod,
Charge & chr,
surchem & solvent,
Parallel_Grid & para_grid,
const int istep,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_output_td()

template<typename TR>
void ModuleIO::ctrl_output_td ( const UnitCell & ucell,
double ** rho_save,
const ModulePW::PW_Basis * rhopw,
const int istep,
const psi::Psi< std::complex< double > > * psi,
const elecstate::ElecState * pelec,
const K_Vectors & kv,
const TwoCenterIntegrator * intor,
const Parallel_Orbitals * pv,
const LCAO_Orbitals & orb,
const Velocity_op< TR > * velocity_mat,
const Grid_Driver & grid,
hamilt::HamiltLCAO< std::complex< double >, TR > * p_hamilt,
Record_adj & RA,
TD_info * td_p,
const Exx_NAO< std::complex< double > > & exx_nao,
const Exx_Info & exx_info )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_output_td< double >()

template void ModuleIO::ctrl_output_td< double > ( const UnitCell & ,
double ** ,
const ModulePW::PW_Basis * ,
const int ,
const psi::Psi< std::complex< double > > * ,
const elecstate::ElecState * ,
const K_Vectors & ,
const TwoCenterIntegrator * ,
const Parallel_Orbitals * ,
const LCAO_Orbitals & ,
const Velocity_op< double > * ,
const Grid_Driver & ,
hamilt::HamiltLCAO< std::complex< double >, double > * ,
Record_adj & ,
TD_info * ,
const Exx_NAO< std::complex< double > > & ,
const Exx_Info &  )

◆ ctrl_output_td< std::complex< double > >()

template void ModuleIO::ctrl_output_td< std::complex< double > > ( const UnitCell & ,
double ** ,
const ModulePW::PW_Basis * ,
const int ,
const psi::Psi< std::complex< double > > * ,
const elecstate::ElecState * ,
const K_Vectors & ,
const TwoCenterIntegrator * ,
const Parallel_Orbitals * ,
const LCAO_Orbitals & ,
const Velocity_op< std::complex< double > > * ,
const Grid_Driver & ,
hamilt::HamiltLCAO< std::complex< double >, std::complex< double > > * ,
Record_adj & ,
TD_info * ,
const Exx_NAO< std::complex< double > > & ,
const Exx_Info &  )
Here is the call graph for this function:

◆ ctrl_output_td_pw()

void ModuleIO::ctrl_output_td_pw ( const pw::TDVelResultPW & currents,
const pw::TDSpinResultPW & moments,
const pw::CurrentRequest & request,
const std::string & mag_partition,
const std::string & orbital_dir,
double onsite_radius,
bool calc_torque,
const std::vector< std::string > & orbital_fn,
int step,
double dt_ha,
int nspin,
int nkstot,
int rank,
const std::string & directory,
std::ostream & log )

Write precomputed endpoint observables on the designated output rank.

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

◆ ctrl_runner_lcao()

template<typename TK, typename TR>
void ModuleIO::ctrl_runner_lcao ( UnitCell & ucell,
const Input_para & inp,
const int istep,
K_Vectors & kv,
elecstate::ElecState * pelec,
const module_dm::Setup_DM< TK > & dmat,
Parallel_Orbitals & pv,
Parallel_Grid & pgrid,
Grid_Driver & gd,
psi::Psi< TK > * psi,
Charge & chr,
hamilt::HamiltLCAO< TK, TR > * p_hamilt,
TwoCenterBundle & two_center_bundle,
LCAO_Orbitals & orb,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis * pw_rhod,
Structure_Factor & sf,
ModuleBase::matrix & vloc,
Exx_NAO< TK > & exx_nao,
const Exx_Info & exx_info,
surchem & solvent,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctrl_runner_lcao< double, double >()

template void ModuleIO::ctrl_runner_lcao< double, double > ( UnitCell & ucell,
const Input_para & inp,
const int istep,
K_Vectors & kv,
elecstate::ElecState * pelec,
const module_dm::Setup_DM< double > & dmat,
Parallel_Orbitals & pv,
Parallel_Grid & pgrid,
Grid_Driver & gd,
psi::Psi< double > * psi,
Charge & chr,
hamilt::HamiltLCAO< double, double > * p_hamilt,
TwoCenterBundle & two_center_bundle,
LCAO_Orbitals & orb,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis * pw_rhod,
Structure_Factor & sf,
ModuleBase::matrix & vloc,
Exx_NAO< double > & exx_nao,
const Exx_Info & exx_info,
surchem & solvent,
std::ofstream & ofs_running )

◆ ctrl_runner_lcao< std::complex< double >, double >()

template void ModuleIO::ctrl_runner_lcao< std::complex< double >, double > ( UnitCell & ucell,
const Input_para & inp,
const int istep,
K_Vectors & kv,
elecstate::ElecState * pelec,
const module_dm::Setup_DM< std::complex< double > > & dmat,
Parallel_Orbitals & pv,
Parallel_Grid & pgrid,
Grid_Driver & gd,
psi::Psi< std::complex< double > > * psi,
Charge & chr,
hamilt::HamiltLCAO< std::complex< double >, double > * p_hamilt,
TwoCenterBundle & two_center_bundle,
LCAO_Orbitals & orb,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis * pw_rhod,
Structure_Factor & sf,
ModuleBase::matrix & vloc,
Exx_NAO< std::complex< double > > & exx_nao,
const Exx_Info & exx_info,
surchem & solvent,
std::ofstream & ofs_running )
Here is the call graph for this function:

◆ ctrl_runner_pw() [1/2]

template<typename T, typename Device>
void ModuleIO::ctrl_runner_pw ( UnitCell & ucell,
elecstate::ElecState * pelec,
ModulePW::PW_Basis_K * pw_wfc,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis * pw_rhod,
Charge & chr,
K_Vectors & kv,
Setup_Psi_pw & stp,
Structure_Factor & sf,
pseudopot_cell_vnl & ppcell,
surchem & solvent,
const base_device::DeviceContext * ctx,
Parallel_Grid & para_grid,
const Input_para & inp,
std::ofstream & ofs_running )

◆ ctrl_runner_pw() [2/2]

template<typename T, typename Device>
template void ModuleIO::ctrl_runner_pw< std::complex< double >, base_device::DEVICE_CPU > ( UnitCell & ucell,
elecstate::ElecState * pelec,
ModulePW::PW_Basis_K * pw_wfc,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis * pw_rhod,
Charge & chr,
K_Vectors & kv,
Setup_Psi_pw & stp,
Structure_Factor & sf,
pseudopot_cell_vnl & ppcell,
surchem & solvent,
Parallel_Grid & para_grid,
const int istep,
const Input_para & inp,
std::ofstream & ofs_running )

1) Compute LDOS

2) Calculate the spillage value, which are used to generate numerical atomic orbitals

3) Use Kubo-Greenwood method to compute conductivities

4) generate training data for ML-KEDF

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

◆ ctrl_scf_lcao()

template<typename TK, typename TR>
void ModuleIO::ctrl_scf_lcao ( UnitCell & ucell,
const Input_para & inp,
K_Vectors & kv,
elecstate::ElecState * pelec,
module_dm::DensityMatrix< TK, double > * dm,
Parallel_Orbitals & pv,
Grid_Driver & gd,
psi::Psi< TK > * psi,
hamilt::HamiltLCAO< TK, TR > * p_hamilt,
Plus_U_Base & dftu,
TwoCenterBundle & two_center_bundle,
LCAO_Orbitals & orb,
const ModulePW::PW_Basis_K * pw_wfc,
const ModulePW::PW_Basis * pw_rho,
const ModulePW::PW_Basis_Big * pw_big,
Structure_Factor & sf,
const ModulePW::PW_Basis * pw_rhod,
const ModuleBase::matrix & vloc,
surchem & solvent,
rdmft::RDMFT< TK, TR > & rdmft_solver,
Setup_DeePKS< TK > & deepks,
Exx_NAO< TK > & exx_nao,
const Exx_Info & exx_info,
const bool conv_esolver,
const bool scf_nmax_flag,
const bool last_ion_step,
const int istep,
std::ofstream & ofs_running )

1) print out density of states (DOS)

2) Output density matrix DM(R)

3) Output density matrix DM(k)

5) Output electronic wavefunctions Psi(k)

6) Output DeePKS information

7a) Output H(R) and S(R) matrices in CSR format

7a.1) Output H(R), S(R), and DM(R) matrices in NPZ format

7b) Output dH, dS, T, r matrices (old sparse path, without H/S), only for multi-k

7c) Output atomic dH components (dT/dτ, dV^NL/dτ, dV^L/dτ, dV^H/dτ, dV^XC/dτ), only for nspin =1, 2 now

7d) Output H components (T, Vnl, Vl, Vh, Vxc)

8) Output kinetic matrix

8b) Output exchange-correlation potential and band-decomposed energies

9) Output expectation of angular momentum operator

10) Output Mulliken charge

11) Output atomic magnetization by using 'spin_constraint'

12) Output Berry phase

13) Wannier90 interface in LCAO basis

17) Perform RDMFT calculations, added by jghan, 2024-10-17

initialize the gradients of Etotal with respect to occupation numbers and wfc, and set all elements to 0. dedocc = d E/d Occ_Num

dedwfc = d E/d wfc

17) Output quasi orbitals

18) Calculate and output asynchronous overlap matrix for Hefei-NAMD

Here is the caller graph for this function:

◆ ctrl_scf_pw()

template<typename T, typename Device>
template void ModuleIO::ctrl_scf_pw< std::complex< double >, base_device::DEVICE_CPU > ( const int istep,
UnitCell & ucell,
elecstate::ElecState * pelec,
const Charge & chr,
const pseudopot_cell_vnl & ppcell,
const K_Vectors & kv,
const ModulePW::PW_Basis_K * pw_wfc,
const ModulePW::PW_Basis * pw_rho,
const ModulePW::PW_Basis * pw_rhod,
const ModulePW::PW_Basis_Big * pw_big,
Setup_Psi_pw & stp,
const Parallel_Grid & para_grid,
const Input_para & inp,
std::ofstream & ofs_running )

4) Compute density of states (DOS)

6) calculate Wannier functions in pw basis

7) calculate Berry phase polarization in pw basis

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

◆ cVc()

template<typename T>
std::vector< T > ModuleIO::cVc ( const T * V,
const T * c,
const int nbasis,
const int nbands,
const Parallel_Orbitals & pv,
const Parallel_Blkcyclic & p2d )

Compute c^dagger * V * c in MO basis.

Template Parameters
TData type (double or std::complex<double>)
Parameters
VAO-space matrix V (nbasis x nbasis)
cAO-to-MO transformation coefficients (nbasis x nbands)
nbasisNumber of AO basis functions
nbandsNumber of bands
pvParallel_Orbitals for AO distribution
p2dParallel_Blkcyclic for MO distribution
Returns
MO-space matrix c^dagger * V * c (nbands x nbands)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cVc< double >()

template std::vector< double > ModuleIO::cVc< double > ( const double * ,
const double * ,
const int ,
const int ,
const Parallel_Orbitals & ,
const Parallel_Blkcyclic &  )

◆ cVc< std::complex< double > >()

template std::vector< std::complex< double > > ModuleIO::cVc< std::complex< double > > ( const std::complex< double > * ,
const std::complex< double > * ,
const int ,
const int ,
const Parallel_Orbitals & ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ dense_buffer_index()

std::size_t ModuleIO::dense_buffer_index ( const int i,
const int j,
const int nlocal,
const bool column_major )

Flat index of matrix element (i, j) in a gathered buffer.

A row-major buffer stores (i, j) at i * nlocal + j, while a column-major buffer stores it at j * nlocal + i. Writers and readers of the flat NAO text layout must share this mapping so that the file always stays row-major.

Parameters
[in]irow index, must be non-negative
[in]jcolumn index, must be non-negative
[in]nlocalmatrix dimension, must be positive
[in]column_majorwhether the buffer is stored column-major
Here is the caller graph for this function:

◆ dh_atom_filter()

std::vector< int > ModuleIO::dh_atom_filter ( const std::vector< int > & param)
inline
Here is the caller graph for this function:

◆ dhk_gen_fname()

std::string ModuleIO::dhk_gen_fname ( const std::string & prefix,
const int ispin,
const int nspin,
const bool numbered,
const int istep )

Generate filename for the k-space derivative matrices (dH(k), dT(k), ...). A spin suffix is added only for nspin == 2 so the two spin channels do not overwrite each other; a single spin channel keeps the bare name.

Parameters
numberedwhether the ionic step is embedded as a g{step} suffix (out_app_flag == 2)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dhr_gen_fname()

std::string ModuleIO::dhr_gen_fname ( const std::string & prefix,
const int ispin,
const bool numbered,
const int istep )

Generate filename for derivative matrices (dH/dR, dS/dR).

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

◆ dmk_gen_fname()

std::string ModuleIO::dmk_gen_fname ( const bool gamma_only,
const int ispin,
const int nspin,
const int ik,
const int istep )

Generates the filename for the DMK file based on the given parameters.

Parameters
gamma_onlyWhether the calculation is gamma_only.
ispinThe index of the spin component.
ikThe index of the k-point.
Returns
The generated filename.
Here is the caller graph for this function:

◆ dmk_readData() [1/2]

bool ModuleIO::dmk_readData ( std::ifstream & ifs,
double & data )

Read one double from a file.

Returns
false when the extraction fails (truncated or malformed body).
Here is the caller graph for this function:

◆ dmk_readData() [2/2]

bool ModuleIO::dmk_readData ( std::ifstream & ifs,
std::complex< double > & data )

Read one complex double from a file.

Returns
false when the extraction fails (truncated, empty token or a token that is not of the "(re,im)" form).

◆ dmr_gen_fname()

std::string ModuleIO::dmr_gen_fname ( const int out_type,
const int ispin,
const bool numbered = false,
const int istep = -1 )

Generates a filename for the DMR output based on the given parameters.

Parameters
out_typeThe output type. 1: csr, 2: npz.
ispinThe spin value, starting from 0.
numberedWhether the ionic step is embedded in the filename as a g{step} suffix (true for out_app_flag == 2).
istepThe ION step (default: -1), starting from 0.
Returns
The generated filename as a string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dsp_effective_kpar()

int ModuleIO::dsp_effective_kpar ( const std::string & basis_type,
const int kpar,
const int kpar_lcao )
inline

The k-point pool count actually consumed by the current basis.

After ReadInput::reset_value, exactly one of (kpar, kpar_lcao) carries the user value and the other is 1. Select explicitly by basis_type instead of std::max so the invariant is documented and enforced.

Here is the caller graph for this function:

◆ dsp_kpar_layout_valid()

bool ModuleIO::dsp_kpar_layout_valid ( const int nproc,
const std::string & basis_type,
const int kpar,
const int kpar_lcao,
const int bndpar,
const std::string & esolver_type )
inline

Check whether a k-point/band parallel layout satisfies the DSP vendor library constraint.

On DSP hardware, the mtblas/C_PACK libraries require exactly one MPI process per k-point pool: the effective pool count (kpar for PW, kpar_lcao for LCAO) times bndpar must equal nproc exactly. Non-positive nproc / pool count / bndpar are invalid layouts. Always returns true when esolver_type is dp or nep. See issue #8228.

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

◆ dsp_layout_check_needed()

bool ModuleIO::dsp_layout_check_needed ( const std::string & esolver_type)
inline

Whether the DSP kpar/bndpar layout constraint applies.

esolver_type = dp / nep are machine-learning interatomic-potential solvers: they never build a PW/LCAO Hamiltonian, never construct k-point pools or band groups, and never call the mtblas/C_PACK vendor libraries, so the layout constraint is inapplicable. Comparison is case-insensitive. See issue #8228.

Here is the caller graph for this function:

◆ eband_filename()

std::string ModuleIO::eband_filename ( const std::string & stem,
const int istep,
const int out_app_flag )

Compose the name of a band-decomposed energy file.

Parameters
stemBase name without extension, e.g. "eband_vxc"
istepZero-based ionic step index; mode 2 prints it one-based
out_app_flagOutput mode: 2 appends g{step} to the stem
Returns
File name such as "eband_vxc.txt" or "eband_vxcg5.txt"
Here is the caller graph for this function:

◆ evaluate_input_condition()

bool ModuleIO::evaluate_input_condition ( const AvailabilityExpr & expression,
const InputValues & values )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filename_output()

std::string ModuleIO::filename_output ( const std::string & directory,
const std::string & property,
const std::string & basis,
const int ik_local,
const std::vector< int > & ik2iktot,
const int nspin,
const int nkstot,
const int out_type,
const int out_app_flag,
const bool gamma_only,
const int istep = -1,
const int iter = -1 )

Generates the filename for the output files

Parameters
directorydirectory of the file
propertywave function (wf), charge density (chg) or matrix (mat)
basisnao or pw
ik_localindex of the k-points within each pool, and starting from 0.
ik2iktotmap from ik to iktot
nspinnumber of spin channels, 1,2 or 4
nkstotnumber of total k-points
out_typetwo types of output file format, 1 for .txt and 2 for .dat (binary)
out_app_flag0=fixed filename, overwritten at each write; 1=fixed filename, appended; 2=subdirectory layout with a g{step} suffix.
gamma_onlygamma_only algorithm or not.
istepindex of the ion step starting from 0. The step number is only embedded in the filename in mode 2 (out_app_flag == 2), and only when istep >= 0.
iterindex of the electronic step starting from 0. The step number is only embedded in the filename in mode 2 (out_app_flag == 2), and only when iter >= 0.
Returns
The generated filename.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter_nonascii_and_comment()

bool ModuleIO::filter_nonascii_and_comment ( std::ifstream & ifs,
std::stringstream & out_ascii_stream )
Here is the caller graph for this function:

◆ frame_appends()

bool ModuleIO::frame_appends ( const int out_app_flag,
const int istep )
inline

Tell whether an output written for ionic step istep should append.

Mode 1 appends every frame after the first ionic step, keeping one trajectory file. Mode 0 truncates to the latest snapshot and mode 2 writes a separate file per step, so neither of them appends.

Parameters
out_app_flagOutput append mode, must be 0, 1 or 2.
istepZero-based ionic step index, must be non-negative.
Returns
true when the frame must be appended to an existing file.
Exceptions
std::invalid_argumentif out_app_flag or istep is out of range.
Here is the caller graph for this function:

◆ gen_ini_filename()

std::string ModuleIO::gen_ini_filename ( const std::string & prefix,
const std::string & out_dir,
const int nspin,
const int is,
const int istep,
const bool include_geom_step )
Here is the caller graph for this function:

◆ get_grid_points()

void ModuleIO::get_grid_points ( const std::vector< double > & start,
const std::vector< double > & end,
const int & npoints,
const int & nx,
const int & ny,
const int & nz,
std::vector< std::vector< int > > & points,
std::vector< std::vector< double > > & shifts )
Here is the caller graph for this function:

◆ get_real() [1/2]

double ModuleIO::get_real ( const double & d)
inline

Extract real part (for real numbers, identity).

◆ get_real() [2/2]

double ModuleIO::get_real ( const std::complex< double > & c)
inline

Extract real part (for complex numbers).

Here is the caller graph for this function:

◆ hsr_gen_fname() [1/2]

std::string ModuleIO::hsr_gen_fname ( const std::string & prefix,
const int ispin,
const bool numbered,
const int istep )

Generate filename for spin-dependent HR output.

Parameters
numberedwhether the ionic step is embedded as a g{step} suffix (out_app_flag == 2)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hsr_gen_fname() [2/2]

std::string ModuleIO::hsr_gen_fname ( const std::string & prefix,
const int ispin,
const bool numbered,
const int istep,
const int out_type )

Generate filename for spin-dependent HR output in the selected format.

Here is the call graph for this function:

◆ input_diagnostic()

std::string ModuleIO::input_diagnostic ( const std::string & label,
const std::string & value,
const std::string & origin,
const std::string & expected )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ input_manual_link()

std::string ModuleIO::input_manual_link ( const std::string & label)
Here is the caller graph for this function:

◆ ldos_mode_pw()

template<typename Device>
void ModuleIO::ldos_mode_pw ( const elecstate::ElecStatePW< std::complex< double > > * pelec,
const psi::Psi< std::complex< double >, Device > & psi,
const Device * ctx,
const Parallel_Grid & pgrid,
const UnitCell & ucell,
const int istep,
const std::string & global_out_dir,
const int nbands,
const double dos_edelta_ev,
const double dos_scale,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi,
const double dos_sigma,
const std::vector< double > & ldos_line,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libxc_r_channel_suffixes()

std::vector< std::string > ModuleIO::libxc_r_channel_suffixes ( const std::string & data_name,
int nspin )

Build the channel suffixes appended to the cube file names of one Libxc quantity.

The suffix encodes the Libxc channel index tuple, which differs per quantity order:

  • rho / vrho : s1, s2 (real spin indices)
  • exc / amag : empty suffix (scalar quantity)
  • sigma / vsigma / v2rho2 : (00), (01), (11) for nspin=2
  • v2rhosigma : (0_00), (0_01), (0_11), (1_00), (1_01), (1_11)
  • v2sigma2 : (00_00), (00_01), (00_11), (01_01), (01_11), (11_11)
  • v3rho3 : (0_0_0), (0_0_1), (0_1_1), (1_1_1)
  • v4rho4 : (0_0_0_0), (0_0_0_1), (0_0_1_1), (0_1_1_1), (1_1_1_1)
  • v3rho2sigma : 9 channels, v3rhosigma2 : 12, v3sigma3 : 10
  • v4rho3sigma : 12 channels, v4rho2sigma2 : 18, v4rhosigma3 : 20, v4sigma4 : 15
Parameters
data_nameQuantity label used in the file name (e.g. "v2rhosigma").
nspinNumber of spin channels of the calculation, 1 or 2.
Returns
One suffix per Libxc channel, in Libxc packing order.
Exceptions
std::invalid_argumentif nspin is not 1 or 2, or data_name is unknown.
Here is the caller graph for this function:

◆ local_timestamp()

std::string ModuleIO::local_timestamp ( )
inline

Local wall-clock timestamp "YYYY-MM-DD HH:MM:SS" for the provenance header of output files. Call once per frame and pass the result to provenance_header() so all files of the same frame carry one timestamp.

Here is the caller graph for this function:

◆ longstring()

std::string ModuleIO::longstring ( const std::vector< std::string > & words)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_compact_spin_tag()

std::string ModuleIO::make_compact_spin_tag ( const int is,
const int nspin )
inline

Compact spin-channel label used in per-spin output files (bands1.txt, wfk1s1_nao.txt, ...). Unlike make_spin_tag, which pads "up" so both channels share one width in the running log, this form is unpadded because it heads a file that holds a single channel. Returns " (spin up)", " (spin down)" or an empty string.

Here is the caller graph for this function:

◆ make_data_desc()

std::string ModuleIO::make_data_desc ( const std::string & base,
const std::string & mag_base,
const int is,
const int nspin )
inline

Build a descriptive label for the data channel at spin index is. For nspin==2 and is>=0: appends " (spin up )" or " (spin down)". For nspin==4 and is>0: returns mag_base with the axis letter appended, e.g. mag_base "magnetization density m" yields "magnetization density mx". For nspin==1, nspin==4 with is==0, or spin-summed calls (is<0): no suffix.

Parameters
baselabel of the scalar channel (is == 0), e.g. "charge density".
mag_baselabel of the nspin==4 magnetic channels (is = 1..3), ending with the component letter: "m" for magnetization densities (rho[1..3]), "b" for magnetic fields (the B_xc components of the effective potential).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_spin_tag()

std::string ModuleIO::make_spin_tag ( const int is,
const int nspin )
inline

Running-log suffix naming the collinear spin channel of an output. Returns " (spin up )" for nspin==2 and is==0, " (spin down)" for nspin==2 and is==1, and an empty string otherwise (nspin==1, nspin==4, or is<0).

Here is the caller graph for this function:

◆ nofound_str()

std::string ModuleIO::nofound_str ( std::vector< std::string > init_chgs,
const std::string & str )
Here is the caller graph for this function:

◆ nscf_bands()

void ModuleIO::nscf_bands ( const int & is,
const std::string & eig_file,
const int & nband,
const double & fermie,
const int & precision,
const ModuleBase::matrix & ekb,
const K_Vectors & kv,
const std::string & header,
const int out_app_flag )

calculate the band structure

Parameters
isspin index is = 0 or 1
eig_filefile to save the band structure
nbandnumber of bands
fermiefermi energy
precisionprecision of the output
ekbeigenvalues of k points and bands
kvklist
headerprovenance header written once in front of the k-point block; pass an empty string to omit it
out_app_flagoutput append mode: 0 = truncate, 1 = append

first find if present kpoint in present pool

then get the local kpoint index, which starts definitly from 0

if present kpoint corresponds the spin of the present one

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

◆ orbital_energy()

template<typename T>
std::vector< double > ModuleIO::orbital_energy ( const int ik,
const int nbands,
const std::vector< T > & mat_mo,
const Parallel_Blkcyclic & p2d )

Extract diagonal elements (orbital energies) from MO matrix.

Template Parameters
TData type (double or std::complex<double>)
Parameters
ikK-point index (for occupancy weights)
nbandsNumber of bands
mat_moMO-space matrix
p2dParallel_Blkcyclic distribution
Returns
Vector of orbital energies (length nbands)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ orbital_energy< double >()

template std::vector< double > ModuleIO::orbital_energy< double > ( const int ,
const int ,
const std::vector< double > & ,
const Parallel_Blkcyclic &  )

◆ orbital_energy< std::complex< double > >()

template std::vector< double > ModuleIO::orbital_energy< std::complex< double > > ( const int ,
const int ,
const std::vector< std::complex< double > > & ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ output_after_relax()

void ModuleIO::output_after_relax ( bool conv_ion,
bool conv_esolver,
std::ofstream & ofs_running )

output after relaxation

Parameters
conv_ionif is convergence for ions
conv_esolverif is convergence for electrons
ofs_runningthe output stream
Here is the caller graph for this function:

◆ output_convergence_after_scf()

void ModuleIO::output_convergence_after_scf ( const bool & convergence,
double & energy,
std::ofstream & ofs_running )

output if is convergence and energy after scf

Parameters
convergenceif is convergence
energythe total energy in Ry
ofs_runningthe output stream
Here is the caller graph for this function:

◆ output_dHR()

void ModuleIO::output_dHR ( const int & istep,
const ModuleBase::matrix & v_eff,
const UnitCell & ucell,
const Parallel_Orbitals & pv,
LCAO_HS_Arrays & HS_Arrays,
const Grid_Driver & grid,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
const MatROutputOptions & options,
const bool gamma_only_local,
const int npol,
const int nlocal,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_dSR()

void ModuleIO::output_dSR ( const int & istep,
const UnitCell & ucell,
const Parallel_Orbitals & pv,
LCAO_HS_Arrays & HS_Arrays,
const Grid_Driver & grid,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
const MatROutputOptions & options,
const bool gamma_only_local,
const int npol,
const int nlocal,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_efermi()

void ModuleIO::output_efermi ( const bool & convergence,
const elecstate::Efermi & eferm,
std::ofstream & ofs_running )

output the fermi energy

Parameters
convergenceif is convergence
efermthe fermi energy structure (supports single and two fermi energies)
ofs_runningthe output stream
Here is the caller graph for this function:

◆ output_mat_npz() [1/2]

void ModuleIO::output_mat_npz ( const UnitCell & ucell,
std::string & zipname,
const hamilt::HContainer< double > & hR )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_mat_npz() [2/2]

void ModuleIO::output_mat_npz ( const UnitCell & ucell,
std::string & zipname,
const hamilt::HContainer< std::complex< double > > & hR )
Here is the call graph for this function:

◆ output_mat_npz_impl()

template<typename T>
void ModuleIO::output_mat_npz_impl ( const UnitCell & ucell,
std::string & zipname,
const hamilt::HContainer< T > & hR )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_mat_sparse()

template<typename T>
void ModuleIO::output_mat_sparse ( const MatSparseOutputOptions & options,
const int & istep,
const ModuleBase::matrix & v_eff,
const Parallel_Orbitals & pv,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
UnitCell & ucell,
const Grid_Driver & grid,
const K_Vectors & kv,
hamilt::Hamilt< T > * p_ham,
Plus_U_Base * p_dftu,
const std::string & global_out_dir,
const std::string & global_matrix_dir,
const std::string & calculation,
const int out_app_flag,
const int nspin,
const bool gamma_only_local,
const int npol,
const int nlocal,
const bool cal_force,
std::ofstream & ofs_running )

the output interface to write the sparse matrix of dH, dS, T, and r

generate a file containing the kinetic energy matrix

generate a file containing the derivatives of the Hamiltonian matrix (in Ry/Bohr)

generate a file containing the derivatives of the overlap matrix (in 1/Bohr)

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

◆ output_mat_sparse< double >()

template void ModuleIO::output_mat_sparse< double > ( const MatSparseOutputOptions & options,
const int & istep,
const ModuleBase::matrix & v_eff,
const Parallel_Orbitals & pv,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
UnitCell & ucell,
const Grid_Driver & grid,
const K_Vectors & kv,
hamilt::Hamilt< double > * p_ham,
Plus_U_Base * p_dftu,
const std::string & global_out_dir,
const std::string & global_matrix_dir,
const std::string & calculation,
const int out_app_flag,
const int nspin,
const bool gamma_only_local,
const int npol,
const int nlocal,
const bool cal_force,
std::ofstream & ofs_running )

◆ output_mat_sparse< std::complex< double > >()

template void ModuleIO::output_mat_sparse< std::complex< double > > ( const MatSparseOutputOptions & options,
const int & istep,
const ModuleBase::matrix & v_eff,
const Parallel_Orbitals & pv,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
UnitCell & ucell,
const Grid_Driver & grid,
const K_Vectors & kv,
hamilt::Hamilt< std::complex< double > > * p_ham,
Plus_U_Base * p_dftu,
const std::string & global_out_dir,
const std::string & global_matrix_dir,
const std::string & calculation,
const int out_app_flag,
const int nspin,
const bool gamma_only_local,
const int npol,
const int nlocal,
const bool cal_force,
std::ofstream & ofs_running )
Here is the call graph for this function:

◆ output_SR()

template<typename TK>
void ModuleIO::output_SR ( const UnitCell & ucell,
Parallel_Orbitals & pv,
const Grid_Driver & grid,
hamilt::Hamilt< TK > * p_ham,
const bool & binary,
const double & sparse_threshold,
const int precision,
const std::string & global_matrix_dir,
const std::string & calculation,
const int out_app_flag,
const int nspin,
const int istep,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_TR()

void ModuleIO::output_TR ( const int istep,
const UnitCell & ucell,
const Parallel_Orbitals & pv,
LCAO_HS_Arrays & HS_Arrays,
const Grid_Driver & grid,
const TwoCenterBundle & two_center_bundle,
const LCAO_Orbitals & orb,
const std::string & TR_filename,
const MatROutputOptions & options,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_vacuum_level()

void ModuleIO::output_vacuum_level ( const UnitCell * ucell,
const double *const * rho,
const double * v_elecstat,
const int & nx,
const int & ny,
const int & nz,
const int & nxyz,
const int & nrxx,
const int & nplane,
const int & startz_current,
std::ofstream & ofs_running )

calculate and output the vacuum level We first determine the vacuum direction, then get the vacuum position based on the minimum of charge density, finally output the vacuum level, i.e., the electrostatic potential at the vacuum position.

Parameters
ucellthe unitcell
rhocharge density
v_elecstatelectrostatic potential
ofs_runningthe output stream
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_args()

void ModuleIO::parse_args ( int argc,
char ** argv )

This function returns the version information when using command "abacus --version", "abacus -v" or "abacus -V"; returns the compilation details when using command "abacus --info", "abacus -i" or "abacus -I"; otherwise, it returns usage.

Parameters
[in]argc(ARGument Count) is an integer variable that stores the number of command-line arguments passed by the user including the name of the program. So if we pass a value to a program, the value of argc would be 2 (one for argument and one for program name)
[in]argv(ARGument Vector) is an array of character pointers listing all the arguments. If argc is greater than zero, the array elements from argv[0] to argv[argc-1] will contain pointers to strings. argv[0] is the name of the program , After that till argv[argc-1] every element is command -line arguments.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_availability()

AvailabilityExpr ModuleIO::parse_availability ( const std::string & raw)

Parse a canonical availability string into its boolean-expression tree.

The input must exactly match the AST serialization (param==value, param in [a, b], comparison operators, and/or combinators and (...) grouping). An empty string yields an empty (always-available) expression. Invalid or non-canonical input throws std::invalid_argument.

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

◆ parse_command_line()

CommandLineArgs ModuleIO::parse_command_line ( int argc,
char * argv[] )

Parses -p/–parameter and -in/–input options. Throws std::runtime_error on malformed arguments (parse_args has already filtered unknown flags before this function is called).

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

◆ parse_imp_sol()

bool ModuleIO::parse_imp_sol ( const std::string & value,
int & model,
std::string & error )
Here is the caller graph for this function:

◆ parse_spreads()

bool ModuleIO::parse_spreads ( const std::vector< std::string > & words,
std::vector< double > & spreads,
std::string & error )
Here is the caller graph for this function:

◆ prep_td_field_out() [1/2]

void ModuleIO::prep_td_field_out ( const std::string & output_dir,
const elecstate::TDFieldManager & manager,
const bool restart )

Prepare total endpoint E and, for analytic fields, the configured waveform files.

Here is the call graph for this function:

◆ prep_td_field_out() [2/2]

void ModuleIO::prep_td_field_out ( const std::string & output_dir,
std::size_t field_count,
bool restart )

Prepare electric-field output files for an RT-TDDFT calculation.

Parameters
output_dirOutput directory including its trailing path separator.
field_countNumber of configured time-dependent electric fields.
restartWhether the calculation continues from an MD/RT-TDDFT restart.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prep_td_vecpot_out()

void ModuleIO::prep_td_vecpot_out ( const std::string & output_dir,
bool restart )

Prepare the vector-potential output file for an RT-TDDFT calculation.

Parameters
output_dirOutput directory including its trailing path separator.
restartWhether the calculation continues from an MD/RT-TDDFT restart.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_dos()

void ModuleIO::prepare_dos ( std::ofstream & ofs_running,
const elecstate::Efermi & energy_fermi,
const ModuleBase::matrix & ekb,
const int nks,
const int nbands,
const double & dos_edelta_ev,
const double & dos_scale,
double & emax,
double & emin,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_build_info()

void ModuleIO::print_build_info ( )
Here is the caller graph for this function:

◆ print_conserv()

void ModuleIO::print_conserv ( const pw::TDConserv & values,
double npsi0,
double nrho0,
int step,
bool full_gram,
const std::string & orth,
std::ofstream & log )

Print endpoint conservation relative to the caller's initial counts.

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

◆ print_dipole_moment()

void ModuleIO::print_dipole_moment ( std::ofstream & ofs_running,
const std::string & name,
double px,
double py,
double pz )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_eij()

void ModuleIO::print_eij ( const std::complex< double > * eij,
const int nband,
const int leading_dimension,
const EijOutputInfo & output_info,
std::ostream & ofs )

Print selected elements of a column-major Hamiltonian in the orbital basis, in Ry.

Here is the caller graph for this function:

◆ print_eij_pw() [1/3]

template void ModuleIO::print_eij_pw ( hsolver::HSOperator< std::complex< double >, base_device::DEVICE_CPU > & ,
hsolver::TDOrbOps< std::complex< double >, base_device::DEVICE_CPU > & ,
psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & ,
const K_Vectors & ,
int ,
int ,
int ,
double ,
std::ostream &  )

◆ print_eij_pw() [2/3]

template void ModuleIO::print_eij_pw ( hsolver::HSOperator< std::complex< float >, base_device::DEVICE_CPU > & ,
hsolver::TDOrbOps< std::complex< float >, base_device::DEVICE_CPU > & ,
psi::Psi< std::complex< float >, base_device::DEVICE_CPU > & ,
const K_Vectors & ,
int ,
int ,
int ,
double ,
std::ostream &  )

◆ print_eij_pw() [3/3]

template<typename T, typename Device>
void ModuleIO::print_eij_pw ( hsolver::HSOperator< T, Device > & op,
hsolver::TDOrbOps< T, Device > & orbitals,
psi::Psi< T, Device > & current,
const K_Vectors & kv,
int nspin,
int step,
int iter,
double threshold,
std::ostream & log )

Collect and print Eij from an already bound endpoint Hamiltonian. All ranks participate; both k-point cursors are restored before returning.

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

◆ print_force()

void ModuleIO::print_force ( std::ofstream & ofs,
const UnitCell & cell,
const std::string & name,
const ModuleBase::matrix & force,
bool ry = true )

output atomic forces

Parameters
ofsthe output stream
cellthe unitcell
nameforce term name
forceatomic forces
rytrue if the unit of force is a.u.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_help()

void ModuleIO::print_help ( const std::string & bin)

Prints a short pointer to the canonical general help on standard error.

Here is the caller graph for this function:

◆ print_kpar()

void ModuleIO::print_kpar ( const int & nks,
const int & kpar_lcao )
Here is the call graph for this function:

◆ print_net_force()

void ModuleIO::print_net_force ( std::ofstream & ofs,
const ModuleBase::Vector3< double > & net_force )

output the net force vector and the magnitude of the force drift

Parameters
ofsthe output stream
net_forcethe sum of all atomic forces, in Ry/Bohr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_PAOs()

void ModuleIO::print_PAOs ( const UnitCell & ucell)

print chi (PAO) in pseudopotential file

Parameters
ucell
Here is the caller graph for this function:

◆ print_parameters()

void ModuleIO::print_parameters ( const UnitCell & ucell,
K_Vectors & kv,
const Input_para & inp )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_rhofft()

void ModuleIO::print_rhofft ( ModulePW::PW_Basis * pw_rhod,
ModulePW::PW_Basis * pw_rho,
ModulePW::PW_Basis_Big * pw_big,
std::ofstream & ofs )

Print charge density using FFT.

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

◆ print_screen()

void ModuleIO::print_screen ( const int & stress_step,
const int & force_step,
const int & istep )
Here is the caller graph for this function:

◆ print_stress()

void ModuleIO::print_stress ( const std::string & name,
const ModuleBase::matrix & scs,
const bool screen,
const bool ry,
std::ofstream & ofs )

output stress components

Parameters
namestress term name
fstress components
rytrue if the unit of force is a.u.
Here is the caller graph for this function:

◆ print_time()

void ModuleIO::print_time ( time_t & time_start,
time_t & time_finish )
Here is the caller graph for this function:

◆ print_wfcfft()

void ModuleIO::print_wfcfft ( const Input_para & inp,
ModulePW::PW_Basis_K & pw_wfc,
std::ofstream & ofs )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prov_inline()

std::string ModuleIO::prov_inline ( const std::string & time_stamp)
inline

Inline provenance for formats such as Cube that reserve a fixed number of header lines. Callers append this to an existing comment line.

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

◆ prov_step()

std::string ModuleIO::prov_step ( const int istep_one_based,
const std::string & time_stamp )
inline

Two provenance lines followed by the unified "# Ionic_Step N" marker.

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

◆ provenance_header()

std::string ModuleIO::provenance_header ( const std::string & time_stamp)
inline

First two comment lines shared by per-step output files (band*.txt, wfk*_nao.txt, eband_*.txt, ...): "# ABACUS version: ..." and "# Written at ...". Callers append their own step/energy lines after this block.

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

◆ read_abacus_orb()

void ModuleIO::read_abacus_orb ( std::ifstream & ifs,
std::string & elem,
double & ecut,
int & nr,
double & dr,
std::vector< int > & nzeta,
std::vector< std::vector< double > > & radials,
const int rank = 0 )

static version of read_abacus_orb. A delete-new operation may cause the memory leak, it is better to use std::vector to replace the raw pointer.

Parameters
ifs[in] ifstream from the orbital file, via std::ifstream ifs(forb);
elem[out] element symbol
ecut[out] planewave energy cutoff
nr[out] number of radial grid points
dr[out] radial grid spacing
nzeta[out] number of zeta functions for each angular momentum
radials[out] radial orbitals
rank[in] MPI rank
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_cube()

bool ModuleIO::read_cube ( const std::string & file,
std::vector< std::string > & comment,
int & natom,
std::vector< double > & origin,
int & nx,
int & ny,
int & nz,
std::vector< double > & dx,
std::vector< double > & dy,
std::vector< double > & dz,
std::vector< int > & atom_type,
std::vector< double > & atom_charge,
std::vector< std::vector< double > > & atom_pos,
std::vector< double > & data )

read the full data from a cube file

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

◆ read_dmk()

template<typename T>
bool ModuleIO::read_dmk ( const int nspin,
const int nk,
const K_Vectors & kv,
const Parallel_Blkcyclic & pv,
const bool column_major,
const std::string & dmk_dir,
const int istep,
const int out_app_flag,
std::vector< std::vector< T > > & dmk,
std::ofstream & ofs_running )

Reads the DMK data from a file.

Template Parameters
TThe type of the DMK data.
Parameters
nspinThe number of spin components.
nkThe number of k-points.
k-vectorinformation.
pvThe Parallel_Blkcyclic object. Will get the global size and local size from it, and seperate the data into different processors accordingly.
column_majorWhether the local DMK blocks must be stored column-major (genelpa/elpa/scalapack_gvx and the other column-major solvers). The file body is row-major, so this selects the destination index of each element.
dmk_dirThe directory path of the DMK file.
istepThe ionic step to read. With out_app_flag == 1 it selects the frame of the appended multi-step file, and a negative value keeps the first frame; with out_app_flag == 2 it has to match the g{istep+1} file name and the frame marker it contains.
out_app_flagMust mirror the value used by write_dmk, because it decides whether the step is part of the filename.
dmkA vector to store the DMK data. If use MPI parallel, the data will be seperated into different processors based on the Parallel_Blkcyclic object.
Returns
True if the DMK data is successfully read, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_exit_file()

int ModuleIO::read_exit_file ( const int & my_rank,
const std::string & filename,
std::ofstream & ofs_running )

read file to determine whether to stop the current execution

Parameters
my_rankthe rank of the current process
filenamethe name of the file to read
ofs_runningthe output stream
Returns
0 if the file is not found or does not contain correct keywords, do not stop the current execution
1 if the file is found and contains "stop_ion", the current execution stops at the next ionic step
2 if the file is found and contains "stop_elec", the current execution stops at the next electronic step
Here is the caller graph for this function:

◆ read_Hexxs_cereal()

template<typename Tdata>
void ModuleIO::read_Hexxs_cereal ( const std::string & file_name,
std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > & Hexxs )

read Hexxs in cereal format

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

◆ read_Hexxs_cereal< double >()

template void ModuleIO::read_Hexxs_cereal< double > ( const std::string & ,
std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &  )

◆ read_Hexxs_cereal< std::complex< double > >()

template void ModuleIO::read_Hexxs_cereal< std::complex< double > > ( const std::string & ,
std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &  )
Here is the call graph for this function:

◆ read_Hexxs_csr()

template<typename Tdata>
void ModuleIO::read_Hexxs_csr ( const std::string & file_name,
const UnitCell & ucell,
const int nspin,
const int nbasis,
std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > & Hexxs )

read Hexxs in CSR format

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

◆ read_Hexxs_csr< double >()

template void ModuleIO::read_Hexxs_csr< double > ( const std::string & ,
const UnitCell & ,
const int ,
const int ,
std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &  )

◆ read_Hexxs_csr< std::complex< double > >()

template void ModuleIO::read_Hexxs_csr< std::complex< double > > ( const std::string & ,
const UnitCell & ,
const int ,
const int ,
std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &  )
Here is the call graph for this function:

◆ read_information()

void ModuleIO::read_information ( std::stringstream & ifs,
std::vector< std::string > & output,
const std::string & delimiters )
Here is the caller graph for this function:

◆ read_k()

std::vector< double > ModuleIO::read_k ( std::string filename,
int ik )
Here is the caller graph for this function:

◆ read_mat_npz()

void ModuleIO::read_mat_npz ( const Parallel_Orbitals * paraV,
const UnitCell & ucell,
std::string & zipname,
hamilt::HContainer< double > & hR )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_td_vecpot()

std::vector< ModuleBase::Vector3< double > > ModuleIO::read_td_vecpot ( const std::string & input_dir)

Read Cartesian vector potentials for an RT-TDDFT calculation.

Parameters
input_dirInput directory including its trailing path separator.
Returns
Vector potentials in atomic units, ordered by file row.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_vdata_palgrid()

bool ModuleIO::read_vdata_palgrid ( const Parallel_Grid & pgrid,
const int my_rank,
std::ostream & ofs_running,
const std::string & fn,
double *const data,
const int nat )

read volumetric data from .cube file into the parallel distributed grid.

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

◆ read_wf2rho_pw()

void ModuleIO::read_wf2rho_pw ( const ModulePW::PW_Basis_K * pw_wfc,
ModuleSymmetry::Symmetry & symm,
Charge & chg,
const std::string & readin_dir,
const int kpar,
const int my_pool,
const int my_rank,
const int nproc_in_pool,
const int rank_in_pool,
const int nbands,
const int nspin,
const int npol,
const int nkstot,
const std::vector< int > & ik2iktot,
const std::vector< int > & isk,
std::ofstream & ofs_running )

read wave functions and occupation numbers to charge density

Parameters
pw_wfcpw basis for wave functions
symmsymmetry
nkstottotal number of k points
iskk index to spin index
chgcharge density
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_wf2rho_pw_impl()

template<typename Device>
void ModuleIO::read_wf2rho_pw_impl ( const ModulePW::PW_Basis_K * pw_wfc,
ModuleSymmetry::Symmetry & symm,
Charge & chg,
const std::string & readin_dir,
const int kpar,
const int my_pool,
const int my_rank,
const int nproc_in_pool,
const int rank_in_pool,
const int nbands,
const int nspin,
const int npol,
const int nkstot,
const std::vector< int > & ik2iktot,
const std::vector< int > & isk,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_wfc_nao()

template<typename T>
bool ModuleIO::read_wfc_nao ( const std::string & global_readin_dir,
const Parallel_Orbitals & ParaV,
psi::Psi< T > & psid,
ModuleBase::matrix & ekb,
ModuleBase::matrix & wg,
const std::vector< int > & ik2iktot,
const int nkstot,
const int nspin,
const bool binary,
const int skip_band = 0,
const int istep = -1 )

Reads the wavefunction coefficients from an input file.

Template Parameters
TThe type of the wavefunction coefficients.
Parameters
global_readin_dirThe global directory for reading input files.
ParaVThe parallel orbitals object.
psidThe Psi object to store the wavefunction coefficients.
pelecPointer to the ElecState object.
binaryWhether to read the binary format instead of the text format.
skip_bandFrom which band to start reading.
Returns
True if the wavefunction coefficients are successfully read, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_wfc_nao_one_data() [1/4]

void ModuleIO::read_wfc_nao_one_data ( std::ifstream & ifs,
double & data )

◆ read_wfc_nao_one_data() [2/4]

void ModuleIO::read_wfc_nao_one_data ( std::ifstream & ifs,
float & data )

Reads a single data value from an input file stream.

Parameters
ifsThe input file stream to read from.
dataThe variable to store the read data value.
Here is the caller graph for this function:

◆ read_wfc_nao_one_data() [3/4]

void ModuleIO::read_wfc_nao_one_data ( std::ifstream & ifs,
std::complex< double > & data )

◆ read_wfc_nao_one_data() [4/4]

void ModuleIO::read_wfc_nao_one_data ( std::ifstream & ifs,
std::complex< float > & data )

Reads a single complex data value from an input file stream.

Parameters
ifsThe input file stream to read from.
dataThe variable to store the read complex data value.

◆ read_wfc_nao_spin_populations()

bool ModuleIO::read_wfc_nao_spin_populations ( const std::string & readin_dir,
int nkstot,
int nspin,
bool gamma_only,
bool binary,
int my_rank,
std::vector< double > & populations )

Read spin populations from all bands, without allocating wavefunction matrices. File occupations are already weighted by their k-point weights.

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

◆ read_wfc_pw()

void ModuleIO::read_wfc_pw ( const std::string & filedir,
const ModulePW::PW_Basis_K * pw_wfc,
const int rank_in_pool,
const int nproc_in_pool,
const int nbands,
const int npol,
const int & ik,
const int & ikstot,
const int & nkstot,
ModuleBase::ComplexMatrix & wfc )

read wave functions from binary file

Parameters
filenamefilename containing wave functions
pw_wfcwave function FFT grids
ikk index
ikstottotal index of k points
nkstottotal number of k points
wfcwave functions
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_control_option_size()

int ModuleIO::run_control_option_size ( int argc,
char * argv[],
int index )

Number of tokens occupied by one run-control option, including its values. Returns zero for other options; throws std::runtime_error for missing values.

Here is the caller graph for this function:

◆ save_dH_sparse()

void ModuleIO::save_dH_sparse ( const int & istep,
const Parallel_Orbitals & pv,
const UnitCell * ucell,
LCAO_HS_Arrays & HS_Arrays,
const double & sparse_thr,
const bool & binary,
const std::string & fileflag,
const int precision,
const std::string & global_matrix_dir,
const std::string & calculation,
const int out_app_flag,
const int nspin,
const int nlocal,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_lat_r()

template<typename T>
void ModuleIO::save_lat_r ( std::ofstream & ofs,
const SparseRBlock< T > & XR,
const Parallel_Blkcyclic & layout,
const SparseWriteOptions & options )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_lat_r_csr()

template<typename T>
void ModuleIO::save_lat_r_csr ( std::ofstream & ofs,
const SparseRBlock< T > & XR,
const Parallel_Blkcyclic & layout,
const SparseWriteOptions & options )

Write one R block in the H(R)/S(R)/r(R) CSR text layout.

The block is reduced across ranks exactly like save_lat_r, then printed through SparseMatrix so that values wrap every six entries and an empty block still carries its three CSR sections. Only the root rank opens the output stream, so ofs.is_open() selects the rank that owns the assembled matrix and performs the printing; every rank still takes part in the collective reduction.

Parameters
ofsOutput text stream.
XRSparse block of the selected matrix component.
layoutBlock-cyclic distribution used for the MPI reduction.
optionsSparse output options (threshold, precision, reduction).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_lat_r_empty_csr()

template<typename T>
template void ModuleIO::save_lat_r_empty_csr< double > ( std::ofstream & ofs,
int nlocal,
const SparseWriteOptions & options )

Write an all-zero R block in the H(R)/S(R)/r(R) CSR text layout.

Callers that already know a block is globally empty (for example from an allreduced nonzero count) use this instead of save_lat_r_csr to skip its row-wise MPI reductions. The emitted bytes are identical to save_lat_r_csr on an empty block: an empty SparseMatrix printed on the rank that owns the stream.

Parameters
ofsOutput text stream.
nlocalNumber of localized basis functions.
optionsSparse output options (precision and reduce flag).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_mat()

template<typename T>
void ModuleIO::save_mat ( const int istep,
const T * mat,
const int dim,
const bool bit,
const int precision,
const bool tri,
const bool app,
const std::string & file_name,
const Parallel_Blkcyclic & pv,
const int drank,
const std::string & ks_solver,
const bool reduce = true )

save a square matrix, such as H(k) and S(k)

Parameters
[in]istep: the step of the calculation
[in]mat: the local matrix
[in]dim: the dimension of the square matrix
[in]bit: true for binary, false for decimal
[in]precision: the precision of the decimal output
[in]tri: true for upper triangle, false for full matrix
[in]app: true for append, false for overwrite
[in]file_name: the name of the output file
[in]pv: the 2d-block parallelization information
[in]drank: the rank of the current process in the diagonalization world
[in]ks_solver: the name of the eigensolver (decides row/column major)
[in]reduce: whether to reduce across ranks before writing
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_sparse()

template<typename Tdata>
void ModuleIO::save_sparse ( const SparseRMatrix< Tdata > & smat,
const std::set< RCoordinate > & all_R_coor,
const Parallel_Orbitals & pv,
const SparseWriteOptions & options )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_para2d_MO()

void ModuleIO::set_para2d_MO ( const Parallel_Orbitals & pv,
const int nbands,
Parallel_Blkcyclic & p2d )

Set up a 2D parallel distribution for MO-space matrices (nbands x nbands).

Parameters
pvParallel_Orbitals describing the AO distribution
nbandsNumber of bands
p2dOutput Parallel_Blkcyclic object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sr_gen_fname() [1/2]

std::string ModuleIO::sr_gen_fname ( const bool numbered,
const int istep )

Generate filename for spin-independent SR output.

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

◆ sr_gen_fname() [2/2]

std::string ModuleIO::sr_gen_fname ( const bool numbered,
const int istep,
const int out_type )

Generate filename for spin-independent SR output in the selected format.

Here is the call graph for this function:

◆ stm_mode_pw()

template<typename Device>
void ModuleIO::stm_mode_pw ( const elecstate::ElecStatePW< std::complex< double > > * pelec,
const psi::Psi< std::complex< double >, Device > & psi,
const Device * ctx,
const Parallel_Grid & pgrid,
const UnitCell & ucell,
const std::vector< double > & stm_bias,
const int nspin,
const int istep,
const std::string & global_out_dir,
const bool two_fermi,
const int out_ldos_precision,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stru_frame_filename()

std::string ModuleIO::stru_frame_filename ( const std::string & directory,
const int out_app_flag,
const int istep )
inline

Fixed STRU for overwrite/append modes; numbered STRU for mode 2.

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

◆ TEST() [1/20]

ModuleIO::TEST ( AvailabilityParser ,
AndGroup  )
Here is the call graph for this function:

◆ TEST() [2/20]

ModuleIO::TEST ( AvailabilityParser ,
EmptyIsAlwaysAvailable  )
Here is the call graph for this function:

◆ TEST() [3/20]

ModuleIO::TEST ( AvailabilityParser ,
InListRoundTrip  )
Here is the call graph for this function:

◆ TEST() [4/20]

ModuleIO::TEST ( AvailabilityParser ,
InvalidExpressionsAreRejected  )
Here is the call graph for this function:

◆ TEST() [5/20]

ModuleIO::TEST ( AvailabilityParser ,
LeafEqualityRoundTrip  )
Here is the call graph for this function:

◆ TEST() [6/20]

ModuleIO::TEST ( AvailabilityParser ,
NonCanonicalSpellingIsRejected  )
Here is the call graph for this function:

◆ TEST() [7/20]

ModuleIO::TEST ( AvailabilityParser ,
ParenthesisedOrNesting  )
Here is the call graph for this function:

◆ TEST() [8/20]

ModuleIO::TEST ( AvailabilityParser ,
QuotedMultiTokenValueRoundTrip  )
Here is the call graph for this function:

◆ TEST() [9/20]

ModuleIO::TEST ( AvailabilityParser ,
SetterPreservesStateOnParseFailure  )
Here is the call graph for this function:

◆ TEST() [10/20]

ModuleIO::TEST ( AvailabilityParser ,
SlashRemainsPartOfSingleEqualityValue  )
Here is the call graph for this function:

◆ TEST() [11/20]

ModuleIO::TEST ( AvailabilityParser ,
VectorContainmentSemantics  )
Here is the call graph for this function:

◆ TEST() [12/20]

ModuleIO::TEST ( AvailabilityValidator ,
AcceptsDependenciesOfDependencies  )
Here is the call graph for this function:

◆ TEST() [13/20]

ModuleIO::TEST ( AvailabilityValidator ,
AcceptsKnownTypedReferences  )
Here is the call graph for this function:

◆ TEST() [14/20]

ModuleIO::TEST ( AvailabilityValidator ,
AcceptsOrPrerequisiteImpliedByPath  )
Here is the call graph for this function:

◆ TEST() [15/20]

ModuleIO::TEST ( AvailabilityValidator ,
ChecksPrerequisitesTransitivelyThroughOr  )
Here is the call graph for this function:

◆ TEST() [16/20]

ModuleIO::TEST ( AvailabilityValidator ,
InfersDocumentedTypes  )
Here is the call graph for this function:

◆ TEST() [17/20]

ModuleIO::TEST ( AvailabilityValidator ,
RejectsMissingTransitiveRequirement  )
Here is the call graph for this function:

◆ TEST() [18/20]

ModuleIO::TEST ( AvailabilityValidator ,
RejectsSelfReference  )
Here is the call graph for this function:

◆ TEST() [19/20]

ModuleIO::TEST ( AvailabilityValidator ,
RejectsUnknownAndIncompatibleReferences  )
Here is the call graph for this function:

◆ TEST() [20/20]

ModuleIO::TEST ( AvailabilityValidator ,
RequiresExactNonEqualityPrerequisite  )
Here is the call graph for this function:

◆ to_dir()

std::string ModuleIO::to_dir ( const std::string & str)
Here is the caller graph for this function:

◆ trilinear_interpolate() [1/2]

void ModuleIO::trilinear_interpolate ( const double *const data_in,
const int & nx_read,
const int & ny_read,
const int & nz_read,
const int & nx,
const int & ny,
const int & nz,
double * data_out )

The trilinear interpolation method.

Trilinear interpolation is a method for interpolating grid data in 3D space. It estimates the value at a given position by interpolating the data along the three adjacent points.

Specifically, for 3D grid data, trilinear interpolation requires determining the eight data points that are closest to the point where the estimation is required. These data points form a cube, with vertices at (x0,y0,z0), (x0+1,y0,z0), (x0,y0+1,z0), (x0+1,y0+1,z0), (x0,y0,z0+1), (x0+1,y0,z0+1), (x0,y0+1,z0+1) and (x0+1,y0+1,z0+1). Here, (x0,y0,z0) is the data point closest to the estimation point and has coordinate values less than those of the estimation point.

For the estimation location (x,y,z), its estimated value in the grid can be calculated using the following formula: f(x,y,z) = f000(1-dx)(1-dy)(1-dz) + f100dx(1-dy)(1-dz) + f010(1-dx)dy(1-dz) + f001(1-dx)(1-dy)dz + f101dx(1-dy)dz + f011(1-dx)dydz + f110dxdy(1-dz) + f111dxdydz where fijk represents the data value at vertex i,j,k of the cube, and dx = x - x0, dy = y - y0, dz = z - z0 represent the distance between the estimation point and the closest data point in each of the three directions, divided by the grid spacing. Here, it is assumed that the grid spacing is equal and can be omitted during computation.

Parameters
data_inthe input data of size nxyz_read
nx_readnx read from file
ny_readny read from file
nz_readnz read from file
nxthe dimension of grids along x
nythe dimension of grids along y
nzthe dimension of grids along z
data_outthe interpolated results of size nxyz
Here is the call graph for this function:

◆ trilinear_interpolate() [2/2]

void ModuleIO::trilinear_interpolate ( const std::vector< std::vector< int > > & points,
const std::vector< std::vector< double > > & shifts,
const Parallel_Grid & pgrid,
const std::vector< double > & data,
std::vector< double > & results )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate_availability_expr()

void ModuleIO::validate_availability_expr ( const std::string & owner,
const AvailabilityExpr & expression,
const std::map< std::string, AvailabilityValueKind > & parameter_types )

Validate references, operators and literal values in one availability AST. Throws std::invalid_argument when metadata cannot be evaluated safely.

Here is the caller graph for this function:

◆ validate_availability_self_contained()

void ModuleIO::validate_availability_self_contained ( const std::string & owner,
const AvailabilityExpr & expression,
const std::map< std::string, AvailabilityExpr > & expressions )

Validate that each path referencing a parameter implies that parameter's availability AST. Associative AND/OR groups are flattened and order-independent; AND prerequisites require every operand, while any satisfied OR branch is sufficient. Different leaf conditions are not related. expressions maps every parameter label to its availability AST. Throws std::invalid_argument when a referenced parameter's prerequisite is missing.

Here is the caller graph for this function:

◆ wfc_nao_write2file()

void ModuleIO::wfc_nao_write2file ( const std::string & name,
const double * ctot,
const int nlocal,
const int ik,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const bool & writeBinary,
const bool & append_flag,
const std::string & header )

write real-valued Gamma-only wavefunction coefficients to a file.

Parameters
nameoutput file name
ctotglobal wavefunction coefficient array, size nbands*nlocal
nlocalnumber of orbitals (basis functions)
iklocal k-point index, used to index ekb/wg rows
ekbeigenvalue matrix
wgoccupation matrix
writeBinarytrue for the binary format, false for text
append_flagtrue to append to an existing file, false to truncate
headerprovenance comment block written before the data in text mode; ignored in binary mode
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wfc_nao_write2file_complex()

void ModuleIO::wfc_nao_write2file_complex ( const std::string & name,
const std::complex< double > * ctot,
const int nlocal,
const int & ik,
const ModuleBase::Vector3< double > & kvec_c,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const bool & writeBinary,
const bool & append_flag,
const std::string & header )

write complex wavefunction coefficients to a file.

Parameters
nameoutput file name
ctotglobal wavefunction coefficient array, size nbands*nlocal
nlocalnumber of orbitals (basis functions)
iklocal k-point index, used to index ekb/wg rows
kvec_cCartesian k-vector of the k-point
ekbeigenvalue matrix
wgoccupation matrix
writeBinarytrue for the binary format, false for text
append_flagtrue to append to an existing file, false to truncate
headerprovenance comment block written before the data in text mode; ignored in binary mode
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_abacus_orb()

void ModuleIO::write_abacus_orb ( std::ofstream & ofs,
const std::string & elem,
const double & ecut,
const int nr,
const double dr,
const std::vector< int > & nzeta,
const std::vector< std::vector< double > > & radials,
const int rank = 0 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_bands()

void ModuleIO::write_bands ( const Input_para & inp,
const ModuleBase::matrix & ekb,
const K_Vectors & kv,
std::ofstream & ofs_running,
const std::string & band_dir,
const int istep )

write the eigenvalues of every spin channel to band.txt (nspin=1/4) or to bands1.txt/bands2.txt (nspin=2).

Parameters
inpinput parameters, out_band[0] enables the output and out_band[1] sets the number of printed decimals
ekbeigenvalues of k points and bands
kvklist
ofs_runningrunning log stream
band_dirdirectory that receives the band output files; the caller resolves it from the output directory configuration
istepzero-based index of the current ionic step, printed one-based in the per-step provenance header
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_chg_init()

void ModuleIO::write_chg_init ( const UnitCell & ucell,
const Parallel_Grid & para_grid,
const Charge & chr,
const elecstate::Efermi & efermi,
const int istep,
const std::string & out_dir,
const Input_para & inp,
const bool two_fermi,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_csr_banner()

void ModuleIO::write_csr_banner ( std::ostream & ofs)

Write the CSR-format description banner used by every text CSR output (H(R)/S(R), DM(R), dH/dR, r(R), T(R), Vxc(R), L(R)).

Parameters
ofsOutput stream.
Here is the caller graph for this function:

◆ write_cube()

void ModuleIO::write_cube ( const std::string & file,
const std::vector< std::string > & comment,
const int & natom,
const std::vector< double > & origin,
const int & nx,
const int & ny,
const int & nz,
const std::vector< double > & dx,
const std::vector< double > & dy,
const std::vector< double > & dz,
const std::vector< int > & atom_type,
const std::vector< double > & atom_charge,
const std::vector< std::vector< double > > & atom_pos,
const std::vector< double > & data,
const int precision,
const bool append,
const int ndata_line = 6 )

write a cube file

Parameters
appendappend a complete frame to an existing file instead of truncating it (out_app_flag == 1 multi-step trajectories).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_cube_header()

void ModuleIO::write_cube_header ( std::ofstream & ofs,
const std::vector< std::string > & comment,
const int & natom,
const std::vector< double > & origin,
const int & nx,
const int & ny,
const int & nz,
const std::vector< double > & dx,
const std::vector< double > & dy,
const std::vector< double > & dz,
const std::vector< int > & atom_type,
const std::vector< double > & atom_charge,
const std::vector< std::vector< double > > & atom_pos,
const int precision )

write the two comment lines, the grid geometry and the atom list of a cube file, and leave the stream configured for the following scientific data block

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

◆ write_cube_header_for_cell()

void ModuleIO::write_cube_header_for_cell ( std::ofstream & ofs,
const UnitCell & ucell,
const int nx,
const int ny,
const int nz,
const std::vector< std::string > & comment,
const int precision )

write a cube header for a volumetric field sampled on the ucell grid (grid spacings, atom types and Cartesian positions are derived from ucell)

Here is the call graph for this function:

◆ write_current_pw()

void ModuleIO::write_current_pw ( const pw::TDVelResultPW & current,
const int istep,
const int nk_per_spin,
const bool out_current_k,
const std::string & out_dir )

Write reduced charge currents on the output rank; performs no collectives.

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

◆ write_dense_text_body() [1/2]

void ModuleIO::write_dense_text_body ( std::ofstream & ofs,
const std::vector< double > & mat,
const int nlocal,
const int precision,
const bool column_major )

Write a dense square matrix body in the flat NAO text layout shared by the DM(k), H(k)/S(k) and T(k) writers.

The documented file layout is row-major: element (i, j) is emitted at position (i * nlocal + j), 8 real or 4 complex values per line, and the record is terminated by a single newline so that an appended record starts on a fresh line.

The gathered buffer keeps the storage order of the eigensolver. For the column-major solvers (genelpa, elpa, scalapack_gvx, cusolver, cusolvermp, pexsi and lapack) the local block is stored as mat[i + j * nrloc], so the row-major destination of Cpxgemr2d keeps a column-major buffer. Reading such a buffer as row-major emits the transpose of the matrix; for a Hermitian matrix that is the complex conjugate, which flips the sign of every imaginary off-diagonal element. The caller selects the traversal order with column_major so the file always stays row-major.

Parameters
[in]ofsoutput stream, already open by the writing rank
[in]matgathered nlocal-by-nlocal matrix on the writing rank
[in]nlocalmatrix dimension, must be positive
[in]precisionnumber of significant digits, must be positive
[in]column_majortrue when the gathered buffer is stored column-major
Here is the caller graph for this function:

◆ write_dense_text_body() [2/2]

void ModuleIO::write_dense_text_body ( std::ofstream & ofs,
const std::vector< std::complex< double > > & mat,
const int nlocal,
const int precision,
const bool column_major )

Complex overload of write_dense_text_body.

Real and imaginary components whose magnitude is below an internal threshold are flushed to zero so that numerical noise does not clutter the output.

Parameters
[in]ofsoutput stream, already open by the writing rank
[in]matgathered nlocal-by-nlocal matrix on the writing rank
[in]nlocalmatrix dimension, must be positive
[in]precisionnumber of significant digits, must be positive
[in]column_majortrue when the gathered buffer is stored column-major

◆ write_dH_components()

void ModuleIO::write_dH_components ( WriteDHParams & params,
const Exx_Info & exx_info )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dh_perI()

void ModuleIO::write_dh_perI ( WriteDHParams & params,
int ispin,
const std::string & rprefix,
const std::string & kprefix,
const std::string & label,
const std::string & term_name,
std::array< std::vector< hamilt::HContainer< double > * >, 3 > & g,
const std::vector< int > & atom_filter )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_sum()

bool ModuleIO::write_dH_sum ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_t()

bool ModuleIO::write_dH_t ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vh()

bool ModuleIO::write_dH_vh ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vh_pulay()

bool ModuleIO::write_dH_vh_pulay ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vl()

bool ModuleIO::write_dH_vl ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vnl()

bool ModuleIO::write_dH_vnl ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vxc()

bool ModuleIO::write_dH_vxc ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dH_vxc_pulay()

bool ModuleIO::write_dH_vxc_pulay ( WriteDHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dipole()

void ModuleIO::write_dipole ( const UnitCell & ucell,
const double * rho,
const ModulePW::PW_Basis * rhopw,
const int & istep,
const std::string & fn,
std::ofstream & ofs_running,
const int & precision = 13 )

Write aligned electronic dipoles; precision counts significant digits.

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

◆ write_dmk()

template<typename T>
void ModuleIO::write_dmk ( const std::vector< std::vector< T > > & dmk,
const K_Vectors & kv,
const int precision,
const std::vector< double > & efs,
const UnitCell * ucell,
const Parallel_Blkcyclic & pv,
const bool column_major,
const std::string & dmk_dir,
const int istep,
const int out_app_flag,
std::ofstream & ofs_running )

Writes the DMK data to a file.

The written matrix element is D(i,j) = sum_n w_n * conj(c_n,i) * c_n,j (complex conjugate on the first band index), matching the convention built by dm_from_psi; this is the complex conjugate of the physical one-body density matrix sum_n w_n c_n,i conj(c_n,j). The same line is also emitted as a '#' comment in the file header.

Template Parameters
TThe type of the DMK data.
Parameters
dmkA vector containing the DMK data. The first dimension is nspin*nk, and the second dimension is nlocal*nlocal. DMK is parallel in 2d-block type if using MPI.
k-vectorinformation.
precisionThe precision of the output of DMK.
efsA vector containing the Fermi energies, and should have the same size as the number of SPIN.
ucellA pointer to the UnitCell object.
pvThe Parallel_Blkcyclic object. The 2d-block parallel information of DMK.
column_majorWhether the local DMK blocks are stored column-major (genelpa/elpa/scalapack_gvx and the other column-major solvers). The file body is always row-major, so this selects the traversal order.
dmk_dirThe directory the DMK files are written into.
out_app_flagAppend-mode selector: 1 reuses the fixed filename across ionic steps and appends a new record per step in multi-step runs (MD or relax), 0 or 2 inserts the geometry-step index g{N}.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dmr()

void ModuleIO::write_dmr ( const std::vector< hamilt::HContainer< double > * > dmr,
const UnitCell * ucell,
const int precision,
const Parallel_Blkcyclic & paraV,
const int out_app_flag,
const int * iat2iwt,
const int nat,
const std::string & dmr_dir,
const int istep,
std::ofstream & ofs_running )

Writes DMR to a file.

Parameters
dmrThe 2D block parallel matrix representing the density matrix. The first dimension is the spin index.
ucellstands for unitcell
precisionControl the output precision
paraVThe parallel 2D object.
out_app_flagOutput mode: 0 = fixed filename, overwritten at every write; 1 = fixed filename, appended; 2 = per-step g{step} filename.
iat2iwtThe mapping from atom index to the first local orbital index.
natThe number of atoms.
dmr_dirThe directory the DM(R) files are written into.
istepThe ION step, starting from 0.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dmr_csr()

void ModuleIO::write_dmr_csr ( std::string & fname,
const UnitCell * ucell,
const int precision,
hamilt::HContainer< double > * dm_serial,
const int istep,
const int ispin,
const int nspin,
const bool append )

Writes HContainer to a csr file.

Parameters
fnameThe name of the file to write the CSR representation to.
ucellstands for unitcell
precisionControl the ouptut precision
dm_serialA pointer to the Hamiltonian container.
istepThe current step number.
appendWhether to append to the existing file. The first written step (istep <= 0) always truncates.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_dos_lcao() [1/3]

template void ModuleIO::write_dos_lcao ( const psi::Psi< double > * psi,
hamilt::Hamilt< double > * p_ham,
const Parallel_Orbitals & pv,
const UnitCell & ucell,
const K_Vectors & kv,
const int nbands,
const elecstate::Efermi & energy_fermi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const double & dos_edelta_ev,
const double & dos_scale,
const double & bcoeff,
const int out_dos,
const int out_app_flag,
const int precision,
const int istep,
const int nspin,
const int nlocal,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi,
const int bndpar,
const std::string & global_out_dir,
std::ofstream & ofs_running )

◆ write_dos_lcao() [2/3]

template void ModuleIO::write_dos_lcao ( const psi::Psi< std::complex< double > > * psi,
hamilt::Hamilt< std::complex< double > > * p_ham,
const Parallel_Orbitals & pv,
const UnitCell & ucell,
const K_Vectors & kv,
const int nbands,
const elecstate::Efermi & energy_fermi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const double & dos_edelta_ev,
const double & dos_scale,
const double & bcoeff,
const int out_dos,
const int out_app_flag,
const int precision,
const int istep,
const int nspin,
const int nlocal,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi,
const int bndpar,
const std::string & global_out_dir,
std::ofstream & ofs_running )

◆ write_dos_lcao() [3/3]

template<typename T>
void ModuleIO::write_dos_lcao ( const psi::Psi< T > * psi,
hamilt::Hamilt< T > * p_ham,
const Parallel_Orbitals & pv,
const UnitCell & ucell,
const K_Vectors & kv,
const int nbands,
const elecstate::Efermi & energy_fermi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const double & dos_edelta_ev,
const double & dos_scale,
const double & bcoeff,
const int out_dos,
const int out_app_flag,
const int precision,
const int istep,
const int nspin,
const int nlocal,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi,
const int bndpar,
const std::string & global_out_dir,
std::ofstream & ofs_running )

calculate density of states(DOS), partial density of states(PDOS), and mulliken charge for LCAO base

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

◆ write_dos_npy_header()

void ModuleIO::write_dos_npy_header ( std::ostream & out,
const std::string & fields,
std::size_t count )
inline

Write the NPY v1 header for a one-dimensional array of structured records.

Here is the caller graph for this function:

◆ write_dos_pw()

void ModuleIO::write_dos_pw ( const UnitCell & ucell,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const K_Vectors & kv,
const int nbands,
const int istep_in,
const elecstate::Efermi & energy_fermi,
const double & dos_edelta_ev,
const double & dos_scale,
const double & bcoeff,
const int nspin,
const int out_dos,
const bool dos_setemax,
const double dos_emax_ev,
const bool dos_setemin,
const double dos_emin_ev,
const bool two_fermi,
const int out_app_flag,
const int precision,
const int bndpar,
const std::string & global_out_dir,
std::ofstream & ofs_running )

calculate density of states(DOS) for PW base

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

◆ write_eband_terms()

template<typename TK, typename TR>
void ModuleIO::write_eband_terms ( const int nspin,
const int istep,
const int out_app_flag,
const double etot,
const int my_rank,
const int nbasis,
const Parallel_Orbitals * pv,
const psi::Psi< TK > & psi,
const UnitCell & ucell,
Structure_Factor & sf,
surchem & solvent,
const ModulePW::PW_Basis & rho_basis,
const ModulePW::PW_Basis & rhod_basis,
const ModuleBase::matrix & vloc,
const Charge & chg,
const K_Vectors & kv,
const ModuleBase::matrix & wg,
Grid_Driver & gd,
const std::vector< double > & orb_cutoff,
const LCAO_Orbitals & orb,
const TwoCenterBundle & two_center_bundle,
std::ofstream & ofs_running )

Write the band-decomposed energy of each Hamiltonian term (kinetic, local/nonlocal pp, Hartree) in KS orbital representation. The XC term is handled by write_Vxc from ctrl_scf_lcao.cpp instead.

Parameters
nspinNumber of spin components (1, 2 or 4)
istepZero-based ionic step index; written one-based in the header
out_app_flagOutput mode: 0 overwrites, 1 appends, 2 writes one numbered eband_*g{step}.txt file per written step
etotTotal energy of the current frame in Ry
my_rankWorld rank; only rank 0 writes the files
Template Parameters
TKK-point data type (double or std::complex<double>)
TRReal-space data type (double or std::complex<double>)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_eband_terms< double, double >()

template void ModuleIO::write_eband_terms< double, double > ( const int ,
const int ,
const int ,
const double ,
const int ,
const int ,
const Parallel_Orbitals * ,
const psi::Psi< double > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const ModuleBase::matrix & ,
Grid_Driver & ,
const std::vector< double > & ,
const LCAO_Orbitals & ,
const TwoCenterBundle & ,
std::ofstream &  )

◆ write_eband_terms< std::complex< double >, double >()

template void ModuleIO::write_eband_terms< std::complex< double >, double > ( const int ,
const int ,
const int ,
const double ,
const int ,
const int ,
const Parallel_Orbitals * ,
const psi::Psi< std::complex< double > > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const ModuleBase::matrix & ,
Grid_Driver & ,
const std::vector< double > & ,
const LCAO_Orbitals & ,
const TwoCenterBundle & ,
std::ofstream &  )
Here is the call graph for this function:

◆ write_eig_file()

void ModuleIO::write_eig_file ( const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const K_Vectors & kv,
const int nbands,
const int nspin,
const std::string & out_dir,
const int istep,
const int out_app_flag )

write eigenvalues and occupations to <out_dir>/eig_occ.txt

Parameters
nbandsnumber of bands requested by INPUT
nspinnumber of spin channels
out_dirdirectory the file is written into
istepzero-based ionic step index; printed one-based and used for the g{step} filename suffix in out_app_flag mode 2
out_app_flagoutput mode: 0 overwrites, 1 appends, 2 writes one numbered file per written step
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_eig_iter()

void ModuleIO::write_eig_iter ( const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const K_Vectors & kv,
const int nbands,
const int nspin )

print eigenvalues and occupations to the running log

Parameters
nbandsnumber of bands requested by INPUT
nspinnumber of spin channels
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_elecstat_pot()

void ModuleIO::write_elecstat_pot ( const int & bz,
const int & nbz,
const std::string & fn,
const int & istep,
ModulePW::PW_Basis * rho_basis,
const Charge *const chr,
const UnitCell * ucell_,
const double * v_eff_fixed,
const surchem & solvent,
const std::vector< double > * pcc_potential,
const std::vector< double > * solvent_potential,
const int precision,
const bool append,
std::ofstream & ofs_running )

write electric static potential to file

Parameters
bz
nbz
fn
istep
rho_basis
chr
ucell_
v_eff_fixed
solventfor solvation model
precisionoutput precision
appendappend a frame to an existing cube file (out_app_flag == 1)

Dipole correction

Add hartree potential and local pseudopot

Get the vacuum level of the system

Write down the electrostatic potential

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

◆ write_elf()

void ModuleIO::write_elf ( const std::string & out_dir,
const int & istep_in,
const int & nspin,
const double *const * rho,
const double *const * tau,
ModulePW::PW_Basis *const rho_basis,
const Parallel_Grid & pgrid,
const UnitCell * ucell_,
const int & precision,
const std::string & geom_block,
const bool two_fermi,
const bool append,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_h_vh()

void ModuleIO::write_h_vh ( WriteHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_h_vl()

void ModuleIO::write_h_vl ( WriteHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_h_vnl()

void ModuleIO::write_h_vnl ( WriteHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_h_vxc()

void ModuleIO::write_h_vxc ( WriteHParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_hcontainer_csr()

template<typename TR>
bool ModuleIO::write_hcontainer_csr ( const std::string & fname,
const UnitCell * ucell,
const int precision,
hamilt::HContainer< TR > * mat_serial,
const int istep,
const bool append,
const int ispin,
const int nspin,
const std::string & label,
const std::string & representation_note,
const double efermi_eV,
const bool has_efermi )

Write a single HContainer to CSR file with header.

Parameters
appendwhether to append to an existing file; the first written step (istep <= 0) truncates
efermi_eVthe Fermi energy in eV for this spin channel
has_efermiwhether to append the Fermi energy to the spin-index line
Returns
true only if the whole record was written and the stream closed cleanly; callers must not announce the file in the running log when this returns false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_hcontainer_csr_binary()

template<typename TR>
void ModuleIO::write_hcontainer_csr_binary ( const std::string & fname,
hamilt::HContainer< TR > * mat_serial,
const int istep,
const bool append )

Write one HContainer record in the native binary CSR format.

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

◆ write_head()

void ModuleIO::write_head ( std::ofstream & ofs_running,
const int & istep,
const int & iter,
const std::string & basisname )

write head for scf iteration

Parameters
ofs_runningoutput stream
istepthe ion step
iterthe scf iteration step
basisnamebasis set name
Here is the caller graph for this function:

◆ write_head_td()

void ModuleIO::write_head_td ( std::ofstream & ofs_running,
const int & istep,
const int & estep,
const int & iter,
const std::string & basisname )

write head for scf iteration

Parameters
ofs_runningoutput stream
istepthe ion step
estepthe electron step
iterthe scf iteration step
basisnamebasis set name
Here is the caller graph for this function:

◆ write_Hexxs_csr()

template<typename Tdata>
void ModuleIO::write_Hexxs_csr ( const std::string & file_name,
const UnitCell & ucell,
const std::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > & Hexxs )

write Hexxs in CSR format

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

◆ write_Hexxs_csr< double >()

template void ModuleIO::write_Hexxs_csr< double > ( const std::string & ,
const UnitCell & ,
const std::vector< std::map< int, std::map< TAC, RI::Tensor< double > > > > &  )

◆ write_Hexxs_csr< std::complex< double > >()

template void ModuleIO::write_Hexxs_csr< std::complex< double > > ( const std::string & ,
const UnitCell & ,
const std::vector< std::map< int, std::map< TAC, RI::Tensor< std::complex< double > > > > > &  )
Here is the call graph for this function:

◆ write_hsk()

template<typename T>
void ModuleIO::write_hsk ( const std::string & global_out_dir,
const int nspin,
const int nks,
const int nkstot,
const std::vector< int > & ik2iktot,
const std::vector< int > & isk,
hamilt::Hamilt< T > * p_hamilt,
const Parallel_Orbitals & pv,
const K_Vectors & kv,
const UnitCell * ucell,
const std::vector< double > & efs,
const bool gamma_only,
const int out_app_flag,
const int istep,
const int out_type,
const int precision,
const int nlocal,
const std::string & ks_solver,
const int drank,
std::ofstream & ofs_running )

Write H(k) and S(k) matrices for each k-point to disk.

Text output format is aligned with write_dmk: full metadata block (nspin, ik, k-point coords, weight, Fermi energy, basis count), followed by a UnitCell lattice block and then a flat matrix body (4 complex or 8 double values per line). Binary output continues to delegate to save_mat so its layout stays unchanged for callers that only consume binary files.

Parameters
kvK-point container (coords, weights, counts).
ucellPointer to the UnitCell for the lattice block; may be nullptr if the caller cannot provide one.
efsFermi energies — one per spin channel.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_hsr()

template<typename TR>
void ModuleIO::write_hsr ( const std::vector< hamilt::HContainer< TR > * > & hr_vec,
const hamilt::HContainer< TR > * sr,
const UnitCell * ucell,
const int out_type,
const int precision,
const Parallel_Blkcyclic & paraV,
const int out_app_flag,
const bool gamma_only,
const int * iat2iwt,
const int nat,
const int istep,
const std::string & global_out_dir,
const elecstate::Efermi & eferm,
std::ofstream & ofs_running )

Write H(R) and S(R) in CSR format, unified with write_dmr interface.

Parameters
out_app_flagoutput mode: 0 = fixed filename, overwritten; 1 = fixed filename, appended; 2 = per-step g{step} filename.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_matrix_notice() [1/2]

void ModuleIO::write_matrix_notice ( std::ofstream & ofs_running,
const std::string & property,
const int is,
const int nspin,
const std::string & file_name )
inline

Announce a written spin-resolved NAO-basis matrix file in the log.

Parameters
ofs_runningrunning log stream, open on the writing rank only.
propertyname of the matrix, e.g. "DM(R)".
isspin channel index.
nspinnumber of spin channels; the label is empty unless nspin == 2.
file_namepath of the written file.
Here is the call graph for this function:

◆ write_matrix_notice() [2/2]

void ModuleIO::write_matrix_notice ( std::ofstream & ofs_running,
const std::string & property,
const std::string & file_name )
inline

Announce a written NAO-basis matrix file in the running log.

Parameters
ofs_runningrunning log stream, open on the writing rank only.
propertyname of the matrix, e.g. "DM(k)" or "dS/dR (x component)".
file_namepath of the written file.
Here is the caller graph for this function:

◆ write_notice() [1/2]

void ModuleIO::write_notice ( std::ofstream & ofs_running,
const std::string & property,
const int is,
const int nspin,
const std::string & file_name )
inline

Announce a spin-resolved output file in the running log.

Parameters
ofs_runningrunning log stream, open on the writing rank only.
propertyname of the written quantity, e.g. "DOS".
isspin channel index.
nspinnumber of spin channels; the label is empty unless nspin == 2.
file_namepath of the written file.
Here is the call graph for this function:

◆ write_notice() [2/2]

void ModuleIO::write_notice ( std::ofstream & ofs_running,
const std::string & property,
const std::string & file_name )
inline

Announce a written output file in the running log.

All file-written notices share this single template so that the verb, the preposition and the spin label stay identical across writers: " Write <property><spin> to file: <file_name>".

Parameters
ofs_runningrunning log stream, open on the writing rank only.
propertyname of the written quantity, e.g. "Charge density".
file_namepath of the written file.
Here is the caller graph for this function:

◆ write_orb_energy()

void ModuleIO::write_orb_energy ( const K_Vectors & kv,
const int nspin0,
const int nbands,
const std::vector< std::vector< double > > & e_orb,
const std::string & out_name,
const std::string & header,
const std::string & global_out_dir,
const bool app = false )

Write orbital energies to file in LibRPA format.

Parameters
kvK-point list
nspin0Number of independent spin channels (1 or 2)
nbandsNumber of bands
e_orbOrbital energies per k-point
out_nameOutput file name relative to the output directory (e.g., "eband_vxc.txt", "eband_vl.txt")
headerComment block written before the numeric data; empty to omit
global_out_dirOutput directory
appAppend mode flag
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_orb_info()

void ModuleIO::write_orb_info ( const UnitCell * ucell,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_pdos_npy()

void ModuleIO::write_pdos_npy ( const UnitCell & cell,
const std::vector< ModuleBase::matrix > & pdos,
int nspin,
double emin,
double de,
const std::string & path )

Write one NPY array of atom- and orbital-projected spin spectra.

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

◆ write_pdos_text()

void ModuleIO::write_pdos_text ( const UnitCell & ucell,
const ModuleBase::matrix * pdos,
const int nspin,
const int nlocal,
const int npoints,
const double & emin,
const double & dos_edelta_ev,
const std::string & out_dir,
const int istep,
const int out_app_flag,
const int precision,
std::ofstream & ofs_running )

Write PDOS in plain text long-table format. File name: pdoss{spin}g{geom}.txt (g{geom} omitted when out_app_flag == 1) Columns: energy(eV) atom species l z m pdos(1/eV) For nspin=4, the two spinor components are summed.

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

◆ write_pot_init()

void ModuleIO::write_pot_init ( const UnitCell & ucell,
const Parallel_Grid & para_grid,
elecstate::ElecState * pelec,
const int istep,
const std::string & out_dir,
const Input_para & inp,
const bool two_fermi,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_proj_band_lcao()

template<typename TK>
void ModuleIO::write_proj_band_lcao ( const psi::Psi< TK > * psi,
const Parallel_Orbitals & pv,
const elecstate::ElecState * pelec,
const K_Vectors & kv,
const UnitCell & ucell,
hamilt::Hamilt< TK > * p_ham,
const int istep,
const int out_app_flag )
Parameters
ucellUnit cell
p_hamHamiltonian used to build the projection overlaps
istepZero-based ionic step index; written one-based
out_app_flagOutput mode: 2 writes pbands{spin}g{step}.xml
Here is the caller graph for this function:

◆ write_td_field()

void ModuleIO::write_td_field ( const elecstate::TDFieldManager & manager,
const std::string & output_dir )

Append the current electric-field samples to their output files. Times are written in fs with six decimal places, starting at physical time zero. Field components use scientific notation with twelve decimal places; columns are right-aligned.

Parameters
managerTime-dependent electric-field state for the current electronic step.
output_dirOutput directory including its trailing path separator.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_td_spin_pw()

void ModuleIO::write_td_spin_pw ( const std::string & directory,
int step,
double time_fs,
const std::vector< std::string > & orbitals,
const std::string & mag_partition,
const std::string & orbital_dir,
double onsite_radius,
bool calc_torque,
bool spin_current,
const pw::TDSpinResultPW & spin,
const pw::TDVelResultPW & current,
std::ostream & log )

Write globally reduced endpoint data on the designated output rank only.

Parameters
stepZero-based internal electronic step, written as step + 1.
time_fsPhysical time in fs, written with six decimal places; the initial state is at zero.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_td_vecpot()

void ModuleIO::write_td_vecpot ( const std::string & output_dir,
int electronic_step,
const ModuleBase::Vector3< double > & vector_pot )

Append one Cartesian vector-potential sample.

Parameters
output_dirOutput directory including its trailing path separator.
electronic_stepZero-based electronic-step index.
vector_potCartesian vector potential in atomic units.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_vdata_palgrid()

void ModuleIO::write_vdata_palgrid ( const Parallel_Grid & pgrid,
const double *const data,
const int is,
const int nspin,
const int iter,
const std::string & fn,
const double ef,
const UnitCell *const ucell,
const int precision,
const int out_fermi,
const bool two_fermi,
const bool reduce_all_pool,
const bool append,
std::ofstream & ofs_running,
const std::string & data_desc )

write volumetric data on the parallized grid into a .cube file

Parameters
appendappend a complete frame to an existing cube file instead of truncating it. Used by out_app_flag == 1, where successive ionic steps reuse a fixed filename and each written step contributes one frame.

output header for cube file

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

◆ write_Vxc()

template<typename TK, typename TR>
void ModuleIO::write_Vxc ( const int nspin,
const int istep,
const double etot,
const int nbasis,
const int drank,
const Parallel_Orbitals * pv,
const psi::Psi< TK > & psi,
const UnitCell & ucell,
Structure_Factor & sf,
surchem & solvent,
const ModulePW::PW_Basis & rho_basis,
const ModulePW::PW_Basis & rhod_basis,
const ModuleBase::matrix & vloc,
const Charge & chg,
const K_Vectors & kv,
const std::vector< double > & orb_cutoff,
const ModuleBase::matrix & wg,
Grid_Driver & gd,
const bool dft_plus_u,
const bool gamma_only,
const bool out_mat,
const int out_app_flag,
const std::string & mat_dir,
const std::string & global_out_dir,
const int out_ndigits,
const std::string & ks_solver,
bool cal_exx,
const Exx_Info & exx_info,
std::ofstream & ofs_running )

Write the Vxc matrix in KS orbital representation, useful for GW calculation including terms: local/semi-local XC, EXX, DFTU. The band-decomposed diagonal energies (eband_vxc.txt and, with EXX, eband_vxc_local.txt and eband_vxc_exx.txt) are always written to global_out_dir; the full MO-basis matrices (vxcmok*_nao.txt) are written to mat_dir only when out_mat is true. The MO-basis name keeps the "vxcmo" property so that it never collides with the NAO-basis "vxck*_nao.txt" produced by out_mat_vxck.

Parameters
istepZero-based ionic step index; written one-based in the header
out_app_flagOutput mode: 0 overwrites, 1 appends, 2 adds g{step}
etotTotal energy of the current frame in Ry
Template Parameters
TKK-point data type (double or std::complex<double>)
TRReal-space data type (double or std::complex<double>)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_Vxc< double, double >()

template void ModuleIO::write_Vxc< double, double > ( const int ,
const int ,
const double ,
const int ,
const int ,
const Parallel_Orbitals * ,
const psi::Psi< double > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const std::vector< double > & ,
const ModuleBase::matrix & ,
Grid_Driver & ,
const bool ,
const bool ,
const bool ,
const int ,
const std::string & ,
const std::string & ,
const int ,
const std::string & ,
bool ,
const Exx_Info & ,
std::ofstream &  )

◆ write_Vxc< std::complex< double >, double >()

template void ModuleIO::write_Vxc< std::complex< double >, double > ( const int ,
const int ,
const double ,
const int ,
const int ,
const Parallel_Orbitals * ,
const psi::Psi< std::complex< double > > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const std::vector< double > & ,
const ModuleBase::matrix & ,
Grid_Driver & ,
const bool ,
const bool ,
const bool ,
const int ,
const std::string & ,
const std::string & ,
const int ,
const std::string & ,
bool ,
const Exx_Info & ,
std::ofstream &  )
Here is the call graph for this function:

◆ write_Vxc_LIP()

template<typename FPTYPE>
void ModuleIO::write_Vxc_LIP ( int nspin,
const int istep,
const double etot,
int naos,
int drank,
const psi::Psi< std::complex< FPTYPE > > & psi_pw,
const UnitCell & ucell,
Structure_Factor & sf,
surchem & solvent,
const ModulePW::PW_Basis_K & wfc_basis,
const ModulePW::PW_Basis & rho_basis,
const ModulePW::PW_Basis & rhod_basis,
const ModuleBase::matrix & vloc,
const Charge & chg,
const K_Vectors & kv,
const ModuleBase::matrix & wg,
const bool gamma_only,
const std::string & global_out_dir,
const int out_ndigits,
const std::string & ks_solver,
bool cal_exx,
double hybrid_alpha )

Write the Vxc matrix in KS orbital representation for LIP (LCAO-in-PW), useful for GW calculation including terms: local/semi-local XC and EXX. The band-decomposed diagonal energies (eband_vxc.txt and, with EXX, eband_vxc_local.txt and eband_vxc_exx.txt) are written to global_out_dir.

Parameters
istepZero-based ionic step index; written one-based in the header
etotTotal energy of the current frame in Ry
Template Parameters
FPTYPEFloating point type (float or double)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_Vxc_LIP< double >()

template void ModuleIO::write_Vxc_LIP< double > ( int ,
const int ,
const double ,
int ,
int ,
const psi::Psi< std::complex< double > > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis_K & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const ModuleBase::matrix & ,
const bool ,
const std::string & ,
const int ,
const std::string & ,
bool ,
double  )

◆ write_Vxc_LIP< float >()

template void ModuleIO::write_Vxc_LIP< float > ( int ,
const int ,
const double ,
int ,
int ,
const psi::Psi< std::complex< float > > & ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis_K & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const ModuleBase::matrix & ,
const bool ,
const std::string & ,
const int ,
const std::string & ,
bool ,
double  )

◆ write_Vxc_R()

template<typename TK, typename TR>
void ModuleIO::write_Vxc_R ( const int nspin,
const Parallel_Orbitals * pv,
const UnitCell & ucell,
Structure_Factor & sf,
surchem & solvent,
const ModulePW::PW_Basis & rho_basis,
const ModulePW::PW_Basis & rhod_basis,
const ModuleBase::matrix & vloc,
const Charge & chg,
const K_Vectors & kv,
const std::vector< double > & orb_cutoff,
Grid_Driver & gd,
const std::string & global_out_dir,
bool cal_exx,
double hybrid_alpha,
bool real_number,
const int istep,
const double sparse_thr,
const int precision,
std::ofstream & ofs_running )

Write the Vxc matrix in real space (R), useful for GW calculation including terms: local/semi-local XC, EXX, DFTU The files are named vxcrs{spin}_nao.csr as a final-step snapshot; the spin index is one-based.

Template Parameters
TKK-point data type (double or std::complex<double>)
TRReal-space data type (double or std::complex<double>)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_Vxc_R< double, double >()

template void ModuleIO::write_Vxc_R< double, double > ( const int ,
const Parallel_Orbitals * ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const std::vector< double > & ,
Grid_Driver & ,
const std::string & ,
bool ,
double ,
bool ,
const int ,
const double ,
const int ,
std::ofstream &  )

◆ write_Vxc_R< std::complex< double >, double >()

template void ModuleIO::write_Vxc_R< std::complex< double >, double > ( const int ,
const Parallel_Orbitals * ,
const UnitCell & ,
Structure_Factor & ,
surchem & ,
const ModulePW::PW_Basis & ,
const ModulePW::PW_Basis & ,
const ModuleBase::matrix & ,
const Charge & ,
const K_Vectors & ,
const std::vector< double > & ,
Grid_Driver & ,
const std::string & ,
bool ,
double ,
bool ,
const int ,
const double ,
const int ,
std::ofstream &  )
Here is the call graph for this function:

◆ write_wfc_nao()

template<typename T>
void ModuleIO::write_wfc_nao ( const int out_type,
const int out_app_flag,
const psi::Psi< T > & psi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const std::vector< ModuleBase::Vector3< double > > & kvec_c,
const std::vector< int > & ik2iktot,
const int nkstot,
const Parallel_Orbitals & pv,
const int nspin,
std::ofstream & ofs_running,
const int istep = -1 )

Writes the wavefunction coefficients for the LCAO method to a file. Will loop all k-points by psi.get_nk(). The nbands are determined by ekb.nc. The nlocal is determined by psi.get_nbasis() if not compiled with MPI, otherwise it is determined by pv->desc[2].

Parameters
out_typeThe output file type. 1 for text, 2 for binary.
psiThe Psi object containing the wavefunction coefficients.
ekbThe matrix of Kohn-Sham eigenvalues.
wgThe matrix of Kohn-Sham eigenvectors.
kvec_cThe vector of k-points in Cartesian coordinates.
pvThe Parallel_Orbitals object containing additional information.
istepThe current step number. if < 0, the step number is not included in the file name.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_wfc_nao< double >()

template void ModuleIO::write_wfc_nao< double > ( const int out_type,
const int out_app_flag,
const psi::Psi< double > & psi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const std::vector< ModuleBase::Vector3< double > > & kvec_c,
const std::vector< int > & ik2iktot,
const int nkstot,
const Parallel_Orbitals & pv,
const int nspin,
std::ofstream & ofs_running,
const int istep )

◆ write_wfc_nao< std::complex< double > >()

template void ModuleIO::write_wfc_nao< std::complex< double > > ( const int out_type,
const int out_app_flag,
const psi::Psi< std::complex< double > > & psi,
const ModuleBase::matrix & ekb,
const ModuleBase::matrix & wg,
const std::vector< ModuleBase::Vector3< double > > & kvec_c,
const std::vector< int > & ik2iktot,
const int nkstot,
const Parallel_Orbitals & pv,
const int nspin,
std::ofstream & ofs_running,
const int istep )
Here is the call graph for this function:

◆ write_wfc_pw()

void ModuleIO::write_wfc_pw ( const int istep,
const int iter,
const int append_step,
const int kpar,
const int my_pool,
const int my_rank,
const int nbands,
const int nspin,
const int npol,
const int rank_in_pool,
const int nproc_in_pool,
const int out_wfc_pw,
const int out_app_flag,
const double & ecutwfc,
const std::string & global_out_dir,
const psi::Psi< std::complex< double > > & psi,
const K_Vectors & kv,
const ModulePW::PW_Basis_K * wfcpw,
std::ofstream & ofs_running )
Here is the call graph for this function:
Here is the caller graph for this function: