Skip to content

Commit 96e4ac2

Browse files
committed
add stochastic DFT parameters to input-main.md
1 parent 33a983b commit 96e4ac2

File tree

4 files changed

+47
-7
lines changed

4 files changed

+47
-7
lines changed

docs/input-main.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
- [System variables](#system-variables)
1010

11-
[suffix](#suffix) | [ntype](#ntype) | [calculation](#calculation) | [symmetry](#symmetry) | [kpar](#kpar) | [latname](#latname) | [init_wfc](#init_wfc) | [init_chg](#init_chg) | [init_vel](#init_vel) | [nelec](#nelec) | [tot_magnetization](#tot-magnetization) | [dft_functional](#dft-functional) | [pseudo_type](#pseudo-type) | [pseudo_rcut](#pseudo-rcut) | [pseudo_mesh](#pseudo_mesh) | [mem_saver](#mem-saver) | [diago_proc](#diago_proc) | [nbspline](#nbspline)
11+
[suffix](#suffix) | [ntype](#ntype) | [calculation](#calculation) | [symmetry](#symmetry) | [kpar](#kpar) | [bndpar](#bndpar) | [latname](#latname) | [init_wfc](#init_wfc) | [init_chg](#init_chg) | [init_vel](#init_vel) | [nelec](#nelec) | [tot_magnetization](#tot-magnetization) | [dft_functional](#dft-functional) | [pseudo_type](#pseudo-type) | [pseudo_rcut](#pseudo-rcut) | [pseudo_mesh](#pseudo_mesh) | [mem_saver](#mem-saver) | [diago_proc](#diago_proc) | [nbspline](#nbspline)
1212

1313
- [Variables related to input files](#variables-related-to-input-files)
1414

@@ -24,7 +24,7 @@
2424

2525
- [Electronic structure](#electronic-structure)
2626

27-
[basis_type](#basis-type) | [ks_solver](#ks-solver) | [nbands](#nbands) | [nbands_istate](#nbands-istate) | [nspin](#nspin) | [occupations](#occupations) | [smearing_method](#smearing_method) | [smearing_sigma](#smearing_sigma) | [mixing_type](#mixing-type) | [mixing_beta](#mixing-beta) | [mixing_ndim](#mixing-ndim) | [mixing_gg0](#mixing-gg0) | [gamma_only](#gamma-only) | [printe](#printe) | [scf_nmax](#scf_nmax) | [scf_thr](#scf_thr) | [chg_extrap](#chg_extrap)
27+
[basis_type](#basis-type) | [ks_solver](#ks-solver) | [nbands](#nbands) | [nbands_sto](#nbands_sto) | [nbands_istate](#nbands-istate) | [nspin](#nspin) | [occupations](#occupations) | [smearing_method](#smearing_method) | [smearing_sigma](#smearing_sigma) | [mixing_type](#mixing-type) | [mixing_beta](#mixing-beta) | [mixing_ndim](#mixing-ndim) | [mixing_gg0](#mixing-gg0) | [gamma_only](#gamma-only) | [printe](#printe) | [scf_nmax](#scf_nmax) | [scf_thr](#scf_thr) | [chg_extrap](#chg_extrap) | [nche_sto](#nche_sto) | [emin_sto](#emin_sto) | [emax_sto](#emax_sto) | [seed_sto](#seed_sto)
2828

2929
- [Geometry relaxation](#geometry-relaxation)
3030

@@ -150,6 +150,12 @@ This part of variables are used to control general system parameters.
150150
- **Description**: devide all processors into kpar groups, and k points will be distributed among each group. The value taken should be less than or equal to the number of k points as well as the number of MPI threads.
151151
- **Default**: 1
152152

153+
#### bndpar
154+
155+
- **Type**: Integer
156+
- **Description**: devide all processors into bndpar groups, and bands (only stochastic orbitals now) will be distributed among each group.
157+
- **Default**: 1
158+
153159
#### latname
154160

155161
- **Type**: String
@@ -453,6 +459,14 @@ calculations.
453459
- nspin=1: 1.2\*occupied_bands, occupied_bands+10)
454460
- nspin=2: max(1.2\*nelec, nelec+20)
455461
462+
#### nbands_sto
463+
464+
- **Type**: Integer
465+
- **Description**:
466+
- nbands_sto>0: Number of stochastic orbitals to calculate in stochastic DFT (SDFT) or mix stochastic-deterministic (MDFT). More bands obtain more precise results or smaller stochastic errors ($ \propto 1/\sqrt{N_{\chi}}$);
467+
- nbands_sto=0: Complete basis will be used to replace stochastic orbitals with the Chebyshev method (CT) and it will get the results the same as KSDFT without stochastic errors.
468+
- **Default**: 0
469+
456470
#### nbands_istate
457471
458472
- **Type**: Integer
@@ -551,6 +565,32 @@ calculations.
551565
- second-order: second-order extrapolation
552566
- **Default**:atomic
553567
568+
#### nche_sto
569+
570+
- **Type**: Integer
571+
- **Description**: Chebyshev expansion orders for SDFT, MDFT, CT methods.
572+
- **Default**:5
573+
574+
#### emin_sto
575+
576+
- **Type**: Real
577+
- **Description**: Trial energy to guess the lower bound of eigen energies of the Hamitonian Operator $\hat{H}$. The unit is Ry.
578+
- **Default**:0.0
579+
580+
#### emax_sto
581+
582+
- **Type**: Real
583+
- **Description**: Trial energy to guess the upper bound of eigen energies of the Hamitonian Operator $\hat{H}$. The unit is Ry.
584+
- **Default**:0.0
585+
586+
#### seed_sto
587+
588+
- **Type**: Integer
589+
- **Description**: The random seed to generate stochastic orbitals.
590+
- seed_sto>=0: Stochastic orbitals have the form of $\exp(i2\pi\theta(G))$, where $\theta$ is a uniform distribution in $(0,1)$. If seed_sto=0, the seed is decided by time(NULL).
591+
- seed_sto<=-1: Stochastic orbitals have the form of $\pm1$ with the equal probability. If seed_sto=-1, the seed is decided by time(NULL).
592+
- **Default**:0
593+
554594
### Geometry relaxation
555595
556596
This part of variables are used to control the geometry relaxation.

source/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void Input::Default(void)
138138
nbands_sto = 0;
139139
nbands_istate = 5;
140140
pw_seed = 1;
141-
nche_sto = 0;
141+
nche_sto = 5;
142142
seed_sto = 0;
143143
bndpar = 1;
144144
kpar = 1;

source/src_pw/sto_che.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void Stochastic_Chebychev::init(int ndmax_in, int norder_in)
3838
this->ndmax = ndmax_in;
3939
this->norder = norder_in;
4040

41-
if(norder<5)
41+
if(norder<1)
4242
{
43-
ModuleBase::WARNING_QUIT("Stochastic_Chebychev", "The Chebychev expansion order should be at least 5!");
43+
ModuleBase::WARNING_QUIT("Stochastic_Chebychev", "The Chebychev expansion order should be at least 1!");
4444
}
4545

4646
assert(extend >= 1);

source/src_pw/sto_iter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void Stochastic_Iter::checkemm(const int& ik, int &iter, Stochastic_WF& stowf)
131131
Stochastic_hchi:: Emax = Emax;
132132
if(change)
133133
{
134-
std::cout<<"New Emax "<<Stochastic_hchi:: Emax<<" ; new Emin "<<Stochastic_hchi:: Emin<<std::endl;
134+
GlobalV::ofs_running<<"New Emax "<<Stochastic_hchi:: Emax<<" ; new Emin "<<Stochastic_hchi:: Emin<<std::endl;
135135
}
136136
change = false;
137137
}
@@ -224,7 +224,7 @@ void Stochastic_Iter::itermu(int &iter)
224224
double tmpre;
225225
tmpre = stoche.coef[stoche.norder-1] * spolyv[stoche.norder-1];
226226
MPI_Allreduce(MPI_IN_PLACE, &tmpre, 1, MPI_DOUBLE, MPI_SUM , MPI_COMM_WORLD);
227-
GlobalV::ofs_running<<"Chebyshev Precision: "<<abs(tmpre/targetne)<<std::endl;
227+
GlobalV::ofs_running<<"Chebyshev Precision: "<<abs(tmpre/targetne)*1e9<<"E-9"<<std::endl;
228228
if(tmpre/targetne > GlobalV::SCF_THR )
229229
{
230230
stringstream ss;

0 commit comments

Comments
 (0)