|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Charge-density symmetrization free functions. More...
Namespaces | |
| namespace | detail |
Classes | |
| struct | AtomicRhoCfg |
| Configuration for atomic_rho, replacing GlobalV/PARAM reads. More... | |
| class | Charge_Extra |
| charge extrapolation method More... | |
| struct | InitRhoCfg |
| struct | ScfMixingCtx |
| Aggregated SCF convergence thresholds and status flags for chgmixing_ks. More... | |
| struct | NlcCtx |
| Radial grid and density data for non-linear core correction. More... | |
Functions | |
| void | atomic_rho (const int spin_number_need, const double &omega, double **rho_in, const ModuleBase::ComplexMatrix &strucFac, const UnitCell &ucell, const ModulePW::PW_Basis *rhopw, const AtomicRhoCfg &cfg) |
| void | init_mixing_dmr (Base_Mixing::Mixing *mixing, Base_Mixing::Mixing_Data &mdata, const int nnr, const MixingConfig &cfg) |
| Allocate the mixing buffer for the real-space density matrix and clear its history. | |
| void | mix_dmr (const std::vector< double * > &dmr_out, const std::vector< const double * > &dmr_in, const int nnr, Base_Mixing::Mixing *mixing, Base_Mixing::Mixing_Data &mdata, const MixingConfig &cfg) |
| Mix the real-space density matrix (LCAO calculations only). | |
| double | cal_drho (Charge *chr, const double nelec, const ModulePW::PW_Basis &rhopw, const MixingConfig &cfg, const double omega, const double tpiba) |
| Charge residual between chr->rho and chr->rho_save, normalized per electron. | |
| double | cal_dkin (Charge *chr, const double nelec, const ModulePW::PW_Basis &rhopw, const MixingConfig &cfg, const double omega) |
| Kinetic-energy-density residual between chr->kin_r and chr->kin_r_save. | |
| double | inner_product_real (const double *rho1, const double *rho2, const ModulePW::PW_Basis &rhopw, const MixingConfig &cfg) |
| Inner product of two real-space vectors used in real-space mixing. | |
| double | inner_product_recip_hartree (const std::complex< double > *rhog1, const std::complex< double > *rhog2, const ModulePW::PW_Basis &rhopw, const MixingConfig &cfg, const double omega, const double tpiba) |
| Hartree-like reciprocal inner product used in charge mixing. | |
| void | init_rho (Charge &chr, const ModulePW::PW_Basis &rhopw, const UnitCell &ucell, const Parallel_Grid &pgrid, const ModuleBase::ComplexMatrix &strucFac, ModuleSymmetry::Symmetry &symm, const void *klist, const void *wfcpw, const InitRhoCfg &cfg) |
| Initialize charge density from file, atomic superposition, restart cache, or wavefunctions, depending on cfg.init_chg. | |
| void | reduce_diff_pools (double *array_rho, const Charge &chr, const int kpar, const bool all_ks_run, const int bndpar) |
| Reduce a real-space array across k-point pools and band groups. | |
| void | rho_mpi (Charge &chr, const int kpar, const bool all_ks_run, const int bndpar, const int nspin) |
| Reduce rho across pools; also reduce kin_r when its buffer is allocated (meta-GGA functionals, or ELF output requested). | |
| void | kin_r_mpi (Charge &chr, const int kpar, const bool all_ks_run, const int bndpar, const int nspin) |
| Reduce kin_r across pools when its buffer is allocated (meta-GGA functionals, or ELF output requested). | |
| void | kerker_screen_recip (const MixingConfig &cfg, ModulePW::PW_Basis *rhopw, double tpiba, std::complex< double > *drhog) |
| Apply Kerker screening in reciprocal space. | |
| void | kerker_screen_real (const MixingConfig &cfg, ModulePW::PW_Basis *rhopw, double tpiba, double *drhor) |
| Apply Kerker screening in real space via FFT. | |
| void | write_density_restart (Charge &charge, ModulePW::PW_Basis &pw_rhod, const ModuleBase::Matrix3 &reciprocal_lattice, const std::string &prefix, const int nspin, const bool enabled, const bool gamma_only, const bool write_tau, const bool writer_pool, const Parallel::ParaWorld &pw_world, std::ostream *warning) |
| Write saved charge and optional kinetic-energy densities in reciprocal space. | |
| bool | read_rhog (const std::string &filename, const ModulePW::PW_Basis *pw_rhod, const int nspin, std::complex< double > **rhog, const Parallel::ParaWorld &pw_world, std::ostream *os_warning) |
| bool | has_complete_charge_cubes (const std::string &directory, const int nspin, const Parallel::ParaWorld &world) |
| Collectively select the complete cube set; partial sets fall back to restart. | |
| bool | read_rho_from_binary (const std::string &filename, const ModulePW::PW_Basis &rhopw, const int nspin, std::complex< double > **rhog, double **rho, const Parallel::ParaWorld &pw_world, std::ostream &log) |
| 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 Parallel::ParaWorld &pw_world, std::ostream *os_warning) |
| bool | update_pot_model (const int iter, const double drho, const K_Vectors &kv, elecstate::Potential &pot, Charge_Mixing *p_chgmix) |
| void | print_corr_iter (const K_Vectors &kv, const int sccs_debug, const double drho, const elecstate::Potential &pot) |
| void | chgmixing_ks (const int iter, UnitCell &ucell, elecstate::ElecState *pelec, Charge &chr, const ModulePW::PW_Basis &rhopw, Charge_Mixing *p_chgmix, ScfMixingCtx &ctx, const Input_para &inp) |
| void | chgmixing_ks_pw (const int iter, const int iter_limit, Charge_Mixing *p_chgmix, Plus_U_Base &dftu, const bool mag_converged, const Input_para &inp) |
| void | chgmixing_ks_lcao (const int iter, const int iter_limit, Charge_Mixing *p_chgmix, Plus_U_Base &dftu, const int nnr, const Input_para &inp) |
| void | symmetrize_rho (const int nspin, const Charge &chr, const ModulePW::PW_Basis *pw, ModuleSymmetry::Symmetry &symm) |
| Symmetrize charge density for all spin channels. | |
| void | cal_rhog_symm (const int &spin_now, const Charge &CHR, const ModulePW::PW_Basis *pw, ModuleSymmetry::Symmetry &symm) |
| Symmetrize one spin channel of the charge density. | |
| void | cal_rhog_symm (const int &spin_now, double **rho, std::complex< double > **rhog, int ngmc, double **kin_r, const ModulePW::PW_Basis *pw, ModuleSymmetry::Symmetry &symm) |
| Symmetrize one spin channel of raw density arrays. | |
| void | cal_rhog_symm_soc (double **rho, std::complex< double > **rhog, const ModulePW::PW_Basis *pw, ModuleSymmetry::Symmetry &symm) |
| Symmetrize raw nspin=4 spin-density arrays with coupled spin rotations. | |
| double | sum_rho (double *const *rho, const int nspin0, const int nrxx, const double omega, const int nxyz) |
| double | cal_rho2ne (const double *rho_in, const int nrxx, const double omega, const int nxyz) |
| void | check_rho (double *const *rho, const int nspin, const int nrxx, const double omega, const int nxyz, const double nelec) |
| void | non_linear_core_correction (const NlcCtx &ctx, double *rhocg) |
| void | set_rho_core (const UnitCell &ucell, const ModuleBase::ComplexMatrix &structure_factor, const bool *numeric, double *rho_core, std::complex< double > *rhog_core, const ModulePW::PW_Basis &rhopw) |
| double | core_charge_form_factor (int mesh, const double *r, const double *rab, const double *rho_atc, double omega, double k, std::vector< double > &scratch) |
| void | set_drho_core (const UnitCell &ucell, int iat, int dir, const ModuleBase::Vector3< double > &q_cart, const ModulePW::PW_Basis &rhopw, std::vector< std::complex< double > > &drhoc_g) |
| void | split_dgrid (const std::complex< double > *data_d, std::vector< std::complex< double > > &data_s, std::vector< std::complex< double > > &data_hf, int nspin, int npw_smooth, int npw_dense) |
| Split dense reciprocal-space data into smooth and high-frequency parts on the USPP double grid. | |
| void | merge_dgrid (std::complex< double > *data_d, const std::vector< std::complex< double > > &data_s, const std::vector< std::complex< double > > &data_hf, int nspin, int npw_smooth, int npw_dense) |
| Merge smooth and high-frequency parts back into dense reciprocal- space data. Inverse of split_dgrid. | |
Charge-density symmetrization free functions.
Internal reciprocal-space helpers for charge-density symmetrization.
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:
The functions are stateless: every input is passed explicitly. The reciprocal-space helpers shared between translation units live in module_charge::detail (see chg_symm_detail.h).
Not part of the public module_charge API: only chg_symm.cpp and chg_symm_detail.cpp are expected to include this header.
| void module_charge::atomic_rho | ( | const int | spin_number_need, |
| const double & | omega, | ||
| double ** | rho_in, | ||
| const ModuleBase::ComplexMatrix & | strucFac, | ||
| const UnitCell & | ucell, | ||
| const ModulePW::PW_Basis * | rhopw, | ||
| const AtomicRhoCfg & | cfg ) |
| double module_charge::cal_dkin | ( | Charge * | chr, |
| const double | nelec, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| const MixingConfig & | cfg, | ||
| const double | omega ) |
Kinetic-energy-density residual between chr->kin_r and chr->kin_r_save.
| chr | charge object supplying kin_r/kin_r_save |
| nelec | number of electrons, used to normalize the residual |
| rhopw | plane-wave basis supplying the real-space grid size |
| cfg | mixing config (nspin and magnetization flags select the loops) |
| omega | cell volume, used to normalize the residual |
| double module_charge::cal_drho | ( | Charge * | chr, |
| const double | nelec, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| const MixingConfig & | cfg, | ||
| const double | omega, | ||
| const double | tpiba ) |
Charge residual between chr->rho and chr->rho_save, normalized per electron.
| chr | charge object supplying rho/rho_save (and rhog buffers for the reciprocal case) |
| nelec | number of electrons, used to normalize the real-space residual |
| rhopw | plane-wave basis supplying the real/reciprocal grid sizes |
| cfg | mixing config (nspin, scf_thr_type and magnetization flags select the loops) |
| omega | cell volume, used to normalize the real-space residual |
| tpiba | 2*pi/lattice constant, used by the reciprocal metric |
| double module_charge::cal_rho2ne | ( | const double * | rho_in, |
| const int | nrxx, | ||
| const double | omega, | ||
| const int | nxyz ) |
| void module_charge::cal_rhog_symm | ( | const int & | spin_now, |
| const Charge & | CHR, | ||
| const ModulePW::PW_Basis * | pw, | ||
| ModuleSymmetry::Symmetry & | symm ) |
Symmetrize one spin channel of the charge density.
The kinetic-energy density kin_r is symmetrized as well whenever its buffer is allocated (meta-GGA functionals, or ELF output requested).
| void module_charge::cal_rhog_symm | ( | const int & | spin_now, |
| double ** | rho, | ||
| std::complex< double > ** | rhog, | ||
| int | ngmc, | ||
| double ** | kin_r, | ||
| const ModulePW::PW_Basis * | rho_basis, | ||
| ModuleSymmetry::Symmetry & | symm ) |
Symmetrize one spin channel of raw density arrays.
| void module_charge::cal_rhog_symm_soc | ( | double ** | rho, |
| std::complex< double > ** | rhog, | ||
| const ModulePW::PW_Basis * | pw, | ||
| ModuleSymmetry::Symmetry & | symm ) |
Symmetrize raw nspin=4 spin-density arrays with coupled spin rotations.
| rho | Real-space density components ordered as rho0, mx, my, mz. |
| rhog | Reciprocal-space work arrays with the same component ordering. |
| pw | Plane-wave basis used for the Fourier transforms. |
| symm | Symmetry operations and spin rotations. |
| void module_charge::check_rho | ( | double *const * | rho, |
| const int | nspin, | ||
| const int | nrxx, | ||
| const double | omega, | ||
| const int | nxyz, | ||
| const double | nelec ) |
| void module_charge::chgmixing_ks | ( | const int | iter, |
| UnitCell & | ucell, | ||
| elecstate::ElecState * | pelec, | ||
| Charge & | chr, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| Charge_Mixing * | p_chgmix, | ||
| ScfMixingCtx & | ctx, | ||
| const Input_para & | inp ) |
| void module_charge::chgmixing_ks_lcao | ( | const int | iter, |
| const int | iter_limit, | ||
| Charge_Mixing * | p_chgmix, | ||
| Plus_U_Base & | dftu, | ||
| const int | nnr, | ||
| const Input_para & | inp ) |
| void module_charge::chgmixing_ks_pw | ( | const int | iter, |
| const int | iter_limit, | ||
| Charge_Mixing * | p_chgmix, | ||
| Plus_U_Base & | dftu, | ||
| const bool | mag_converged, | ||
| const Input_para & | inp ) |
| mag_converged | whether DeltaSpin magnetization converged; pass true when sc_mag_switch is off |
| double module_charge::core_charge_form_factor | ( | int | mesh, |
| const double * | r, | ||
| const double * | rab, | ||
| const double * | rho_atc, | ||
| double | omega, | ||
| double | k, | ||
| std::vector< double > & | scratch ) |
| bool module_charge::has_complete_charge_cubes | ( | const std::string & | directory, |
| const int | nspin, | ||
| const Parallel::ParaWorld & | world ) |
Collectively select the complete cube set; partial sets fall back to restart.
| void module_charge::init_mixing_dmr | ( | Base_Mixing::Mixing * | mixing, |
| Base_Mixing::Mixing_Data & | mdata, | ||
| const int | nnr, | ||
| const MixingConfig & | cfg ) |
Allocate the mixing buffer for the real-space density matrix and clear its history.
The buffer cannot be allocated in Charge_Mixing::set_mixing(): its length nnr (number of non-zero R-matrix elements) is only known after DensityMatrix::init_dmr(), which runs later in beforescf().
| mixing | mixing strategy object, non-null |
| mdata | mixing history buffer for DMR, resized and reset in place |
| nnr | number of real-space density-matrix elements per spin, > 0 |
| cfg | mixing config (nspin and scf_thr_type select the path) |
| void module_charge::init_rho | ( | Charge & | chr, |
| const ModulePW::PW_Basis & | rhopw, | ||
| const UnitCell & | ucell, | ||
| const Parallel_Grid & | pgrid, | ||
| const ModuleBase::ComplexMatrix & | strucFac, | ||
| ModuleSymmetry::Symmetry & | symm, | ||
| const void * | klist, | ||
| const void * | wfcpw, | ||
| const InitRhoCfg & | cfg ) |
Initialize charge density from file, atomic superposition, restart cache, or wavefunctions, depending on cfg.init_chg.
| chr | [inout] Charge object whose rho/rhog/kin_r buffers are filled. |
| rhopw | [in] plane-wave basis bound to chr (grid sizes and FFT backend) |
| ucell | [in] unit cell |
| pgrid | [in] parallel grid descriptor |
| strucFac | [in] structure factor for atomic-charge superposition |
| symm | [in] symmetry operations (used by wfc-based init) |
| klist | [in] k-point list pointer (K_Vectors*), needed only for wfc init |
| wfcpw | [in] PW_Basis_K pointer, needed only for wfc init |
| cfg | [in] INPUT values for charge initialization |
| double module_charge::inner_product_real | ( | const double * | rho1, |
| const double * | rho2, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| const MixingConfig & | cfg ) |
Inner product of two real-space vectors used in real-space mixing.
| rho1 | first real-space vector |
| rho2 | second real-space vector |
| rhopw | plane-wave basis supplying the real-space grid size |
| cfg | mixing config (nspin and mixing_angle select the loop bound) |
| double module_charge::inner_product_recip_hartree | ( | const std::complex< double > * | rhog1, |
| const std::complex< double > * | rhog2, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| const MixingConfig & | cfg, | ||
| const double | omega, | ||
| const double | tpiba ) |
Hartree-like reciprocal inner product used in charge mixing.
| rhog1 | first reciprocal-space vector |
| rhog2 | second reciprocal-space vector |
| rhopw | plane-wave basis supplying npw/gg and the G=0 index |
| cfg | mixing config (spin channels, gamma-only and angle flags) |
| omega | cell volume |
| tpiba | 2*pi/lattice constant |
| void module_charge::kerker_screen_real | ( | const MixingConfig & | cfg, |
| ModulePW::PW_Basis * | rhopw, | ||
| double | tpiba, | ||
| double * | drhor ) |
Apply Kerker screening in real space via FFT.
Forward-transforms drhor to drhog, applies (1 - filter_g) in reciprocal space, backward-transforms the filtered residual, and subtracts it from drhor in place. Early return if Kerker is disabled.
| cfg | mixing config (spin count, betas, gg0s, angle, gg0_min) |
| rhopw | plane-wave basis supplying npw, nrxx, gg[], real2recip/recip2real |
| tpiba | 2*pi/lattice constant used to convert gg0 to atomic units |
| drhor[in,out] | real-space density residual, length nspin*nrxx |
consider a resize for mixing_angle
inverse FT
| void module_charge::kerker_screen_recip | ( | const MixingConfig & | cfg, |
| ModulePW::PW_Basis * | rhopw, | ||
| double | tpiba, | ||
| std::complex< double > * | drhog ) |
Apply Kerker screening in reciprocal space.
Multiplies drhog[is*npw + ig] by max(gg/(gg+gg0), gg0_min/amin) per spin channel, where gg0 is derived from cfg.mixing_gg0 (density) or cfg.mixing_gg0_mag (magnetization). Early return if Kerker is disabled.
| cfg | mixing config (spin count, betas, gg0s, angle, gg0_min) |
| rhopw | plane-wave basis supplying npw and gg[] |
| tpiba | 2*pi/lattice constant used to convert gg0 to atomic units |
| drhog[in,out] | reciprocal-space density residual, length nspin*npw |
consider a resize for mixing_angle
implement Kerker for density and magnetization separately
new mixing method only support nspin=2 not nspin=4
| void module_charge::kin_r_mpi | ( | Charge & | chr, |
| const int | kpar, | ||
| const bool | all_ks_run, | ||
| const int | bndpar, | ||
| const int | nspin ) |
Reduce kin_r across pools when its buffer is allocated (meta-GGA functionals, or ELF output requested).
| chr | charge object supplying kin_r buffers |
| kpar | number of k-point pools (GlobalV::KPAR) |
| all_ks_run | whether all processes run KS calculations (PARAM.globalv.all_ks_run) |
| bndpar | number of band groups (PARAM.inp.bndpar) |
| nspin | number of spin channels (PARAM.inp.nspin) |
| void module_charge::merge_dgrid | ( | std::complex< double > * | data_d, |
| const std::vector< std::complex< double > > & | data_s, | ||
| const std::vector< std::complex< double > > & | data_hf, | ||
| int | nspin, | ||
| int | npw_smooth, | ||
| int | npw_dense ) |
Merge smooth and high-frequency parts back into dense reciprocal- space data. Inverse of split_dgrid.
Vectors are not cleared; the caller may reuse them or let them go out of scope. The output data_d must be pre-allocated by the caller with size nspin * npw_dense.
| data_d | dense output, shape [nspin * npw_dense], non-null |
| data_s | smooth input, sized to nspin * npw_smooth |
| data_hf | high-frequency input, sized to nspin * (npw_dense - npw_smooth) |
| nspin | number of spin channels, >= 1 |
| npw_smooth | smooth grid npw, >= 0 |
| npw_dense | dense grid npw, >= npw_smooth |
| void module_charge::mix_dmr | ( | const std::vector< double * > & | dmr_out, |
| const std::vector< const double * > & | dmr_in, | ||
| const int | nnr, | ||
| Base_Mixing::Mixing * | mixing, | ||
| Base_Mixing::Mixing_Data & | mdata, | ||
| const MixingConfig & | cfg ) |
Mix the real-space density matrix (LCAO calculations only).
For nspin == 1/4 the single spin channel is mixed directly; for nspin == 2 the up/down channels are transformed into charge/magnetization channels, mixed with independent betas, and transformed back.
| dmr_out | writable DMR buffers, one per spin channel, each of length nnr; mixed results are written back through these pointers |
| dmr_in | DMR buffers saved at the previous mixing step, one per spin channel, each of length nnr (read-only) |
| nnr | number of DMR elements per spin channel, > 0 |
| mixing | mixing strategy object, non-null |
| mdata | DMR mixing history buffer |
| cfg | mixing config (nspin and the two mixing betas) |
| void module_charge::non_linear_core_correction | ( | const NlcCtx & | ctx, |
| double * | rhocg ) |
| void module_charge::print_corr_iter | ( | const K_Vectors & | kv, |
| const int | sccs_debug, | ||
| const double | drho, | ||
| const elecstate::Potential & | pot ) |
sccs_debug report of the SCCS correction in this SCF iteration, in the running log of the first rank of the first pool.
| bool module_charge::read_rho_from_binary | ( | const std::string & | filename, |
| const ModulePW::PW_Basis & | rhopw, | ||
| const int | nspin, | ||
| std::complex< double > ** | rhog, | ||
| double ** | rho, | ||
| const Parallel::ParaWorld & | pw_world, | ||
| std::ostream & | log ) |
Read binary reciprocal-space density and perform inverse FFT for every spin. Requires the stored spin count to match nspin exactly (no implicit conversion). Reads density only; does not restore calculation or solver state. Returns false for recoverable open/configuration failures, leaving rho unchanged. Malformed or truncated binary input can terminate via Binstream/ WARNING_QUIT.
| bool module_charge::read_rhog | ( | const std::string & | filename, |
| const ModulePW::PW_Basis * | pw_rhod, | ||
| const int | nspin, | ||
| std::complex< double > ** | rhog, | ||
| const Parallel::ParaWorld & | pw_world, | ||
| std::ostream * | os_warning ) |
| void module_charge::reduce_diff_pools | ( | double * | array_rho, |
| const Charge & | chr, | ||
| const int | kpar, | ||
| const bool | all_ks_run, | ||
| const int | bndpar ) |
Reduce a real-space array across k-point pools and band groups.
| array_rho | real-space array [chr.nrxx], reduced in place |
| chr | charge object supplying the parallel grid and the local grid size |
| kpar | number of k-point pools (GlobalV::KPAR) |
| all_ks_run | whether all processes run KS calculations (PARAM.globalv.all_ks_run) |
| bndpar | number of band groups (PARAM.inp.bndpar) |
| void module_charge::rho_mpi | ( | Charge & | chr, |
| const int | kpar, | ||
| const bool | all_ks_run, | ||
| const int | bndpar, | ||
| const int | nspin ) |
Reduce rho across pools; also reduce kin_r when its buffer is allocated (meta-GGA functionals, or ELF output requested).
| chr | charge object supplying rho/kin_r buffers |
| kpar | number of k-point pools (GlobalV::KPAR) |
| all_ks_run | whether all processes run KS calculations (PARAM.globalv.all_ks_run) |
| bndpar | number of band groups (PARAM.inp.bndpar) |
| nspin | number of spin channels (PARAM.inp.nspin) |
| void module_charge::set_drho_core | ( | const UnitCell & | ucell, |
| int | iat, | ||
| int | dir, | ||
| const ModuleBase::Vector3< double > & | q_cart, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| std::vector< std::complex< double > > & | drhoc_g ) |
| void module_charge::set_rho_core | ( | const UnitCell & | ucell, |
| const ModuleBase::ComplexMatrix & | structure_factor, | ||
| const bool * | numeric, | ||
| double * | rho_core, | ||
| std::complex< double > * | rhog_core, | ||
| const ModulePW::PW_Basis & | rhopw ) |
| void module_charge::split_dgrid | ( | const std::complex< double > * | data_d, |
| std::vector< std::complex< double > > & | data_s, | ||
| std::vector< std::complex< double > > & | data_hf, | ||
| int | nspin, | ||
| int | npw_smooth, | ||
| int | npw_dense ) |
Split dense reciprocal-space data into smooth and high-frequency parts on the USPP double grid.
For each spin channel, the first npw_smooth entries of data_d are copied into data_s and the remaining (npw_dense - npw_smooth) entries are copied into data_hf. No aliasing is performed: both output vectors own their storage and must be pre-sized by the caller.
| data_d | dense input, shape [nspin * npw_dense], non-null |
| data_s | smooth output, pre-sized to nspin * npw_smooth |
| data_hf | high-frequency output, pre-sized to nspin * (npw_dense - npw_smooth); zero-size is allowed when npw_dense == npw_smooth |
| nspin | number of spin channels, >= 1 |
| npw_smooth | smooth grid npw, >= 0 |
| npw_dense | dense grid npw, >= npw_smooth |
| double module_charge::sum_rho | ( | double *const * | rho, |
| const int | nspin0, | ||
| const int | nrxx, | ||
| const double | omega, | ||
| const int | nxyz ) |
| void module_charge::symmetrize_rho | ( | const int | nspin, |
| const Charge & | chr, | ||
| const ModulePW::PW_Basis * | pw, | ||
| ModuleSymmetry::Symmetry & | symm ) |
Symmetrize charge density for all spin channels.
This is a helper function that symmetrizes the charge density for all spin channels by calling cal_rhog_symm() for each spin.
| nspin | Number of spin channels |
| chr | Charge object containing the density |
| pw | Plane wave basis |
| symm | Symmetry object |
| bool module_charge::update_pot_model | ( | const int | iter, |
| const double | drho, | ||
| const K_Vectors & | kv, | ||
| elecstate::Potential & | pot, | ||
| Charge_Mixing * | p_chgmix ) |
Lets a potential component change its model before mixing (SCCS delayed start); true only in the iteration in which it does, which then restarts the mixing. The first rank of the first pool announces the change on the screen.
| void module_charge::write_density_restart | ( | Charge & | charge, |
| ModulePW::PW_Basis & | pw_rhod, | ||
| const ModuleBase::Matrix3 & | reciprocal_lattice, | ||
| const std::string & | prefix, | ||
| const int | nspin, | ||
| const bool | enabled, | ||
| const bool | gamma_only, | ||
| const bool | write_tau, | ||
| const bool | writer_pool, | ||
| const Parallel::ParaWorld & | pw_world, | ||
| std::ostream * | warning ) |
Write saved charge and optional kinetic-energy densities in reciprocal space.
All pools participate in their density transforms; only the designated writer pool writes files. The caller selects the output time and supplies saved densities in rho_save and kin_r_save. rhog_save is updated by the transform.
| bool module_charge::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 Parallel::ParaWorld & | pw_world, | ||
| std::ostream * | os_warning ) |