ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
This class has two functions: restart psi from the previous calculation, and write psi to the disk. More...
Classes | |
class | AngularMomentumCalculator |
class | Cal_ldos |
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 | CifParser |
class | csrFileReader |
Class to read CSR file. More... | |
class | FileReader |
A base class of file reader. More... | |
class | Input_Item |
class | Output_DMK |
class | Output_Mulliken |
the output interface to write the Mulliken population charges More... | |
class | Output_Sk |
class | ReadInput |
class | SparseMatrix |
Sparse matrix class designed mainly for csr format input and output. More... | |
class | Write_MLKEDF_Descriptors |
Typedefs | |
using | TC = std::array< int, 3 > |
using | TAC = std::pair< int, TC > |
template<typename T > | |
using | Real = typename GetTypeReal< T >::type |
Functions | |
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) |
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) |
void | cal_ldos_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double > > &psi, const Parallel_Grid &pgrid, const UnitCell &ucell) |
void | stm_mode_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double > > &psi, const Parallel_Grid &pgrid, const UnitCell &ucell) |
void | ldos_mode_pw (const elecstate::ElecStatePW< std::complex< double > > *pelec, const psi::Psi< std::complex< double > > &psi, const Parallel_Grid &pgrid, const UnitCell &ucell) |
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) |
void | cal_pdos (const psi::Psi< double > *psi, hamilt::Hamilt< double > *p_ham, const Parallel_Orbitals &pv, const UnitCell &ucell, 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) |
void | print_tdos_gamma (const ModuleBase::matrix *pdos, const int nlocal, const int npoints, const double &emin, const double &dos_edelta_ev) |
void | print_pdos_gamma (const UnitCell &ucell, const ModuleBase::matrix *pdos, const int nlocal, const int npoints, const double &emin, const double &dos_edelta_ev) |
void | cal_pdos (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 nspin0, const int nbands, const ModuleBase::matrix &ekb, const double &emax, const double &emin, const double &dos_edelta_ev, const double &bcoeff) |
void | print_tdos_multik (const ModuleBase::matrix *pdos, const int nlocal, const int npoints, const double &emin, const double &dos_edelta_ev) |
void | print_pdos_multik (const UnitCell &ucell, const ModuleBase::matrix *pdos, const int nlocal, const int npoints, const double &emin, const double &dos_edelta_ev) |
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). | |
template<typename TK , typename TR > | |
void | ctrl_output_fp (UnitCell &ucell, elecstate::ElecStateLCAO< TK > *pelec, const int istep) |
template<typename TK , typename TR > | |
void | ctrl_output_lcao (UnitCell &ucell, K_Vectors &kv, elecstate::ElecStateLCAO< TK > *pelec, Parallel_Orbitals &pv, Grid_Driver &gd, psi::Psi< TK > *psi, hamilt::HamiltLCAO< TK, TR > *p_hamilt, TwoCenterBundle &two_center_bundle, Gint_k &gk, LCAO_Orbitals &orb, const ModulePW::PW_Basis_K *pw_wfc, const ModulePW::PW_Basis *pw_rho, Grid_Technique >, const ModulePW::PW_Basis_Big *pw_big, const Structure_Factor &sf, rdmft::RDMFT< TK, TR > &rdmft_solver, LCAO_Deepks< TK > &ld, const int istep) |
bool | read_vdata_palgrid (const Parallel_Grid &pgrid, const int my_rank, std::ofstream &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=11, const int out_fermi=1, const bool reduce_all_pool=false) |
write volumetric data on the parallized grid into a .cube file | |
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 int ndata_line=6) |
write a cube file | |
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. | |
void | write_dipole (const UnitCell &ucell, const double *rho_save, const ModulePW::PW_Basis *rhopw, const int &is, const int &istep, const std::string &fn, const int &precision=11) |
double | prepare (const UnitCell &cell, int &dir) |
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 bool out_app_flag, const bool gamma_only, const int istep) |
template<typename Device > | |
void | get_pchg_pw (const std::vector< int > &out_pchg, const int nbands, const int nspin, const int nxyz, const int chr_ngmc, UnitCell *ucell, const psi::Psi< std::complex< double >, Device > *kspw_psi, const ModulePW::PW_Basis *pw_rhod, const ModulePW::PW_Basis_K *pw_wfc, const Device *ctx, const Parallel_Grid &pgrid, const std::string &global_out_dir, const bool if_separate_k, const K_Vectors &kv, const int kpar, const int my_pool, const Charge *chr) |
template<typename Device > | |
void | get_wf_pw (const std::vector< int > &out_wfc_norm, const std::vector< int > &out_wfc_re_im, const int nbands, const int nspin, const int nxyz, UnitCell *ucell, const psi::Psi< std::complex< double >, Device > *kspw_psi, const ModulePW::PW_Basis_K *pw_wfc, const Device *ctx, const Parallel_Grid &pgrid, const std::string &global_out_dir, const K_Vectors &kv, const int kpar, const int my_pool) |
std::string | dmk_gen_fname (const bool gamma_only, const int ispin, const int ik) |
Generates the filename for the DMK file based on the given parameters. | |
void | dmk_write_ucell (std::ofstream &ofs, const UnitCell *ucell) |
Writes the unit cell information to a DMK file. | |
void | dmk_read_ucell (std::ifstream &ifs) |
Reads the unit cell information lines in a DMK file. | |
void | dmk_readData (std::ifstream &ifs, double &data) |
Read one double from a file. | |
void | 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 Parallel_2D &pv, const std::string &dmk_dir, 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 int precision, const std::vector< double > &efs, const UnitCell *ucell, const Parallel_2D &pv) |
Writes the DMK data to a file. | |
void | read_mat_npz (const Parallel_Orbitals *paraV, const UnitCell &ucell, std::string &zipname, hamilt::HContainer< double > &hR) |
void | output_mat_npz (const UnitCell &ucell, std::string &zipname, const hamilt::HContainer< double > &hR) |
void | nscf_band (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) |
calculate the band structure | |
void | nscf_fermi_surface (const std::string &out_band_dir, const int &nband, const double &ef, const K_Vectors &kv, const UnitCell &ucell, const ModuleBase::matrix &ekb) |
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) |
void | output_convergence_after_scf (const bool &convergence, double &energy, std::ofstream &ofs_running=GlobalV::ofs_running) |
output if is convergence and energy after scf | |
void | output_after_relax (bool conv_ion, bool conv_esolver, std::ofstream &ofs_running=GlobalV::ofs_running) |
output after relaxation | |
void | output_efermi (const bool &convergence, double &efermi, std::ofstream &ofs_running=GlobalV::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=GlobalV::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_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 | |
template<> | |
void | output_mat_sparse (const bool &out_mat_hsR, const bool &out_mat_dh, const bool &out_mat_ds, const bool &out_mat_t, const bool &out_mat_r, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, Gint_k &gint_k, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< double > *p_ham) |
template<> | |
void | output_mat_sparse (const bool &out_mat_hsR, const bool &out_mat_dh, const bool &out_mat_ds, const bool &out_mat_t, const bool &out_mat_r, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, Gint_k &gint_k, 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) |
template<typename T > | |
void | output_mat_sparse (const bool &out_mat_hsR, const bool &out_mat_dh, const bool &out_mat_ds, const bool &out_mat_t, const bool &out_mat_r, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, Gint_k &gint_k, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< T > *p_ham) |
the output interface to write the sparse matrix of H, S, T, and r | |
template<typename TK > | |
void | cal_mag (Parallel_Orbitals *pv, hamilt::Hamilt< TK > *p_ham, K_Vectors &kv, elecstate::ElecState *pelec, const TwoCenterBundle &two_center_bundle, const LCAO_Orbitals &orb, UnitCell &ucell, const Grid_Driver &gd, const int istep, const bool print) |
void | parse_args (int argc, char **argv) |
This function reture the version information when using command "abacus --version", "abacus -v" or "abacus -V". Otherwise, it does nothing. | |
void | setup_parameters (UnitCell &ucell, K_Vectors &kv) |
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) |
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 | |
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::ifstream &ifs, std::vector< std::string > &output, const std::string &delimiters) |
std::string | nofound_str (std::vector< std::string > init_chgs, const std::string &str) |
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 | |
void | read_wfc_nao_one_data (std::ifstream &ifs, double &data) |
Reads a single data value from an input file stream. | |
void | read_wfc_nao_one_data (std::ifstream &ifs, std::complex< double > &data) |
Reads a single complex data value from an input file stream. | |
template<typename T > | |
bool | read_wfc_nao (const std::string &global_readin_dir, const Parallel_Orbitals &ParaV, psi::Psi< T > &psid, elecstate::ElecState *const pelec, const std::vector< int > &ik2iktot, const int nkstot, const int nspin, const int skip_band=0, const int nstep=-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 | |
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 > | |
void | write_Hexxs_csr (const std::string &file_name, const UnitCell &ucell, const std::map< int, std::map< TAC, RI::Tensor< Tdata > > > &Hexxs) |
write Hexxs in CSR 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::vector< std::map< int, std::map< TAC, RI::Tensor< Tdata > > > > &Hexxs, const UnitCell &ucell) |
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) |
bool | read_rhog (const std::string &filename, const ModulePW::PW_Basis *pw_rhod, std::complex< double > **rhog) |
bool | write_rhog (const std::string &fchg, const bool gamma_only, const ModulePW::PW_Basis *pw_rho, const int nspin, const ModuleBase::Matrix3 >, std::complex< double > **rhog, const int ipool, const int irank, const int nrank) |
template<typename T > | |
void | output_single_R (std::ofstream &ofs, const std::map< size_t, std::map< size_t, T > > &XR, const double &sparse_threshold, const bool &binary, const Parallel_Orbitals &pv, const bool &reduce=true) |
std::vector< double > | read_k (std::string filename, int ik) |
std::string | dmr_gen_fname (const int out_type, const int ispin, const bool append, const int istep) |
void | write_dmr_csr (std::string &fname, hamilt::HContainer< double > *dm_serial, const int istep) |
void | write_dmr (const std::vector< hamilt::HContainer< double > * > dmr, const Parallel_2D ¶V, const bool append, const int *iat2iwt, const int nat, const int istep) |
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 bool out_app_flag, const int istep, 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 bool out_app_flag, const int istep, 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 bool out_app_flag, const int istep, 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 elecstate::efermi &energy_fermi, const double &dos_edelta_ev, const double &dos_scale, const double &bcoeff, std::ofstream &ofs_running) |
calculate density of states(DOS) for PW base | |
template<typename TK , typename TR > | |
void | write_eband_terms (const int nspin, 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, Gint_Gamma &gint_gamma, Gint_k &gint_k, const K_Vectors &kv, const ModuleBase::matrix &wg, Grid_Driver &gd, const std::vector< double > &orb_cutoff, const TwoCenterBundle &two_center_bundle) |
void | write_eig_iter (const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors &kv) |
void | write_eig_file (const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors &kv) |
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_effective_fixed, const surchem &solvent) |
write electric static potential to file | |
void | write_elf (const int &bz, const int &nbz, const std::string &out_dir, const int &istep, const int &nspin, const double *const *rho, const double *const *tau, ModulePW::PW_Basis *rho_basis, const Parallel_Grid &pgrid, const UnitCell *ucell_, const int &precision) |
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 bool gamma_only, const bool out_app_flag, const int istep, 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_2D &pv, const int drank, const bool reduce=true) |
save a square matrix, such as H(k) and S(k) | |
void | output_HSR (const UnitCell &ucell, const int &istep, const ModuleBase::matrix &v_eff, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const Grid_Driver &grid, const K_Vectors &kv, hamilt::Hamilt< std::complex< double > > *p_ham, const std::string &SR_filename="srs1_nao.csr", const std::string &HR_filename_up="hrs1_nao.csr", const std::string HR_filename_down="hrs2_nao.csr", const bool &binary=false, const double &sparse_threshold=1e-10) |
void | output_dHR (const int &istep, const ModuleBase::matrix &v_eff, Gint_k &gint_k, 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 K_Vectors &kv, const bool &binary=false, const double &sparse_threshold=1e-10) |
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 K_Vectors &kv, const bool &binary=false, const double &sparse_thr=1e-10) |
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="trs1_nao.csr", const bool &binary=false, const double &sparse_threshold=1e-10) |
void | output_SR (Parallel_Orbitals &pv, const Grid_Driver &grid, hamilt::Hamilt< std::complex< double > > *p_ham, const std::string &SR_filename="srs1_nao.csr", const bool &binary=false, const double &sparse_threshold=1e-10) |
void | save_HSR_sparse (const int &istep, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const double &sparse_thr, const bool &binary, const std::string &SR_filename, const std::string &HR_filename_up, const std::string &HR_filename_down) |
void | save_dH_sparse (const int &istep, const Parallel_Orbitals &pv, LCAO_HS_Arrays &HS_Arrays, const double &sparse_thr, const bool &binary, const std::string &fileflag="h") |
template<typename Tdata > | |
void | save_sparse (const std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, Tdata > > > &smat, const std::set< Abfs::Vector3_Order< int > > &all_R_coor, const double &sparse_thr, const bool &binary, const std::string &filename, const Parallel_Orbitals &pv, const std::string &label, const int &istep=-1, const bool &reduce=true) |
void | write_orb_info (const UnitCell *ucell) |
void | print_PAOs (const UnitCell &ucell) |
print chi (PAO) in pseudopotential file | |
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) |
void | set_para2d_MO (const Parallel_Orbitals &pv, const int nbands, Parallel_2D &p2d) |
template<typename T > | |
std::vector< T > | cVc (T *V, T *c, const int nbasis, const int nbands, const Parallel_Orbitals &pv, const Parallel_2D &p2d) |
double | get_real (const std::complex< double > &c) |
double | get_real (const double &d) |
template<typename T > | |
double | all_band_energy (const int ik, const std::vector< T > &mat_mo, const Parallel_2D &p2d, const ModuleBase::matrix &wg) |
template<typename T > | |
std::vector< double > | orbital_energy (const int ik, const int nbands, const std::vector< T > &mat_mo, const Parallel_2D &p2d) |
template<typename T > | |
void | set_gint_pointer (Gint_Gamma &gint_gamma, Gint_k &gint_k, typename TGint< T >::type *&gint) |
template<> | |
void | set_gint_pointer< double > (Gint_Gamma &gint_gamma, Gint_k &gint_k, typename TGint< double >::type *&gint) |
template<> | |
void | set_gint_pointer< std::complex< double > > (Gint_Gamma &gint_gamma, Gint_k &gint_k, typename TGint< std::complex< double > >::type *&gint) |
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 &term, const std::string &label, const bool app=false) |
template<typename TK , typename TR > | |
void | write_Vxc (const int nspin, 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, Gint_Gamma &gint_gamma, Gint_k &gint_k, const K_Vectors &kv, const std::vector< double > &orb_cutoff, const ModuleBase::matrix &wg, Grid_Driver &gd) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC, EXX, DFTU | |
template<typename FPTYPE > | |
FPTYPE | get_real (const std::complex< FPTYPE > &c) |
template<typename FPTYPE > | |
FPTYPE | get_real (const FPTYPE &d) |
template<typename T > | |
std::vector< T > | cVc (T *const V, T *const c, int nbasis, int nbands) |
template<typename FPTYPE > | |
std::vector< std::complex< FPTYPE > > | psi_Hpsi (std::complex< FPTYPE > *const psi, std::complex< FPTYPE > *const hpsi, const int nbasis, const int nbands) |
template<typename FPTYPE > | |
std::vector< FPTYPE > | orbital_energy (const int ik, const int nbands, const std::vector< std::complex< FPTYPE > > &mat_mo) |
template<typename FPTYPE > | |
FPTYPE | all_band_energy (const int ik, const int nbands, const std::vector< std::complex< FPTYPE > > &mat_mo, const ModuleBase::matrix &wg) |
template<typename FPTYPE > | |
FPTYPE | all_band_energy (const int ik, const std::vector< FPTYPE > &orbital_energy, const ModuleBase::matrix &wg) |
template<typename FPTYPE > | |
void | write_Vxc (int nspin, 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) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC and EXX | |
template<> | |
void | set_gint_pointer< double > (Gint_Gamma &gint_gamma, Gint_k &gint_k, typename TGint< double >::type *&gint) |
template<> | |
void | set_gint_pointer< std::complex< double > > (Gint_Gamma &gint_gamma, Gint_k &gint_k, typename TGint< std::complex< double > >::type *&gint) |
template<typename TR > | |
std::set< Abfs::Vector3_Order< int > > | get_R_range (const hamilt::HContainer< TR > &hR) |
template<typename TR > | |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, TR > > > | cal_HR_sparse (const hamilt::HContainer< TR > &hR, const int current_spin, const double sparse_thr) |
template<> | |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, double > > > | cal_HR_sparse (const hamilt::HContainer< double > &hR, const int current_spin, const double sparse_thr) |
template<> | |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, std::complex< double > > > > | cal_HR_sparse (const hamilt::HContainer< std::complex< double > > &hR, const int current_spin, const double sparse_thr) |
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, Gint_Gamma &gint_gamma, Gint_k &gint_k, const K_Vectors &kv, const std::vector< double > &orb_cutoff, Grid_Driver &gd, const double sparse_thr=1e-10) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC, EXX, DFTU | |
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) |
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) |
template<typename T > | |
void | write_wfc_nao (const int out_type, const bool 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, const int istep) |
template void | write_wfc_nao< double > (const int out_type, const bool 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, const int istep) |
template void | write_wfc_nao< std::complex< double > > (const int out_type, const bool 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, const int istep) |
void | write_wfc_pw (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 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) |
This class has two functions: restart psi from the previous calculation, and write psi to the disk.
calculate the <phi_i|Lx/Ly/Lz|phi_j> matrix elements, in which the Lx/Ly/Lz are the angular momentum operators, |phi_i> and |phi_j> are the numerical atomic orbitals (NAOs).
Calculate the <phi_i|Lx/Ly/Lz|phi_j> with ladder operator L+ and L-.
The relation between Lx, Ly and L+, L- are:
Lx = (L+ + L-) / 2 Ly = (L+ - L-) / 2i
With L+, the spherical harmonic function Ylm (denoted as |l, m> in the following) can be raised:
L+|l, m> = sqrt((l-m)(l+m+1))|l, m+1>
Likely, with L-, the spherical harmonic function Ylm can be lowered:
L-|l, m> = sqrt((l+m)(l-m+1))|l, m-1>
Therefore the Lx matrix element can be calculated as:
<l, m|Lx|l, m'> = sqrt((l-m)(l+m+1)) * delta(m, m'+1) / 2 + sqrt((l+m)(l-m+1)) * delta(m, m'-1) / 2
The Ly matrix element can be calculated as:
<l, m|Ly|l, m'> = sqrt((l-m)(l+m+1)) * delta(m, m'+1) / 2i - sqrt((l+m)(l-m+1)) * delta(m, m'-1) / 2i
The Lz matrix element can be calculated as:
<l, m|Lz|l, m'> = m * delta(m, m')
However, things will change when there are more than one centers.
0. The calculation of matrix elements involves the two-center-integral calculation, this is supported by ABACUS built-in class TwoCenterIntegrator. see: source/source_basis/module_nao/two_center_integrator.h.
I/O free function of rho(G) in binary format Author: YuLiu98, Kirk0830
The designed foramt of the binary file is kept similar to the one in QuantumESPRESSO Modules/io_base.f90, function write_rhog (non-HDF5):
/3/ /gammaonly/ /ngm_g/ /nspin/ /3/ ! bool, int, int. ngm_g is the global, total number of G-vectors /9/ /b11/ /b12/ /b13/ /b21/ /b22/ /b23/ /b31/ /b32/ /b33/ /9/ ! 9 real numbers, the three lattice vectors /ngm_g*3/ /miller(1,1)/ /miller(1,2)/ /miller(1,3)/ /miller(2,1)/ /miller(2,2)/ /miller(2,3)/ ... /miller(ngm_g,1)/ /miller(ngm_g,2)/ /miller(ngm_g,3)/ /ngm_g*3/ ! ngm_g*3 integers, the G-vectors in Miller indices /ngm_g/ /rhog(1)/ /rhog(2)/ /rhog(3)/ ... /ngm_g/ ! ngm_g complex numbers, the rho(G) values !/ngm_g/ ! ngm_g complex numbers, the rho(G) values for the second spin component !/rhog(1)/ /rhog(2)/ /rhog(3)/ ... !/ngm_g/ ! ngm_g complex numbers, the rho(G) values for the second spin component
There are some aspects needed to ensure:
using ModuleIO::Real = typedef typename GetTypeReal<T>::type |
typedef std::pair< int, std::array< int, 3 > > ModuleIO::TAC |
using ModuleIO::TC = typedef std::array<int, 3> |
FPTYPE ModuleIO::all_band_energy | ( | const int | ik, |
const int | nbands, | ||
const std::vector< std::complex< FPTYPE > > & | mat_mo, | ||
const ModuleBase::matrix & | wg | ||
) |
FPTYPE ModuleIO::all_band_energy | ( | const int | ik, |
const std::vector< FPTYPE > & | orbital_energy, | ||
const ModuleBase::matrix & | wg | ||
) |
double ModuleIO::all_band_energy | ( | const int | ik, |
const std::vector< T > & | mat_mo, | ||
const Parallel_2D & | p2d, | ||
const ModuleBase::matrix & | wg | ||
) |
bool ModuleIO::assume_as_boolean | ( | const std::string & | val | ) |
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 | ||
) |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, double > > > ModuleIO::cal_HR_sparse | ( | const hamilt::HContainer< double > & | hR, |
const int | current_spin, | ||
const double | sparse_thr | ||
) |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, std::complex< double > > > > ModuleIO::cal_HR_sparse | ( | const hamilt::HContainer< std::complex< double > > & | hR, |
const int | current_spin, | ||
const double | sparse_thr | ||
) |
std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, TR > > > ModuleIO::cal_HR_sparse | ( | const hamilt::HContainer< TR > & | hR, |
const int | current_spin, | ||
const double | sparse_thr | ||
) |
void ModuleIO::cal_ldos_pw | ( | const elecstate::ElecStatePW< std::complex< double > > * | pelec, |
const psi::Psi< std::complex< double > > & | psi, | ||
const Parallel_Grid & | pgrid, | ||
const UnitCell & | ucell | ||
) |
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).
calculator | the std::unique_ptr<TwoCenterIntegrator> instance |
it | atomtype index of the first atom |
ia | atomic index of the first atom within the atomtype |
il | angular momentum index of the first atom |
iz | zeta function index of the first atom |
mi | magnetic quantum number of the first atom |
jt | atomtype index of the second atom |
ja | atomic index of the second atom within the atomtype |
jl | angular momentum index of the second atom |
jz | zeta function index of the second atom |
mj | magnetic quantum number of the second atom |
vR | the vector from the first atom to the second atom |
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).
calculator | the std::unique_ptr<TwoCenterIntegrator> instance |
it | atomtype index of the first atom |
ia | atomic index of the first atom within the atomtype |
il | angular momentum index of the first atom |
iz | zeta function index of the first atom |
mi | magnetic quantum number of the first atom |
jt | atomtype index of the second atom |
ja | atomic index of the second atom within the atomtype |
jl | angular momentum index of the second atom |
jz | zeta function index of the second atom |
mj | magnetic quantum number of the second atom |
vR | the vector from the first atom to the second atom |
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).
calculator | the std::unique_ptr<TwoCenterIntegrator> instance |
it | atomtype index of the first atom |
ia | atomic index of the first atom within the atomtype |
il | angular momentum index of the first atom |
iz | zeta function index of the first atom |
mi | magnetic quantum number of the first atom |
jt | atomtype index of the second atom |
ja | atomic index of the second atom within the atomtype |
jl | angular momentum index of the second atom |
jz | zeta function index of the second atom |
mj | magnetic quantum number of the second atom |
vR | the vector from the first atom to the second atom |
void ModuleIO::cal_mag | ( | Parallel_Orbitals * | pv, |
hamilt::Hamilt< TK > * | p_ham, | ||
K_Vectors & | kv, | ||
elecstate::ElecState * | pelec, | ||
const TwoCenterBundle & | two_center_bundle, | ||
const LCAO_Orbitals & | orb, | ||
UnitCell & | ucell, | ||
const Grid_Driver & | gd, | ||
const int | istep, | ||
const bool | |||
) |
used in updating mag info in STRU file
write the Orbital file
write mulliken.txt
write atomic mag info in running log file
void ModuleIO::cal_pdos | ( | const psi::Psi< double > * | psi, |
hamilt::Hamilt< double > * | p_ham, | ||
const Parallel_Orbitals & | pv, | ||
const UnitCell & | ucell, | ||
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 | ||
) |
void ModuleIO::cal_pdos | ( | 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 | nspin0, | ||
const int | nbands, | ||
const ModuleBase::matrix & | ekb, | ||
const double & | emax, | ||
const double & | emin, | ||
const double & | dos_edelta_ev, | ||
const double & | bcoeff | ||
) |
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 | ||
) |
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::vector< 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.
void ModuleIO::ctrl_output_fp | ( | UnitCell & | ucell, |
elecstate::ElecStateLCAO< TK > * | pelec, | ||
const int | istep | ||
) |
void ModuleIO::ctrl_output_lcao | ( | UnitCell & | ucell, |
K_Vectors & | kv, | ||
elecstate::ElecStateLCAO< TK > * | pelec, | ||
Parallel_Orbitals & | pv, | ||
Grid_Driver & | gd, | ||
psi::Psi< TK > * | psi, | ||
hamilt::HamiltLCAO< TK, TR > * | p_hamilt, | ||
TwoCenterBundle & | two_center_bundle, | ||
Gint_k & | gk, | ||
LCAO_Orbitals & | orb, | ||
const ModulePW::PW_Basis_K * | pw_wfc, | ||
const ModulePW::PW_Basis * | pw_rho, | ||
Grid_Technique & | gt, | ||
const ModulePW::PW_Basis_Big * | pw_big, | ||
const Structure_Factor & | sf, | ||
rdmft::RDMFT< TK, TR > & | rdmft_solver, | ||
LCAO_Deepks< TK > & | ld, | ||
const int | istep | ||
) |
1) Output density matrix DM(R)
2) Output density matrix DM(k)
5) Output DeePKS information
6) Output <phi_i|O|phi_j> matrices, where O can be chosen as H, S, dH, dS, T, r. The format is CSR format.
7) Output kinetic matrix
8) Output expectation of angular momentum operator
9) Output Mulliken charge
10) Output atomic magnetization by using 'spin_constraint'
11) Output Berry phase
12) Wannier90 interface in LCAO basis
18) 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
Output quasi orbitals
std::vector< T > ModuleIO::cVc | ( | T *const | V, |
T *const | c, | ||
int | nbasis, | ||
int | nbands | ||
) |
|
inline |
std::string ModuleIO::dmk_gen_fname | ( | const bool | gamma_only, |
const int | ispin, | ||
const int | ik | ||
) |
Generates the filename for the DMK file based on the given parameters.
gamma_only | Whether the calculation is gamma_only. |
ispin | The index of the spin component. |
ik | The index of the k-point. |
void ModuleIO::dmk_read_ucell | ( | std::ifstream & | ifs | ) |
Reads the unit cell information lines in a DMK file.
ifs | The input file stream. |
void ModuleIO::dmk_readData | ( | std::ifstream & | ifs, |
double & | data | ||
) |
Read one double from a file.
void ModuleIO::dmk_readData | ( | std::ifstream & | ifs, |
std::complex< double > & | data | ||
) |
Read one complex double from a file.
void ModuleIO::dmk_write_ucell | ( | std::ofstream & | ofs, |
const UnitCell * | ucell | ||
) |
Writes the unit cell information to a DMK file.
ofs | The output file stream. |
ucell | A pointer to the UnitCell object. |
std::string ModuleIO::dmr_gen_fname | ( | const int | out_type, |
const int | ispin, | ||
const bool | append = true , |
||
const int | istep = -1 |
||
) |
Generates a filename for the DMR output based on the given parameters.
out_type | The output type. 1: csr, 2: npz. |
ispin | The spin value, starting from 0. |
append | A boolean indicating whether append the data to one file or create a new file. |
istep | The ION step (default: -1), starting from 0. |
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 bool | out_app_flag, | ||
const bool | gamma_only, | ||
const int | istep = -1 |
||
) |
Generates the filename for the output files
directory | directory of the file |
property | wave function (wf), charge density (chg) or matrix (mat) |
basis | nao or pw |
ik_local | index of the k-points within each pool, and starting from 0. |
ik2iktot | map from ik to iktot |
nspin | number of spin channels, 1,2 or 4 |
nkstot | number of total k-points |
out_type | two types of output file format, 1 for .txt and 2 for .dat (binary) |
out_app_flag | whether to append to existing file. |
gamma_only | gamma_only algorithm or not. |
istep | index of the ion step starting from 0. If < 0, the step number is not included in the file name. |
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 | ||
) |
void ModuleIO::get_pchg_pw | ( | const std::vector< int > & | out_pchg, |
const int | nbands, | ||
const int | nspin, | ||
const int | nxyz, | ||
const int | chr_ngmc, | ||
UnitCell * | ucell, | ||
const psi::Psi< std::complex< double >, Device > * | kspw_psi, | ||
const ModulePW::PW_Basis * | pw_rhod, | ||
const ModulePW::PW_Basis_K * | pw_wfc, | ||
const Device * | ctx, | ||
const Parallel_Grid & | pgrid, | ||
const std::string & | global_out_dir, | ||
const bool | if_separate_k, | ||
const K_Vectors & | kv, | ||
const int | kpar, | ||
const int | my_pool, | ||
const Charge * | chr | ||
) |
std::set< Abfs::Vector3_Order< int > > ModuleIO::get_R_range | ( | const hamilt::HContainer< TR > & | hR | ) |
|
inline |
|
inline |
|
inline |
|
inline |
void ModuleIO::get_wf_pw | ( | const std::vector< int > & | out_wfc_norm, |
const std::vector< int > & | out_wfc_re_im, | ||
const int | nbands, | ||
const int | nspin, | ||
const int | nxyz, | ||
UnitCell * | ucell, | ||
const psi::Psi< std::complex< double >, Device > * | kspw_psi, | ||
const ModulePW::PW_Basis_K * | pw_wfc, | ||
const Device * | ctx, | ||
const Parallel_Grid & | pgrid, | ||
const std::string & | global_out_dir, | ||
const K_Vectors & | kv, | ||
const int | kpar, | ||
const int | my_pool | ||
) |
void ModuleIO::ldos_mode_pw | ( | const elecstate::ElecStatePW< std::complex< double > > * | pelec, |
const psi::Psi< std::complex< double > > & | psi, | ||
const Parallel_Grid & | pgrid, | ||
const UnitCell & | ucell | ||
) |
std::string ModuleIO::longstring | ( | const std::vector< std::string > & | words | ) |
std::string ModuleIO::nofound_str | ( | std::vector< std::string > | init_chgs, |
const std::string & | str | ||
) |
void ModuleIO::nscf_band | ( | 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 | ||
) |
calculate the band structure
is | spin index is = 0 or 1 |
out_band_dir | directory to save the band structure |
nband | number of bands |
fermie | fermi energy |
precision | precision of the output |
ekb | eigenvalues of k points and bands |
kv | klist |
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
void ModuleIO::nscf_fermi_surface | ( | const std::string & | out_band_dir, |
const int & | nband, | ||
const double & | ef, | ||
const K_Vectors & | kv, | ||
const UnitCell & | ucell, | ||
const ModuleBase::matrix & | ekb | ||
) |
std::vector< FPTYPE > ModuleIO::orbital_energy | ( | const int | ik, |
const int | nbands, | ||
const std::vector< std::complex< FPTYPE > > & | mat_mo | ||
) |
std::vector< double > ModuleIO::orbital_energy | ( | const int | ik, |
const int | nbands, | ||
const std::vector< T > & | mat_mo, | ||
const Parallel_2D & | p2d | ||
) |
void ModuleIO::output_after_relax | ( | bool | conv_ion, |
bool | conv_esolver, | ||
std::ofstream & | ofs_running = GlobalV::ofs_running |
||
) |
output after relaxation
conv_ion | if is convergence for ions |
conv_esolver | if is convergence for electrons |
ofs_running | the output stream |
void ModuleIO::output_convergence_after_scf | ( | const bool & | convergence, |
double & | energy, | ||
std::ofstream & | ofs_running = GlobalV::ofs_running |
||
) |
output if is convergence and energy after scf
convergence | if is convergence |
energy | the total energy in Ry |
ofs_running | the output stream |
void ModuleIO::output_dHR | ( | const int & | istep, |
const ModuleBase::matrix & | v_eff, | ||
Gint_k & | gint_k, | ||
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 K_Vectors & | kv, | ||
const bool & | binary = false , |
||
const double & | sparse_threshold = 1e-10 |
||
) |
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 K_Vectors & | kv, | ||
const bool & | binary = false , |
||
const double & | sparse_thr = 1e-10 |
||
) |
void ModuleIO::output_efermi | ( | const bool & | convergence, |
double & | efermi, | ||
std::ofstream & | ofs_running = GlobalV::ofs_running |
||
) |
output the fermi energy
convergence | if is convergence |
efermi | |
ofs_running | the output stream |
void ModuleIO::output_HSR | ( | const UnitCell & | ucell, |
const int & | istep, | ||
const ModuleBase::matrix & | v_eff, | ||
const Parallel_Orbitals & | pv, | ||
LCAO_HS_Arrays & | HS_Arrays, | ||
const Grid_Driver & | grid, | ||
const K_Vectors & | kv, | ||
hamilt::Hamilt< std::complex< double > > * | p_ham, | ||
const std::string & | SR_filename = "srs1_nao.csr" , |
||
const std::string & | HR_filename_up = "hrs1_nao.csr" , |
||
const std::string | HR_filename_down = "hrs2_nao.csr" , |
||
const bool & | binary = false , |
||
const double & | sparse_threshold = 1e-10 |
||
) |
void ModuleIO::output_mat_npz | ( | const UnitCell & | ucell, |
std::string & | zipname, | ||
const hamilt::HContainer< double > & | hR | ||
) |
void ModuleIO::output_mat_sparse | ( | const bool & | out_mat_hsR, |
const bool & | out_mat_dh, | ||
const bool & | out_mat_ds, | ||
const bool & | out_mat_t, | ||
const bool & | out_mat_r, | ||
const int & | istep, | ||
const ModuleBase::matrix & | v_eff, | ||
const Parallel_Orbitals & | pv, | ||
Gint_k & | gint_k, | ||
const TwoCenterBundle & | two_center_bundle, | ||
const LCAO_Orbitals & | orb, | ||
UnitCell & | ucell, | ||
const Grid_Driver & | grid, | ||
const K_Vectors & | kv, | ||
hamilt::Hamilt< double > * | p_ham | ||
) |
void ModuleIO::output_mat_sparse | ( | const bool & | out_mat_hsR, |
const bool & | out_mat_dh, | ||
const bool & | out_mat_ds, | ||
const bool & | out_mat_t, | ||
const bool & | out_mat_r, | ||
const int & | istep, | ||
const ModuleBase::matrix & | v_eff, | ||
const Parallel_Orbitals & | pv, | ||
Gint_k & | gint_k, | ||
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 | ||
) |
generate a file containing the Hamiltonian and S(overlap) matrices
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 Ry/Bohr)
void ModuleIO::output_mat_sparse | ( | const bool & | out_mat_hsR, |
const bool & | out_mat_dh, | ||
const bool & | out_mat_ds, | ||
const bool & | out_mat_t, | ||
const bool & | out_mat_r, | ||
const int & | istep, | ||
const ModuleBase::matrix & | v_eff, | ||
const Parallel_Orbitals & | pv, | ||
Gint_k & | gint_k, | ||
const TwoCenterBundle & | two_center_bundle, | ||
const LCAO_Orbitals & | orb, | ||
UnitCell & | ucell, | ||
const Grid_Driver & | grid, | ||
const K_Vectors & | kv, | ||
hamilt::Hamilt< T > * | p_ham | ||
) |
the output interface to write the sparse matrix of H, S, T, and r
void ModuleIO::output_single_R | ( | std::ofstream & | ofs, |
const std::map< size_t, std::map< size_t, T > > & | XR, | ||
const double & | sparse_threshold, | ||
const bool & | binary, | ||
const Parallel_Orbitals & | pv, | ||
const bool & | reduce = true |
||
) |
void ModuleIO::output_SR | ( | Parallel_Orbitals & | pv, |
const Grid_Driver & | grid, | ||
hamilt::Hamilt< std::complex< double > > * | p_ham, | ||
const std::string & | SR_filename = "srs1_nao.csr" , |
||
const bool & | binary = false , |
||
const double & | sparse_threshold = 1e-10 |
||
) |
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 = "trs1_nao.csr" , |
||
const bool & | binary = false , |
||
const double & | sparse_threshold = 1e-10 |
||
) |
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 = GlobalV::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.
ucell | the unitcell |
rho | charge density |
v_elecstat | electrostatic potential |
ofs_running | the output stream |
void ModuleIO::parse_args | ( | int | argc, |
char ** | argv | ||
) |
This function reture the version information when using command "abacus --version", "abacus -v" or "abacus -V". Otherwise, it does nothing.
[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. |
double ModuleIO::prepare | ( | const UnitCell & | cell, |
int & | dir | ||
) |
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 | ||
) |
void ModuleIO::print_force | ( | std::ofstream & | ofs, |
const UnitCell & | cell, | ||
const std::string & | name, | ||
const ModuleBase::matrix & | force, | ||
bool | ry = true |
||
) |
output atomic forces
ofs | the output stream |
cell | the unitcell |
name | force term name |
force | atomic forces |
ry | true if the unit of force is a.u. |
void ModuleIO::print_PAOs | ( | const UnitCell & | ucell | ) |
print chi (PAO) in pseudopotential file
ucell |
void ModuleIO::print_pdos_gamma | ( | const UnitCell & | ucell, |
const ModuleBase::matrix * | pdos, | ||
const int | nlocal, | ||
const int | npoints, | ||
const double & | emin, | ||
const double & | dos_edelta_ev | ||
) |
void ModuleIO::print_pdos_multik | ( | const UnitCell & | ucell, |
const ModuleBase::matrix * | pdos, | ||
const int | nlocal, | ||
const int | npoints, | ||
const double & | emin, | ||
const double & | dos_edelta_ev | ||
) |
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.
void ModuleIO::print_screen | ( | const int & | stress_step, |
const int & | force_step, | ||
const int & | istep | ||
) |
void ModuleIO::print_stress | ( | const std::string & | name, |
const ModuleBase::matrix & | scs, | ||
const bool | screen, | ||
const bool | ry, | ||
std::ofstream & | ofs | ||
) |
output stress components
name | stress term name |
f | stress components |
ry | true if the unit of force is a.u. |
void ModuleIO::print_tdos_gamma | ( | const ModuleBase::matrix * | pdos, |
const int | nlocal, | ||
const int | npoints, | ||
const double & | emin, | ||
const double & | dos_edelta_ev | ||
) |
void ModuleIO::print_tdos_multik | ( | const ModuleBase::matrix * | pdos, |
const int | nlocal, | ||
const int | npoints, | ||
const double & | emin, | ||
const double & | dos_edelta_ev | ||
) |
void ModuleIO::print_time | ( | time_t & | time_start, |
time_t & | time_finish | ||
) |
void ModuleIO::print_wfcfft | ( | const Input_para & | inp, |
ModulePW::PW_Basis_K & | pw_wfc, | ||
std::ofstream & | ofs | ||
) |
std::vector< std::complex< FPTYPE > > ModuleIO::psi_Hpsi | ( | std::complex< FPTYPE > *const | psi, |
std::complex< FPTYPE > *const | hpsi, | ||
const int | nbasis, | ||
const int | nbands | ||
) |
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.
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 |
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
bool ModuleIO::read_dmk | ( | const int | nspin, |
const int | nk, | ||
const Parallel_2D & | pv, | ||
const std::string & | dmk_dir, | ||
std::vector< std::vector< T > > & | dmk, | ||
std::ofstream & | ofs_running | ||
) |
Reads the DMK data from a file.
T | The type of the DMK data. |
nspin | The number of spin components. |
nk | The number of k-points. |
pv | The Parallel_2D object. Will get the global size and local size from it, and seperate the data into different processors accordingly. |
dmk_dir | The directory path of the DMK file. |
dmk | A vector to store the DMK data. If use MPI parallel, the data will be seperated into different processors based on the Parallel_2D object. |
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
my_rank | the rank of the current process |
filename | the name of the file to read |
ofs_running | the output stream |
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
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
void ModuleIO::read_information | ( | std::ifstream & | ifs, |
std::vector< std::string > & | output, | ||
const std::string & | delimiters | ||
) |
std::vector< double > ModuleIO::read_k | ( | std::string | filename, |
int | ik | ||
) |
void ModuleIO::read_mat_npz | ( | const Parallel_Orbitals * | paraV, |
const UnitCell & | ucell, | ||
std::string & | zipname, | ||
hamilt::HContainer< double > & | hR | ||
) |
bool ModuleIO::read_rhog | ( | const std::string & | filename, |
const ModulePW::PW_Basis * | pw_rhod, | ||
std::complex< double > ** | rhog | ||
) |
bool ModuleIO::read_vdata_palgrid | ( | const Parallel_Grid & | pgrid, |
const int | my_rank, | ||
std::ofstream & | ofs_running, | ||
const std::string & | fn, | ||
double *const | data, | ||
const int | nat | ||
) |
read volumetric data from .cube file into the parallel distributed grid.
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
pw_wfc | pw basis for wave functions |
symm | symmetry |
nkstot | total number of k points |
isk | k index to spin index |
chg | charge density |
bool ModuleIO::read_wfc_nao | ( | const std::string & | global_readin_dir, |
const Parallel_Orbitals & | ParaV, | ||
psi::Psi< T > & | psid, | ||
elecstate::ElecState *const | pelec, | ||
const std::vector< int > & | ik2iktot, | ||
const int | nkstot, | ||
const int | nspin, | ||
const int | skip_band = 0 , |
||
const int | nstep = -1 |
||
) |
Reads the wavefunction coefficients from an input file.
T | The type of the wavefunction coefficients. |
global_readin_dir | The global directory for reading input files. |
ParaV | The parallel orbitals object. |
psid | The Psi object to store the wavefunction coefficients. |
pelec | Pointer to the ElecState object. |
skip_band | From which band to start reading. |
void ModuleIO::read_wfc_nao_one_data | ( | std::ifstream & | ifs, |
double & | data | ||
) |
Reads a single data value from an input file stream.
ifs | The input file stream to read from. |
data | The variable to store the read data value. |
void ModuleIO::read_wfc_nao_one_data | ( | std::ifstream & | ifs, |
std::complex< double > & | data | ||
) |
Reads a single complex data value from an input file stream.
ifs | The input file stream to read from. |
data | The variable to store the read complex data value. |
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
filename | filename containing wave functions |
pw_wfc | wave function FFT grids |
ik | k index |
ikstot | total index of k points |
nkstot | total number of k points |
wfc | wave functions |
void ModuleIO::save_dH_sparse | ( | const int & | istep, |
const Parallel_Orbitals & | pv, | ||
LCAO_HS_Arrays & | HS_Arrays, | ||
const double & | sparse_thr, | ||
const bool & | binary, | ||
const std::string & | fileflag = "h" |
||
) |
void ModuleIO::save_HSR_sparse | ( | const int & | istep, |
const Parallel_Orbitals & | pv, | ||
LCAO_HS_Arrays & | HS_Arrays, | ||
const double & | sparse_thr, | ||
const bool & | binary, | ||
const std::string & | SR_filename, | ||
const std::string & | HR_filename_up, | ||
const std::string & | HR_filename_down = "" |
||
) |
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_2D & | pv, | ||
const int | drank, | ||
const bool | reduce = true |
||
) |
save a square matrix, such as H(k) and S(k)
[in] | istep | : the step of the calculation |
[in] | mat | : the local matrix |
[in] | bit | : true for binary, false for decimal |
[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 |
void ModuleIO::save_sparse | ( | const std::map< Abfs::Vector3_Order< int >, std::map< size_t, std::map< size_t, Tdata > > > & | smat, |
const std::set< Abfs::Vector3_Order< int > > & | all_R_coor, | ||
const double & | sparse_thr, | ||
const bool & | binary, | ||
const std::string & | filename, | ||
const Parallel_Orbitals & | pv, | ||
const std::string & | label, | ||
const int & | istep = -1 , |
||
const bool & | reduce = true |
||
) |
void ModuleIO::set_gint_pointer | ( | Gint_Gamma & | gint_gamma, |
Gint_k & | gint_k, | ||
typename TGint< T >::type *& | gint | ||
) |
void ModuleIO::set_gint_pointer< double > | ( | Gint_Gamma & | gint_gamma, |
Gint_k & | gint_k, | ||
typename TGint< double >::type *& | gint | ||
) |
void ModuleIO::set_gint_pointer< double > | ( | Gint_Gamma & | gint_gamma, |
Gint_k & | gint_k, | ||
typename TGint< double >::type *& | gint | ||
) |
void ModuleIO::set_gint_pointer< std::complex< double > > | ( | Gint_Gamma & | gint_gamma, |
Gint_k & | gint_k, | ||
typename TGint< std::complex< double > >::type *& | gint | ||
) |
void ModuleIO::set_gint_pointer< std::complex< double > > | ( | Gint_Gamma & | gint_gamma, |
Gint_k & | gint_k, | ||
typename TGint< std::complex< double > >::type *& | gint | ||
) |
|
inline |
void ModuleIO::stm_mode_pw | ( | const elecstate::ElecStatePW< std::complex< double > > * | pelec, |
const psi::Psi< std::complex< double > > & | psi, | ||
const Parallel_Grid & | pgrid, | ||
const UnitCell & | ucell | ||
) |
std::string ModuleIO::to_dir | ( | const std::string & | str | ) |
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.
data_in | the input data of size nxyz_read |
nx_read | nx read from file |
ny_read | ny read from file |
nz_read | nz read from file |
nx | the dimension of grids along x |
ny | the dimension of grids along y |
nz | the dimension of grids along z |
data_out | the interpolated results of size nxyz |
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 | ||
) |
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 | ||
) |
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 | ||
) |
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 |
||
) |
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 int | ndata_line = 6 |
||
) |
write a cube file
void ModuleIO::write_dipole | ( | const UnitCell & | ucell, |
const double * | rho_save, | ||
const ModulePW::PW_Basis * | rhopw, | ||
const int & | is, | ||
const int & | istep, | ||
const std::string & | fn, | ||
const int & | precision = 11 |
||
) |
void ModuleIO::write_dmk | ( | const std::vector< std::vector< T > > & | dmk, |
const int | precision, | ||
const std::vector< double > & | efs, | ||
const UnitCell * | ucell, | ||
const Parallel_2D & | pv | ||
) |
Writes the DMK data to a file.
T | The type of the DMK data. |
dmk | A 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. |
precision | The precision of the output of DMK. |
efs | A vector containing the Fermi energies, and should have the same size as the number of SPIN. |
ucell | A pointer to the UnitCell object. |
pv | The Parallel_2D object. The 2d-block parallel information of DMK. |
void ModuleIO::write_dmr | ( | const std::vector< hamilt::HContainer< double > * > | dmr, |
const Parallel_2D & | paraV, | ||
const bool | append, | ||
const int * | iat2iwt, | ||
const int | nat, | ||
const int | istep | ||
) |
Writes DMR to a file.
dmr | The 2D block parallel matrix representing the density matrix. The first dimension is the spin index. |
paraV | The parallel 2D object. |
out_type | The output file type. 1: csr, 2: npz. |
sparse | Whether output the sparse DM. |
ispin | The spin index, starting from 0. |
append | Whether to append the data to an existing file or create a new file. The file name is related to this flag. |
istep | The ION step, starting from 0. |
void ModuleIO::write_dmr_csr | ( | std::string & | fname, |
hamilt::HContainer< double > * | dm_serial, | ||
const int | istep | ||
) |
Writes HContainer to a csr file.
fname | The name of the file to write the CSR representation to. |
dm_serial | A pointer to the Hamiltonian container. |
istep | The current step number. |
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 bool | out_app_flag, | ||
const int | istep, | ||
std::ofstream & | ofs_running | ||
) |
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 bool | out_app_flag, | ||
const int | istep, | ||
std::ofstream & | ofs_running | ||
) |
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 bool | out_app_flag, | ||
const int | istep, | ||
std::ofstream & | ofs_running | ||
) |
calculate density of states(DOS), partial density of states(PDOS), and mulliken charge for LCAO base
void ModuleIO::write_dos_pw | ( | const UnitCell & | ucell, |
const ModuleBase::matrix & | ekb, | ||
const ModuleBase::matrix & | wg, | ||
const K_Vectors & | kv, | ||
const int | nbands, | ||
const elecstate::efermi & | energy_fermi, | ||
const double & | dos_edelta_ev, | ||
const double & | dos_scale, | ||
const double & | bcoeff, | ||
std::ofstream & | ofs_running | ||
) |
calculate density of states(DOS) for PW base
void ModuleIO::write_eband_terms | ( | const int | nspin, |
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, | ||
Gint_Gamma & | gint_gamma, | ||
Gint_k & | gint_k, | ||
const K_Vectors & | kv, | ||
const ModuleBase::matrix & | wg, | ||
Grid_Driver & | gd, | ||
const std::vector< double > & | orb_cutoff, | ||
const TwoCenterBundle & | two_center_bundle | ||
) |
void ModuleIO::write_eig_file | ( | const ModuleBase::matrix & | ekb, |
const ModuleBase::matrix & | wg, | ||
const K_Vectors & | kv | ||
) |
void ModuleIO::write_eig_iter | ( | const ModuleBase::matrix & | ekb, |
const ModuleBase::matrix & | wg, | ||
const K_Vectors & | kv | ||
) |
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_effective_fixed, | ||
const surchem & | solvent | ||
) |
write electric static potential to file
bz | |
nbz | |
fn | |
istep | |
rho_basis | |
chr | |
ucell_ | |
v_effective_fixed |
Dipole correction
Add hartree potential and local pseudopot
Get the vacuum level of the system
Write down the electrostatic potential
void ModuleIO::write_elf | ( | const int & | bz, |
const int & | nbz, | ||
const std::string & | out_dir, | ||
const int & | istep, | ||
const int & | nspin, | ||
const double *const * | rho, | ||
const double *const * | tau, | ||
ModulePW::PW_Basis * | rho_basis, | ||
const Parallel_Grid & | pgrid, | ||
const UnitCell * | ucell_, | ||
const int & | precision | ||
) |
void ModuleIO::write_head | ( | std::ofstream & | ofs_running, |
const int & | istep, | ||
const int & | iter, | ||
const std::string & | basisname | ||
) |
write head for scf iteration
ofs_running | output stream |
istep | the ion step |
iter | the scf iteration step |
basisname | basis set name |
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
ofs_running | output stream |
istep | the ion step |
estep | the electron step |
iter | the scf iteration step |
basisname | basis set name |
void ModuleIO::write_Hexxs_csr | ( | const std::string & | file_name, |
const UnitCell & | ucell, | ||
const std::map< int, std::map< TAC, RI::Tensor< Tdata > > > & | Hexxs | ||
) |
write Hexxs in CSR format
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 | ||
) |
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 bool | gamma_only, | ||
const bool | out_app_flag, | ||
const int | istep, | ||
std::ofstream & | ofs_running | ||
) |
|
inline |
void ModuleIO::write_orb_info | ( | const UnitCell * | ucell | ) |
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 | ||
) |
bool ModuleIO::write_rhog | ( | const std::string & | fchg, |
const bool | gamma_only, | ||
const ModulePW::PW_Basis * | pw_rho, | ||
const int | nspin, | ||
const ModuleBase::Matrix3 & | GT, | ||
std::complex< double > ** | rhog, | ||
const int | ipool, | ||
const int | irank, | ||
const int | nrank | ||
) |
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 = 11 , |
||
const int | out_fermi = 1 , |
||
const bool | reduce_all_pool = false |
||
) |
write volumetric data on the parallized grid into a .cube file
output header for cube file
void ModuleIO::write_Vxc | ( | const int | nspin, |
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, | ||
Gint_Gamma & | gint_gamma, | ||
Gint_k & | gint_k, | ||
const K_Vectors & | kv, | ||
const std::vector< double > & | orb_cutoff, | ||
const ModuleBase::matrix & | wg, | ||
Grid_Driver & | gd | ||
) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC, EXX, DFTU
void ModuleIO::write_Vxc | ( | int | nspin, |
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 | ||
) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC and EXX
wrap psi and act band-by-band (the same result as act all bands at once)
add-up and write
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, | ||
Gint_Gamma & | gint_gamma, | ||
Gint_k & | gint_k, | ||
const K_Vectors & | kv, | ||
const std::vector< double > & | orb_cutoff, | ||
Grid_Driver & | gd, | ||
const double | sparse_thr = 1e-10 |
||
) |
write the Vxc matrix in KS orbital representation, usefull for GW calculation including terms: local/semi-local XC, EXX, DFTU
void ModuleIO::write_wfc_nao | ( | const int | out_type, |
const bool | 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, | ||
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].
out_type | The output file type. 1 for text, 2 for binary. |
psi | The Psi object containing the wavefunction coefficients. |
ekb | The matrix of Kohn-Sham eigenvalues. |
wg | The matrix of Kohn-Sham eigenvectors. |
kvec_c | The vector of k-points in Cartesian coordinates. |
pv | The Parallel_Orbitals object containing additional information. |
istep | The current step number. if < 0, the step number is not included in the file name. |
template void ModuleIO::write_wfc_nao< double > | ( | const int | out_type, |
const bool | 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, | ||
const int | istep | ||
) |
template void ModuleIO::write_wfc_nao< std::complex< double > > | ( | const int | out_type, |
const bool | 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, | ||
const int | istep | ||
) |
void ModuleIO::write_wfc_pw | ( | 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 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 | ||
) |