From eb7d33fade6b8ffada47f1db186a0ea68d45247c Mon Sep 17 00:00:00 2001 From: linpz Date: Wed, 11 Jun 2025 03:56:35 +0800 Subject: [PATCH 1/2] add write_libxc_r --- source/Makefile.Objects | 1 + source/module_esolver/esolver_fp.cpp | 17 +- source/module_io/CMakeLists.txt | 1 + source/module_io/read_input_item_output.cpp | 15 + source/module_io/write_libxc_r.cpp | 451 ++++++++++++++++++++ source/module_io/write_libxc_r.h | 54 +++ source/module_parameter/input_parameter.h | 1 + 7 files changed, 539 insertions(+), 1 deletion(-) create mode 100644 source/module_io/write_libxc_r.cpp create mode 100644 source/module_io/write_libxc_r.h diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 782e728e3e..18d74d4e0f 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -535,6 +535,7 @@ OBJS_IO=input_conv.o\ write_dipole.o\ td_current_io.o\ write_wfc_r.o\ + write_libxc_r.o\ output_log.o\ output_mat_sparse.o\ para_json.o\ diff --git a/source/module_esolver/esolver_fp.cpp b/source/module_esolver/esolver_fp.cpp index f32a389158..efba93c746 100644 --- a/source/module_esolver/esolver_fp.cpp +++ b/source/module_esolver/esolver_fp.cpp @@ -17,6 +17,7 @@ #include "module_io/write_elecstat_pot.h" #include "module_io/write_elf.h" #include "module_parameter/parameter.h" +#include "module_io/write_libxc_r.h" namespace ModuleESolver { @@ -84,7 +85,7 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp) #ifdef __MPI this->pw_rho->initmpi(GlobalV::NPROC_IN_POOL, GlobalV::RANK_IN_POOL, POOL_WORLD); #endif - if (this->classname == "ESolver_OF" || PARAM.inp.of_ml_gene_data == 1) + if (this->classname == "ESolver_OF" || PARAM.inp.of_ml_gene_data == 1) { this->pw_rho->setfullpw(inp.of_full_pw, inp.of_full_pw_dim); } @@ -254,6 +255,20 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso &(ucell), PARAM.inp.out_elf[1]); } + + // 7) write xc(r) + if(PARAM.inp.out_xc_r[0]>=0) + { + ModuleIO::write_libxc_r( + PARAM.inp.out_xc_r[0], + XC_Functional::get_func_id(), + this->pw_rhod->nrxx, // number of real-space grid + ucell.omega, // volume of cell + ucell.tpiba, + this->chr, + *this->pw_big, + *this->pw_rhod); + } } } diff --git a/source/module_io/CMakeLists.txt b/source/module_io/CMakeLists.txt index 148b41cb33..0d7d50fce0 100644 --- a/source/module_io/CMakeLists.txt +++ b/source/module_io/CMakeLists.txt @@ -29,6 +29,7 @@ list(APPEND objects write_dipole.cpp td_current_io.cpp write_wfc_r.cpp + write_libxc_r.cpp output_log.cpp para_json.cpp parse_args.cpp diff --git a/source/module_io/read_input_item_output.cpp b/source/module_io/read_input_item_output.cpp index e6f198afd8..02710a2565 100644 --- a/source/module_io/read_input_item_output.cpp +++ b/source/module_io/read_input_item_output.cpp @@ -546,6 +546,21 @@ void ReadInput::item_output() add_intvec_bcast(input.out_wfc_re_im, para.input.out_wfc_re_im.size(), 0); this->add_item(item); } + { + Input_Item item("out_xc_r"); + item.annotation = "if >=0, output the derivatives of exchange correlation in realspace, second parameter controls the precision"; + item.read_value = [](const Input_Item& item, Parameter& para) { + size_t count = item.get_size(); + std::vector out_xc_r(count); // create a placeholder vector + std::transform(item.str_values.begin(), item.str_values.end(), out_xc_r.begin(), [](std::string s) { return std::stoi(s); }); + std::cout<add_item(item); + } { Input_Item item("if_separate_k"); item.annotation = "specify whether to write the partial charge densities for all k-points to individual files " diff --git a/source/module_io/write_libxc_r.cpp b/source/module_io/write_libxc_r.cpp new file mode 100644 index 0000000000..6ca031109e --- /dev/null +++ b/source/module_io/write_libxc_r.cpp @@ -0,0 +1,451 @@ +//====================== +// AUTHOR : Peize Lin +// DATE : 2024-09-12 +//====================== + +#ifdef USE_LIBXC + +#include "write_libxc_r.h" +#include "module_hamilt_general/module_xc/xc_functional.h" +#include "module_hamilt_general/module_xc/xc_functional_libxc.h" +#include "module_elecstate/module_charge/charge.h" +#include "module_basis/module_pw/pw_basis_big.h" +#include "module_basis/module_pw/pw_basis.h" +#include "module_io/cube_io.h" +#include "module_base/global_variable.h" +#include "module_parameter/parameter.h" +#include "module_base/timer.h" +#include "module_base/tool_title.h" + +#include +#include +#include +#include +#include + +void ModuleIO::write_libxc_r( + const int order, + const std::vector &func_id, + const int &nrxx, // number of real-space grid + const double &omega, // volume of cell + const double tpiba, + const Charge &chr, + const ModulePW::PW_Basis_Big &pw_big, + const ModulePW::PW_Basis &pw_rhod) +{ + ModuleBase::TITLE("ModuleIO","write_libxc_r"); + ModuleBase::timer::tick("ModuleIO","write_libxc_r"); + + const int nspin = + (PARAM.inp.nspin == 1 || ( PARAM.inp.nspin ==4 && !PARAM.globalv.domag && !PARAM.globalv.domag_z)) + ? 1 : 2; + + //---------------------------------------------------------- + // xc_func_type is defined in Libxc package + // to understand the usage of xc_func_type, + // use can check on website, for example: + // https://www.tddft.org/programs/libxc/manual/libxc-5.1.x/ + //---------------------------------------------------------- + + std::vector funcs = XC_Functional_Libxc::init_func( func_id, (1==nspin) ? XC_UNPOLARIZED:XC_POLARIZED ); + + const bool is_gga = [&funcs]() + { + for( xc_func_type &func : funcs ) + { + switch( func.info->family ) + { + case XC_FAMILY_GGA: + case XC_FAMILY_HYB_GGA: + return true; + } + } + return false; + }(); + + // converting rho + std::vector rho; + std::vector amag; + if(1==nspin || 2==PARAM.inp.nspin) + { + rho = XC_Functional_Libxc::convert_rho(nspin, nrxx, &chr); + } + else + { + std::tuple,std::vector> rho_amag = XC_Functional_Libxc::convert_rho_amag_nspin4(nspin, nrxx, &chr); + rho = std::get<0>(std::move(rho_amag)); + amag = std::get<1>(std::move(rho_amag)); + } + + std::vector sigma; + if(is_gga) + { + const std::vector>> gdr = XC_Functional_Libxc::cal_gdr(nspin, nrxx, rho, tpiba, &chr); + sigma = XC_Functional_Libxc::convert_sigma(gdr); + } + + std::vector exc; + std::vector vrho; + std::vector vsigma; + std::vector v2rho2; + std::vector v2rhosigma; + std::vector v2sigma2; + std::vector v3rho3; + std::vector v3rho2sigma; + std::vector v3rhosigma2; + std::vector v3sigma3; + std::vector v4rho4; + std::vector v4rho3sigma; + std::vector v4rho2sigma2; + std::vector v4rhosigma3; + std::vector v4sigma4; + // attention: order 4321 don't break + switch( order ) + { + case 4: v4rho4.resize( nrxx * ((1==nspin)?1:5) ); + case 3: v3rho3.resize( nrxx * ((1==nspin)?1:4) ); + case 2: v2rho2.resize( nrxx * ((1==nspin)?1:3) ); + case 1: vrho .resize( nrxx * nspin ); + case 0: exc .resize( nrxx ); + break; + default: throw std::domain_error("order ="+std::to_string(order) + +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); + break; + } + if(is_gga) + { + switch( order ) + { + case 4: v4rho3sigma .resize( nrxx * ((1==nspin)?1:12) ); + v4rho2sigma2.resize( nrxx * ((1==nspin)?1:15) ); + v4rhosigma3 .resize( nrxx * ((1==nspin)?1:20) ); + v4sigma4 .resize( nrxx * ((1==nspin)?1:15) ); + case 3: v3rho2sigma .resize( nrxx * ((1==nspin)?1:9) ); + v3rhosigma2 .resize( nrxx * ((1==nspin)?1:12) ); + v3sigma3 .resize( nrxx * ((1==nspin)?1:10) ); + case 2: v2rhosigma .resize( nrxx * ((1==nspin)?1:6) ); + v2sigma2 .resize( nrxx * ((1==nspin)?1:6) ); + case 1: vsigma .resize( nrxx * ((1==nspin)?1:3) ); + case 0: break; + default: throw std::domain_error("order ="+std::to_string(order) + +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); + break; + } + } + + for( xc_func_type &func : funcs ) + { + // jiyy add for threshold + constexpr double rho_threshold = 1E-6; + constexpr double grho_threshold = 1E-10; + + xc_func_set_dens_threshold(&func, rho_threshold); + + // sgn for threshold mask + const std::vector sgn = XC_Functional_Libxc::cal_sgn(rho_threshold, grho_threshold, func, nspin, nrxx, rho, sigma); + + // call libxc function + // attention: order 432 don't break + switch( func.info->family ) + { + case XC_FAMILY_LDA: + { + switch( order ) + { + case 4: xc_lda_lxc ( &func, nrxx, rho.data(), v4rho4.data() ); + case 3: xc_lda_kxc ( &func, nrxx, rho.data(), v3rho3.data() ); + case 2: xc_lda_fxc ( &func, nrxx, rho.data(), v2rho2.data() ); + case 1: xc_lda_exc_vxc( &func, nrxx, rho.data(), exc.data(), vrho.data() ); + break; + case 0: xc_lda_exc ( &func, nrxx, rho.data(), exc.data() ); + break; + default: throw std::domain_error("order ="+std::to_string(order) + +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); + break; + } + break; + } + case XC_FAMILY_GGA: + case XC_FAMILY_HYB_GGA: + { + switch( order ) + { + case 4: xc_gga_lxc ( &func, nrxx, rho.data(), sigma.data(), v4rho4.data(), v4rho3sigma.data(), v4rho2sigma2.data(), v4rhosigma3.data(), v4sigma4.data() ); + case 3: xc_gga_kxc ( &func, nrxx, rho.data(), sigma.data(), v3rho3.data(), v3rho2sigma.data(), v3rhosigma2.data(), v3sigma3.data() ); + case 2: xc_gga_fxc ( &func, nrxx, rho.data(), sigma.data(), v2rho2.data(), v2rhosigma.data(), v2sigma2.data() ); + case 1: xc_gga_exc_vxc( &func, nrxx, rho.data(), sigma.data(), exc.data(), vrho.data(), vsigma.data() ); + break; + case 0: xc_gga_exc ( &func, nrxx, rho.data(), sigma.data(), exc.data() ); + break; + default: throw std::domain_error("order ="+std::to_string(order) + +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); + break; + } + break; + } + default: + { + throw std::domain_error("func.info->family ="+std::to_string(func.info->family) + +" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__)); + break; + } + } // end switch( func.info->family ) + } // end for( xc_func_type &func : funcs ) + + auto write_data = [&pw_big, &pw_rhod]( + const std::string data_name, + const std::vector &data, + const int number_spin) + { + for(int is=0; is data_cube(nxyz, 0.0); + + // num_z: how many planes on processor 'ip' + std::vector num_z(nproc_in_pool, 0); + for (int iz = 0; iz < nbz; iz++) + { + const int ip = iz % nproc_in_pool; + num_z[ip] += bz; + } + + // start_z: start position of z in + // processor ip. + std::vector start_z(nproc_in_pool, 0); + for (int ip = 1; ip < nproc_in_pool; ip++) + { + start_z[ip] = start_z[ip - 1] + num_z[ip - 1]; + } + + // which_ip: found iz belongs to which ip. + std::vector which_ip(nz, 0); + for (int iz = 0; iz < nz; iz++) + { + for (int ip = 0; ip < nproc_in_pool; ip++) + { + if (iz >= start_z[nproc_in_pool - 1]) + { + which_ip[iz] = nproc_in_pool - 1; + break; + } + else if (iz >= start_z[ip] && iz < start_z[ip + 1]) + { + which_ip[iz] = ip; + break; + } + } + } + + int count = 0; + std::vector zpiece(nxy, 0.0); + + // save the rho one z by one z. + for (int iz = 0; iz < nz; iz++) + { + zpiece.assign(nxy, 0.0); + + // tag must be different for different iz. + const int tag = iz; + MPI_Status ierror; + + // case 1: the first part of rho in processor 0. + if (which_ip[iz] == 0 && rank_in_pool == 0) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + // mohan change to rho_save on 2012-02-10 + // because this can make our next restart calculation lead + // to the same scf_thr as the one saved. + zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; + } + } + // case 2: > first part rho: send the rho to + // processor 0. + else if (which_ip[iz] == rank_in_pool) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + zpiece[ixy] = data[ixy * nplane + (iz - startz_current) * nld]; + } + MPI_Send(zpiece.data(), nxy, MPI_DOUBLE, 0, tag, POOL_WORLD); + } + + // case 2: > first part rho: processor 0 receive the rho + // from other processors + else if (rank_in_pool == 0) + { + MPI_Recv(zpiece.data(), nxy, MPI_DOUBLE, which_ip[iz], tag, POOL_WORLD, &ierror); + } + + if (my_rank == 0) + { + /// for cube file + for (int ixy = 0; ixy < nxy; ixy++) + { + data_cube[ixy * nz + iz] = zpiece[ixy]; + } + /// for cube file + } + } // end iz + + // for cube file + if (my_rank == 0) + { + for (int ixy = 0; ixy < nxy; ixy++) + { + for (int iz = 0; iz < nz; iz++) + { + ofs_cube << " " << data_cube[ixy * nz + iz]; + if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) + { + ofs_cube << "\n"; + } + } + ofs_cube << "\n"; + } + } + /// for cube file + } + MPI_Barrier(MPI_COMM_WORLD); +} + +#else // #ifdef __MPI + +void ModuleIO::write_cube_core( + std::ofstream &ofs_cube, + const double*const data, + const int nxy, + const int nz, + const int n_data_newline) +{ + ModuleBase::TITLE("ModuleIO", "write_cube_core"); + for (int ixy = 0; ixy < nxy; ixy++) + { + for (int iz = 0; iz < nz; iz++) + { + ofs_cube << " " << data[iz * nxy + ixy]; + // ++count_cube; + if ((iz % n_data_newline == n_data_newline-1) && (iz != nz - 1)) + { + ofs_cube << "\n"; + } + } + ofs_cube << "\n"; + } +} + +#endif // #ifdef __MPI + +#endif // USE_LIBXC \ No newline at end of file diff --git a/source/module_io/write_libxc_r.h b/source/module_io/write_libxc_r.h new file mode 100644 index 0000000000..ad82e68b57 --- /dev/null +++ b/source/module_io/write_libxc_r.h @@ -0,0 +1,54 @@ +//====================== +// AUTHOR : Peize Lin +// DATE : 2024-09-12 +//====================== + +#ifndef WRITE_LIBXC_R_H +#define WRITE_LIBXC_R_H + +#ifdef USE_LIBXC + +#include +#include + + class Charge; + namespace ModulePW{ class PW_Basis_Big; } + namespace ModulePW{ class PW_Basis; } + +namespace ModuleIO +{ + extern void write_libxc_r( + const int order, + const std::vector &func_id, + const int &nrxx, // number of real-space grid + const double &omega, // volume of cell + const double tpiba, + const Charge &chr, + const ModulePW::PW_Basis_Big &pw_big, + const ModulePW::PW_Basis &pw_rhod); + + #ifdef __MPI + extern void write_cube_core( + std::ofstream &ofs_cube, + const int bz, + const int nbz, + const int nplane, + const int startz_current, + const double*const data, + const int nxy, + const int nz, + const int nld, + const int n_data_newline); + #else + extern void write_cube_core( + std::ofstream &ofs_cube, + const double*const data, + const int nxy, + const int nz, + const int n_data_newline); + #endif +} + +#endif // USE_LIBXC + +#endif // WRITE_LIBXC_R_H \ No newline at end of file diff --git a/source/module_parameter/input_parameter.h b/source/module_parameter/input_parameter.h index 53683194d6..8d44e7dbf0 100644 --- a/source/module_parameter/input_parameter.h +++ b/source/module_parameter/input_parameter.h @@ -360,6 +360,7 @@ struct Input_para int out_freq_ion = 0; ///< the frequency ( >= 0 ) of ionic step to output charge density; ///< 0: output only when ion steps are finished std::vector out_chg = {0, 3}; ///< output charge density. 0: no; 1: yes + std::vector out_xc_r = {-1, 3}; ///< output xc(r). -1: no; >=0: output the order of xc(r) int out_pot = 0; ///< yes or no int out_wfc_pw = 0; ///< 0: no; 1: txt; 2: dat int printe = 0; ///< Print out energy for each band for every printe step, default is scf_nmax From 5bb134837ca786ba6dc9fa778c822cafaa106310 Mon Sep 17 00:00:00 2001 From: linpz Date: Sat, 14 Jun 2025 16:28:38 +0800 Subject: [PATCH 2/2] 1. chage file_name of write_xc_r according to v3.9.0.7 2. fix bug of write_xc_r when compiled without Libxc 3. add description in input-main.md --- docs/advanced/input_files/input-main.md | 193 +++++++++++++++----- source/module_esolver/esolver_fp.cpp | 5 + source/module_io/read_input_item_output.cpp | 10 +- source/module_io/write_libxc_r.cpp | 5 +- 4 files changed, 157 insertions(+), 56 deletions(-) diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index d24e80c456..d2fc9b8cb8 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -38,6 +38,7 @@ - [pw\_seed](#pw_seed) - [pw\_diag\_thr](#pw_diag_thr) - [diago\_smooth\_ethr](#diago_smooth_ethr) + - [use\_k\_continuity](#use_k_continuity) - [pw\_diag\_nmax](#pw_diag_nmax) - [pw\_diag\_ndim](#pw_diag_ndim) - [diag\_subspace](#diag_subspace) @@ -64,6 +65,8 @@ - [nupdown](#nupdown) - [dft\_functional](#dft_functional) - [xc\_temperature](#xc_temperature) + - [xc\_exch\_ext](#xc_exch_ext) + - [xc\_corr\_ext](#xc_corr_ext) - [pseudo\_rcut](#pseudo_rcut) - [pseudo\_mesh](#pseudo_mesh) - [nspin](#nspin) @@ -129,12 +132,12 @@ - [fixed\_atoms](#fixed_atoms) - [cell\_factor](#cell_factor) - [Output Variables](#variables-related-to-output-information) - - [out\_mul](#out_mul) - [out\_freq\_elec](#out_freq_elec) - [out\_chg](#out_chg) + - [out\_xc\_r](#out_xc_r) - [out\_pot](#out_pot) - - [out\_dm](#out_dm) - - [out\_dm1](#out_dm1) + - [out\_dm](#out_dmk) + - [out\_dm1](#out_dmr) - [out\_wfc\_pw](#out_wfc_pw) - [out\_wfc\_lcao](#out_wfc_lcao) - [out\_dos](#out_dos) @@ -156,8 +159,8 @@ - [out\_mat\_xc2](#out_mat_xc2) - [out\_mat\_l](#out_mat_l) - [out\_eband\_terms](#out_eband_terms) - - [out\_hr\_npz/out\_dm\_npz](#out_hr_npzout_dm_npz) - [dm\_to\_rho](#dm_to_rho) + - [out\_mul](#out_mul) - [out\_app\_flag](#out_app_flag) - [out\_ndigits](#out_ndigits) - [out\_interval](#out_interval) @@ -503,7 +506,7 @@ These variables are used to control general system parameters. - md: perform molecular dynamics simulations - get_pchg: obtain partial (band-decomposed) charge densities (for LCAO basis only). See `nbands_istate` and `out_pchg` for more information - get_wf: obtain wave functions (for LCAO basis only). See `nbands_istate`, `out_wfc_norm` and `out_wfc_re_im` for more information - - get_S: obtain the overlap matrix formed by localized orbitals (for LCAO basis with multiple k points). the file name is `SR.csr` with file format being the same as that generated by [out_mat_hs2](#out_mat_hs2) + - get_s: obtain the overlap matrix formed by localized orbitals (for LCAO basis with multiple k points). the file name is `SR.csr` with file format being the same as that generated by [out_mat_hs2](#out_mat_hs2). Note: in the 3.10-LTS version, the command was named `get_S` - gen_bessel: generates projectors, i.e., a series of Bessel functions, for the DeePKS method (for LCAO basis only); see also keywords `bessel_descriptor_lmax`, `bessel_descriptor_rcut` and `bessel_descriptor_tolerence`. A file named `jle.orb` will be generated which contains the projectors. An example is provided in examples/H2O-deepks-pw - test_memory: obtain a rough estimation of memory consuption for the calculation - test_neighbour: obtain information of neighboring atoms (for LCAO basis only), please specify a positive [search_radius](#search_radius) manually @@ -532,7 +535,7 @@ These variables are used to control general system parameters. - 1: Symmetry analysis will be performed to determine the type of Bravais lattice and associated symmetry operations. (point groups, space groups, primitive cells, and irreducible k-points) - **Default**: - 0: - - if [calculation](#calculation)==md/nscf/get_pchg/get_wf/get_S or [gamma_only](#gamma_only)==True; + - if [calculation](#calculation)==md/nscf/get_pchg/get_wf/get_s or [gamma_only](#gamma_only)==True; - If ([dft_fuctional](#dft_functional)==hse/hf/pbe0/scan0/opt_orb or [rpa](#rpa)==True). - If [efield_flag](#efield_flag)==1 - 1: else @@ -658,8 +661,8 @@ These variables are used to control general system parameters. - **Description**: Set the smallest allowed spacing between k points, unit in 1/bohr. It should be larger than 0.0, and suggest smaller than 0.25. When you have set this value > 0.0, then the KPT file is unnecessary, and the number of K points nk_i = max(1, int(|b_i|/KSPACING_i)+1), where b_i is the reciprocal lattice vector. The default value 0.0 means that ABACUS will read the applied KPT file. If only one value is set (such as `kspacing 0.5`), then kspacing values of a/b/c direction are all set to it; and one can also set 3 values to set the kspacing value for a/b/c direction separately (such as: `kspacing 0.5 0.6 0.7`). - Note: if gamma_only is set to be true, kspacing is invalid. - **Default**: 0.0 +- **Note**: If gamma_only is set to be true, kspacing is invalid. ### min_dist_coef @@ -791,9 +794,8 @@ These variables are used to control the plane wave related parameters. - **Type**: Integer - **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutrho. - - Note: You must specify all three dimensions for this setting to be used. - **Default**: 0 +- **Note**: You must specify all three dimensions for this setting to be used. ### ndx, ndy, ndz @@ -801,7 +803,6 @@ These variables are used to control the plane wave related parameters. - **Description**: If set to a positive number, then the three variables specify the numbers of FFT grid (for the dense part of charge density in ultrasoft pseudopotential) points in x, y, z directions, respectively. If set to 0, the number will be calculated from ecutwfc. Note: You must specify all three dimensions for this setting to be used. - Note: These parameters must be used combined with [nx,ny,nz](#nx-ny-nz). If [nx,ny,nz](#nx-ny-nz) are unset, ndx,ndy,ndz are used as [nx,ny,nz](#nx-ny-nz). - **Default**: 0 @@ -824,6 +825,18 @@ These variables are used to control the plane wave related parameters. - **Description**: If `TRUE`, the smooth threshold strategy, which applies a larger threshold (10e-5) for the empty states, will be implemented in the diagonalization methods. (This strategy should not affect total energy, forces, and other ground-state properties, but computational efficiency will be improved.) If `FALSE`, the smooth threshold strategy will not be applied. - **Default**: false +### use_k_continuity + +- **Type**: Boolean +- **Availability**: Used only for plane wave basis set. +- **Description**: Whether to use k-point continuity for initializing wave functions. When enabled, this strategy exploits the similarity between wavefunctions at neighboring k-points by propagating the wavefunction from a previously initialized k-point to a new k-point, significantly reducing the computational cost of the initial guess. + + **Important constraints:** + - Must be used together with `diago_smooth_ethr = 1` for optimal performance + + This feature is particularly useful for calculations with dense k-point sampling where the computational cost of wavefunction initialization becomes significant. +- **Default**: false + ### pw_diag_nmax - **Type**: Integer @@ -1050,6 +1063,26 @@ calculations. - **Default**: 0.0 - **Unit**: Ry +### xc_exch_ext + +- **Type**: Integer Real ... +- **Description**: Customized parameterization on the exchange part of XC functional. The first value should be the LibXC ID of the original functional, and latter values are external parameters. Default values are those of Perdew-Burke-Ernzerhof (PBE) functional. For more information on LibXC ID of functionals, please refer to [LibXC](https://libxc.gitlab.io/functionals/). For parameters of functionals of interest, please refer to the source code of LibXC, such as PBE functional interface in LibXC: [gga_x_pbe.c](https://gitlab.com/libxc/libxc/-/blob/7.0.0/src/gga_x_pbe.c). +- **Default**: 101 0.8040 0.2195149727645171 +- **Note**: + 1. Solely setting this keyword will take no effect on XC functionals. One should also set `dft_functional` to corresponding functional to apply the customized parameterization. For example, if you want to use the PBE functional with customized parameters, you should set `dft_functional` to `GGA_X_PBE+GGA_C_PBE` and `xc_exch_ext` to `101 0.8040 0.2195149727645171`. + 2. For functionals that do not have separate exchange and correlation parts, such as HSE06 whose corresponding LibXC notation is `HYB_GGA_XC_HSE06` and LibXC id is 428, you can set either `xc_exch_ext` or `xc_corr_ext` to `428 0.25 0.11 0.11` (which means 25% Hartree-Fock fraction, 0.11 as range-seperation) and leave the other one unset. + 3. Presently this feature can only support parameterization on **one** exchange functional. + +### xc_corr_ext + +- **Type**: Integer Real ... +- **Description**: Customized parameterization on the correlation part of XC functional. The first value should be the LibXC ID of the original functional, and latter values are external parameters. Default values are those of Perdew-Burke-Ernzerhof (PBE) functional. For more information on LibXC ID of functionals, please refer to [LibXC](https://libxc.gitlab.io/functionals/). For parameters of functionals of interest, please refer to the source code of LibXC, such as PBE functional interface in LibXC: [gga_c_pbe.c](https://gitlab.com/libxc/libxc/-/blob/7.0.0/src/gga_c_pbe.c). +- **Default**: 130 0.06672455060314922 0.031090690869654895034 1.0 +- **Note**: + 1. Solely setting this keyword will take no effect on XC functionals. One should also set `dft_functional` to corresponding functional to apply the customized parameterization. For example, if you want to use the PBE functional with customized parameters, you should set `dft_functional` to `GGA_X_PBE+GGA_C_PBE` and `xc_corr_ext` to `130 0.06672455060314922 0.031090690869654895034 1.0`. + 2. For functionals that do not have separate exchange and correlation parts, such as HSE06 whose corresponding LibXC notation is `HYB_GGA_XC_HSE06` and LibXC id is 428, you can set either `xc_exch_ext` or `xc_corr_ext` to `428 0.25 0.11 0.11` (which means 25% Hartree-Fock fraction, 0.11 as range-seperation) and leave the other one unset. + 3. Presently this feature can only support parameterization on **one** correlation functional. + ### pseudo_rcut - **Type**: Real @@ -1587,13 +1620,6 @@ These variables are used to control the geometry relaxation. These variables are used to control the output of properties. -### out_mul - -- **Type**: Boolean -- **Availability**: Numerical atomic orbital basis -- **Description**: Whether to print the Mulliken population analysis result into `OUT.${suffix}/mulliken.txt`. In molecular dynamics calculations, the output frequency is controlled by [out_interval](#out_interval). -- **Default**: False - ### out_freq_elec - **Type**: Integer @@ -1625,7 +1651,26 @@ These variables are used to control the output of properties. In molecular dynamics simulations, the output frequency is controlled by [out_interval](#out_interval). - **Default**: 0 3 -- **NOTE**: In the 3.10-LTS version, the file names are SPIN1_CHG.cube and SPIN1_CHG_INI.cube, etc. +- **Note**: In the 3.10-LTS version, the file names are SPIN1_CHG.cube and SPIN1_CHG_INI.cube, etc. + +### out_xc_r + +- **Type**: Integer \[Integer\](optional) +- **Description**: + The first integer controls whether to output the exchange-correlation (in Bohr^-3) on real space grids using Libxc to folder `OUT.${suffix}`: + - 0: rho, amag, sigma, exc + - 1: vrho, vsigma + - 2: v2rho2, v2rhosigma, v2sigma2 + - 3: v3rho3, v3rho2sigma, v3rhosigma2, v3sigma3 + - 4: v4rho4, v4rho3sigma, v4rho2sigma2, v4rhosigma3, v4sigma4 + The meaning of the files is presented in [Libxc](https://libxc.gitlab.io/manual/libxc-5.1.x/) + + The second integer controls the precision of the charge density output, if not given, will use `3` as default. + + --- + The circle order of the charge density on real space grids is: x is the outer loop, then y and finally z (z is moving fastest). + +- **Default**: -1 3 ### out_pot @@ -1644,9 +1689,9 @@ These variables are used to control the output of properties. In molecular dynamics calculations, the output frequency is controlled by [out_interval](#out_interval). - **Default**: 0 -- **NOTE**: In the 3.10-LTS version, the file names are SPIN1_POT.cube and SPIN1_POT_INI.cube, etc. +- **Note**: In the 3.10-LTS version, the file names are SPIN1_POT.cube and SPIN1_POT_INI.cube, etc. -### out_dm +### out_dmk - **Type**: Boolean - **Availability**: Numerical atomic orbital basis @@ -1658,9 +1703,9 @@ These variables are used to control the output of properties. - nspin = 1: `dms1k1_nao.csr`, `dms1k2_nao.csr`, ...; - nspin = 2: `dms1k1_nao.csr`... and `dms2k1_nao.csr`... for the two spin channels. - **Default**: False -- **NOTE**: In the 3.10-LTS version, the file names are SPIN1_DM and SPIN2_DM, etc. +- **Note**: In the 3.10-LTS version, the parameter is named `out_dm` and the file names are SPIN1_DM and SPIN2_DM, etc. -### out_dm1 +### out_dmr - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (multi-k points) @@ -1668,7 +1713,7 @@ These variables are used to control the output of properties. - nspin = 1: `dmrs1_nao.csr`; - nspin = 2: `dmrs1_nao.csr` and `dmrs2_nao.csr` for the two spin channels. - **Default**: False -- **NOTE**: In the 3.10-LTS version, the file names are data-DMR-sparse_SPIN0.csr and data-DMR-sparse_SPIN1.csr, etc. +- **Note**: In the 3.10-LTS version, the parameter is named `out_dm1`, and the file names are data-DMR-sparse_SPIN0.csr and data-DMR-sparse_SPIN1.csr, etc. ### out_wfc_pw @@ -1681,7 +1726,7 @@ These variables are used to control the output of properties. - 2: (binary format) - non-gamma-only: `wfs1k1_pw.dat` or `wfs1k2_pw.dat`, .... - **Default**: 0 -- **NOTE**: In the 3.10-LTS version, the file names are OUT.${suffix}/WAVEFUNC${K}.dat, etc. +- **Note**: In the 3.10-LTS version, the file names are WAVEFUNC1.dat, WAVEFUNC2.dat, etc. ### out_wfc_lcao @@ -1700,14 +1745,16 @@ These variables are used to control the output of properties. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). - **Default**: False -- **NOTE**: In the 3.10-LTS version, the file names are WFC_NAO_GAMMA1_ION1.txt and WFC_NAO_K1_ION1.txt, etc. +- **Note**: In the 3.10-LTS version, the file names are WFC_NAO_GAMMA1_ION1.txt and WFC_NAO_K1_ION1.txt, etc. ### out_dos - **Type**: Integer - **Description**: Whether to output the density of states (DOS). For more information, refer to the [dos.md](../elec_properties/dos.md). - 0: no output - - 1: output the density of states (DOS) + - 1: output the density of states (DOS) + - nspin=1 or 4: `doss1g{geom}_{basis}.txt`, where geom is the geometry index when cell changes or ions move while basis is either `pw` or `nao`. + - nspin=2: `doss1g{geom}_{basis}.txt` and `doss2g{geom}_{basis}.txt` for two spin channles. - 2: (LCAO) output the density of states (DOS) and the projected density of states (PDOS) - 3: output the Fermi surface file (fermi.bxsf) in BXSF format that can be visualized by XCrySDen - **Default**: 0 @@ -1773,65 +1820,90 @@ These variables are used to control the output of properties. - **Type**: Boolean \[Integer\](optional) - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to print the upper triangular part of the Hamiltonian matrices (in Ry) and overlap matrices for each k point into files in the directory `OUT.${suffix}`. The second number controls precision. For more information, please refer to [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs). Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). +- **Description**: Whether to print the upper triangular part of the Hamiltonian matrices and overlap matrices for each k-point into files in the directory `OUT.${suffix}`. The second number controls precision. For more information, please refer to [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs). Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). + - For gamma only case: + - nspin = 1: `hks1_nao.txt` for the Hamiltonian matrix and `sks1_nao.txt` for the overlap matrix; + - nspin = 2: `hks1_nao.txt` and `hks2_nao.txt` for the Hamiltonian matrix and `sks1_nao.txt` for the overlap matrix. Note that the code will not output `sks2_nao.txt` because it is the same as `sks1_nao.txt`; + - nspin = 4: `hks12_nao.txt` for the Hamiltonian matrix and `sks12_nao.txt` for the overlap matrix. + - For multi-k points case: + - nspin = 1: `hks1k1_nao.txt` for the Hamiltonian matrix at the 1st k-point, and `sks1k1_nao.txt` for the overlap matrix for the 1st k-point, ...; + - nspin = 2: `hks1k1_nao.txt` and `hks2k1_nao.txt` for the two spin channels of the Hamiltonian matrix at the 1st k-point, and `sks1k1_nao.txt` for the overlap matrix for the 1st k-point. Note that the code will not output `sks2k1_nao.txt` because it is the same as `sks1k1_nao.txt`, ...; + - nspin = 4: `hks12k1_nao.txt` for the Hamiltonian matrix at the 1st k-point, and `sks12k1_nao.txt` for the overlap matrix for the 1st k-point, ...; - **Default**: False 8 +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc. + +### out_mat_hs2 + +- **Type**: Boolean +- **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) +- **Description**: Whether to print files containing the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ into files in the directory `OUT.${suffix}`. For more information, please refer to [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs2). +- **Default**: False +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file names are data-HR-sparse_SPIN0.csr and data-SR-sparse_SPIN0.csr, etc. ### out_mat_tk - **Type**: Boolean \[Integer\](optional) - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to print the upper triangular part of the kinetic matrices (in Ry) for each k point into `OUT.${suffix}/data-i-T`, where i is the index of k points (see `OUT.${suffix}/kpoints`). One may optionally provide a second parameter to specify the precision. +- **Description**: Whether to print the upper triangular part of the kinetic matrices for each k-point into `OUT.${suffix}/tks1ki_nao.txt`, where i is the index of k points. One may optionally provide a second parameter to specify the precision. - **Default**: False \[8\] +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file names are data-TR-sparse_SPIN0.csr and data-TR-sparse_SPIN0.csr, etc. ### out_mat_r - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: Whether to print the matrix representation of the position matrix (in Bohr) into a file named `data-rR-tr` in the directory `OUT.${suffix}`. If [calculation](#calculation) is set to `get_S`, the position matrix can be obtained without scf iterations. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices). -- **Default**: False - -### out_mat_hs2 - -- **Type**: Boolean -- **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: Whether to print files containing the Hamiltonian matrix $H(R)$ (in Ry) and overlap matrix $S(R)$ into files in the directory `OUT.${suffix}`. For more information, please refer to [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs2). +- **Description**: Whether to print the matrix representation of the position matrix into a file named `rr.csr` in the directory `OUT.${suffix}`. If [calculation](#calculation) is set to `get_s`, the position matrix can be obtained without scf iterations. For more information, please refer to [position_matrix.md](../elec_properties/position_matrix.md#extracting-position-matrices). - **Default**: False +- **Unit**: Bohr +- **Note**: In the 3.10-LTS version, the file name is data-rR-sparse.csr. ### out_mat_t - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: For LCAO calculations, if out_mat_t is set to 1, ABACUS will generate files containing the kinetic energy matrix $T(R)$ (in Ry). The format will be the same as the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ as mentioned in [out_mat_hs2](#out_mat_hs2). The name of the files will be `data-TR-sparse_SPIN0.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). +- **Description**: Generate files containing the kinetic energy matrix $T(R)$. The format will be the same as the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ as mentioned in [out_mat_hs2](#out_mat_hs2). The name of the files will be `trs1.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). - **Default**: False +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file name is data-TR-sparse_SPIN0.csr. ### out_mat_dh - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: Whether to print files containing the derivatives of the Hamiltonian matrix (in Ry/Bohr). The format will be the same as the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ as mentioned in [out_mat_hs2](#out_mat_hs2). The name of the files will be `data-dHRx-sparse_SPIN0.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). +- **Description**: Whether to print files containing the derivatives of the Hamiltonian matrix. The format will be the same as the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ as mentioned in [out_mat_hs2](#out_mat_hs2). The name of the files will be `dhrxs1.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). - **Default**: False +- **Unit**: Ry/Bohr +- **Note**: In the 3.10-LTS version, the file name is data-dHRx-sparse_SPIN0.csr and so on. ### out_mat_ds - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (not gamma-only algorithm) -- **Description**: Whether to print files containing the derivatives of the Overlap matrix (in Ry/Bohr). The format will be the same as the Overlap matrix $dH(R)$ as mentioned in [out_mat_dh](#out_mat_dh). The name of the files will be `data-dSRx-sparse_SPIN0.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). This feature can be used with `calculation get_S`. +- **Description**: Whether to print files containing the derivatives of the overlap matrix. The format will be the same as the overlap matrix $dH(R)$ as mentioned in [out_mat_dh](#out_mat_dh). The name of the files will be `dsrxs1.csr` and so on. Also controled by [out_interval](#out_interval) and [out_app_flag](#out_app_flag). This feature can be used with `calculation get_s`. - **Default**: False +- **Unit**: Ry/Bohr +- **Note**: In the 3.10-LTS version, the file name is data-dSRx-sparse_SPIN0.csr and so on. ### out_mat_xc - **Type**: Boolean - **Availability**: Numerical atomic orbital (NAO) and NAO-in-PW basis -- **Description**: Whether to print the upper triangular part of the exchange-correlation matrices in **Kohn-Sham orbital representation** (unit: Ry): $\braket{\psi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\psi_j}$ for each k point into files in the directory `OUT.${suffix}`, which is useful for the subsequent GW calculation. (Note that currently DeePKS term is not included. ) The files are named `k-$k-Vxc`, the meaning of `$k`corresponding to k point and spin is same as [hs_matrix.md](../elec_properties/hs_matrix.md#out_mat_hs). -The band (KS orbital) energy for each (k-point, spin, band) will be printed in the file `OUT.${suffix}/vxc_out.dat`. If EXX is calculated, the local and EXX part of band energy will also be printed in `OUT.${suffix}/vxc_local_out.dat`and `OUT.${suffix}/vxc_exx_out.dat`, respectively. All the `vxc*_out.dat` files contains 3 integers (nk, nspin, nband) followed by nk\*nspin\*nband lines of energy Hartree and eV. +- **Description**: Whether to print the upper triangular part of the exchange-correlation matrices in Kohn-Sham orbital representation: $\braket{\psi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\psi_j}$ for each k point into files in the directory `OUT.${suffix}`, which is useful for the subsequent GW calculation (the code is still under development). (Note that currently DeePKS term is not included.) The files are named `vxcs1k$i_nao.txt`, where `$i` corresponds to the k point index. The band (KS orbital) energy for each (k-point, spin, band) will be printed in the file `OUT.${suffix}/vxc_out.dat`. If EXX is calculated, the local and EXX part of band energy will also be printed in `OUT.${suffix}/vxc_local_out.dat`and `OUT.${suffix}/vxc_exx_out.dat`, respectively. All the `vxc*_out.dat` files contains 3 integers (nk, nspin, nband) followed by nk\*nspin\*nband lines of energy Hartree and eV. - **Default**: False +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file name is k-$k-Vxc and so on. ### out_mat_xc2 - **Type**: Boolean - **Availability**: Numerical atomic orbital (NAO) basis -- **Description**: Whether to print the exchange-correlation matrices in **numerical orbital representation** (unit: Ry): $\braket{\phi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\phi_j}(\mathbf{R})$ in CSR format (the same format as [out_mat_hs2](../elec_properties/hs_matrix.md#out_mat_hs2)) in the directory `OUT.${suffix}`. (Note that currently DeePKS term is not included. ) The files are named `Vxc_R_spin$s`. +- **Description**: Whether to print the exchange-correlation matrices in numerical orbital representation: $\braket{\phi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\phi_j}(\mathbf{R})$ in CSR format in the directory `OUT.${suffix}`. (Note that currently DeePKS term is not included. ) The files are named `Vxc_R_spin$s`. - **Default**: False +- **Unit**: Ry +- **Note**: In the 3.10-LTS version, the file name is Vxc_R_spin$s and so on. ### out_mat_l @@ -1847,18 +1919,18 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t - **Description**: Whether to print the band energy terms separately in the file `OUT.${suffix}/${term}_out.dat`. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated). - **Default**: False -### out_hr_npz/out_dm_npz (Under Development Feature) +### dm_to_rho (Under Development Feature) - **Type**: Boolean - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to print Hamiltonian matrices $H(R)$/density matrics $DM(R)$ in npz format. This feature does not work for gamma-only calculations. +- **Description**: Reads density matrix $DM(R)$ in npz format and creates electron density on grids. This feature does not work for gamma-only calculations. Only supports serial calculations. - **Default**: False -### dm_to_rho (Under Development Feature) +### out_mul - **Type**: Boolean - **Availability**: Numerical atomic orbital basis -- **Description**: Reads density matrix $DM(R)$ in npz format and creates electron density on grids. This feature does not work for gamma-only calculations. Only supports serial calculations. +- **Description**: Whether to print the Mulliken population analysis result into `OUT.${suffix}/mulliken.txt`. In molecular dynamics calculations, the output frequency is controlled by [out_interval](#out_interval). - **Default**: False ### out_app_flag @@ -1878,7 +1950,7 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t ### out_interval - **Type**: Integer -- **Description**: Control the interval for printing charge density, local potential, electrostatic potential, Mulliken population analysis, $r(R)$, $H(R)$, $S(R)$, $T(R)$, $dH(R)$, $H(k)$, $S(k)$ and $\psi(k)$ matrices during molecular dynamics calculations. Check input parameters [out_chg](#out_chg), [out_pot](#out_pot), [out_mul](#out_mul), [out_mat_r](#out_mat_r), [out_mat_hs2](#out_mat_hs2), [out_mat_t](#out_mat_t), [out_mat_dh](#out_mat_dh), [out_mat_hs](#out_mat_hs) and [out_wfc_lcao](#out_wfc_lcao) for more information, respectively. +- **Description**: After self-consistent-field calculations, control the interval of ionic movements for printing properties. These properties cover charge density, local potential, electrostatic potential, Hamiltonian matrix, overlap matrix, density matrix, Mulliken population analysis and so on. - **Default**: 1 ### out_element_info @@ -2348,8 +2420,29 @@ Warning: this function is not robust enough for the current version. Please try ### of_ml_gene_data - **Type**: Boolean -- **Availability**: OFDFT -- **Description**: Generate training data or not. +- **Availability**: Used only for KSDFT with plane wave basis +- **Description**: Controls the generation of machine learning training data. When enabled, training data in `.npy` format will be saved in the directory `OUT.${suffix}/MLKEDF_Descriptors/`. The generated descriptors are categorized as follows: + - Local/Semilocal Descriptors. Files are named as `{var}.npy`, where `{var}` corresponds to the descriptor type: + - `gamma`: Enabled by [of_ml_gamma](#of_ml_gamma) + - `p`: Enabled by [of_ml_p](#of_ml_p) + - `q`: Enabled by [of_ml_q](#of_ml_q) + - `tanhp`: Enabled by [of_ml_tanhp](#of_ml_tanhp) + - `tanhq`: Enabled by [of_ml_tanhq](#of_ml_tanhq) + - Nonlocal Descriptors generated using kernels configured via [of_ml_nkernel](#of_ml_nkernel), [of_ml_kernel](#of_ml_kernel), and [of_ml_kernel_scaling](#of_ml_kernel_scaling). Files follow the naming convention `{var}_{kernel_type}_{kernel_scaling}.npy`, where `{kernel_type}` and `{kernel_scaling}` are specified by [of_ml_kernel](#of_ml_kernel), and [of_ml_kernel_scaling](#of_ml_kernel_scaling), respectively, and `{val}` denotes the kind of the descriptor, including + - `gammanl`: Enabled by [of_ml_gammanl](#of_ml_gammanl) + - `pnl`: Enabled by [of_ml_pnl](#of_ml_pnl) + - `qnl`: Enabled by [of_ml_qnl](#of_ml_qnl) + - `xi`: Enabled by [of_ml_xi](#of_ml_xi) + - `tanhxi`: Enabled by [of_ml_tanhxi](#of_ml_tanhxi) + - `tanhxi_nl`: Enabled by [of_ml_tanhxi_nl](#of_ml_tanhxi_nl) + - `tanh_pnl`: Enabled by [of_ml_tanh_pnl](#of_ml_tanh_pnl) + - `tanh_qnl`: Enabled by [of_ml_tanh_qnl](#of_ml_tanh_qnl) + - `tanhp_nl`: Enabled by [of_ml_tanhp_nl](#of_ml_tanhp_nl) + - `tanhq_nl`: Enabled by [of_ml_tanhq_nl](#of_ml_tanhq_nl) + - Training Targets, including key quantum mechanical quantities: + - `enhancement.npy`: Pauli energy enhancement factor $T_\theta/T_{\rm{TF}}$, where $T_{\rm{TF}}$ is the Thomas-Fermi functional + - `pauli.npy`: Pauli potential $V_\theta$ + - `veff.npy`: Effective potential - **Default**: False ### of_ml_device @@ -4441,4 +4534,4 @@ The physical quantities that RDMFT temporarily expects to output are the kinetic - **Description**: The alpha parameter of power-functional(or other exx-type/hybrid functionals) which used in RDMFT, g(occ_number) = occ_number^alpha - **Default**: 0.656 -[back to top](#full-list-of-input-keywords) +[back to top](#full-list-of-input-keywords) \ No newline at end of file diff --git a/source/module_esolver/esolver_fp.cpp b/source/module_esolver/esolver_fp.cpp index efba93c746..78afaf8b88 100644 --- a/source/module_esolver/esolver_fp.cpp +++ b/source/module_esolver/esolver_fp.cpp @@ -17,7 +17,10 @@ #include "module_io/write_elecstat_pot.h" #include "module_io/write_elf.h" #include "module_parameter/parameter.h" + +#ifdef USE_LIBXC #include "module_io/write_libxc_r.h" +#endif namespace ModuleESolver { @@ -256,6 +259,7 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso PARAM.inp.out_elf[1]); } +#ifdef USE_LIBXC // 7) write xc(r) if(PARAM.inp.out_xc_r[0]>=0) { @@ -269,6 +273,7 @@ void ESolver_FP::after_scf(UnitCell& ucell, const int istep, const bool conv_eso *this->pw_big, *this->pw_rhod); } +#endif } } diff --git a/source/module_io/read_input_item_output.cpp b/source/module_io/read_input_item_output.cpp index 02710a2565..d32ac322b0 100644 --- a/source/module_io/read_input_item_output.cpp +++ b/source/module_io/read_input_item_output.cpp @@ -553,10 +553,16 @@ void ReadInput::item_output() size_t count = item.get_size(); std::vector out_xc_r(count); // create a placeholder vector std::transform(item.str_values.begin(), item.str_values.end(), out_xc_r.begin(), [](std::string s) { return std::stoi(s); }); - std::cout<= 0) + { +#ifndef USE_LIBXC + ModuleBase::WARNING_QUIT("ReadInput", "INPUT out_xc_r is only aviailable with Libxc"); +#endif + } }; sync_intvec(input.out_xc_r, 2, -1); this->add_item(item); diff --git a/source/module_io/write_libxc_r.cpp b/source/module_io/write_libxc_r.cpp index 6ca031109e..23c181d253 100644 --- a/source/module_io/write_libxc_r.cpp +++ b/source/module_io/write_libxc_r.cpp @@ -202,10 +202,7 @@ void ModuleIO::write_libxc_r( std::ofstream ofs; if(GlobalV::MY_RANK==0) { - const std::string folder_name = PARAM.globalv.global_out_dir + "/xc_r/"; - const std::string command0 = "test -d " + folder_name + " || mkdir " + folder_name; - system( command0.c_str() ); - const std::string file_name = folder_name + data_name+"_"+std::to_string(is); + const std::string file_name = PARAM.globalv.global_out_dir + "xc_"+data_name+"_s"+std::to_string(is+1)+".cube"; ofs.open(file_name); ofs.unsetf(std::ostream::fixed);