Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
- [basis\_type](#basis_type)
- [ks\_solver](#ks_solver)
- [nbands](#nbands)
- [nbands_mul](#nbands_mul)
- [nelec](#nelec)
- [nelec\_delta](#nelec_delta)
- [nupdown](#nupdown)
Expand Down Expand Up @@ -967,9 +968,15 @@ calculations.
- **Type**: Integer
- **Description**: The number of Kohn-Sham orbitals to calculate. It is recommended to setup this value, especially when smearing techniques are utilized, more bands should be included.
- **Default**:
- nspin=1: max(1.2\*occupied_bands, occupied_bands + 10)
- nspin=2: max(1.2\*nelec_spin, nelec_spin + 10), in which nelec_spin = max(nelec_spin_up, nelec_spin_down)
- nspin=4: max(1.2\*nelec, nelec + 20)
- nspin=1: max(`nbands_mul`\*occupied_bands, occupied_bands + 10)
- nspin=2: max(`nbands_mul`\*nelec_spin, nelec_spin + 10), in which nelec_spin = max(nelec_spin_up, nelec_spin_down)
- nspin=4: max(`nbands_mul`\*nelec, nelec + 20)

### nbands_mul

- **Type**: Real
- **Description**: the multiply value of default formular of `nbands`. It is recommended that the user set a larger default multiplier for systems with complex electron levels near the Fermi surface, such as `2.0`.
- **Default**: 1.2

### nelec

Expand Down
4 changes: 3 additions & 1 deletion source/module_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,9 @@ bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_runn
}
}
}
if (autoset_mag)
// atomic initial magnetism will be autoset if user set zero for every atom
// one exception is `lspinorb 1` with `noncolin 0`, this setting imply no-mag material but SOC included
if (autoset_mag && !PARAM.inp.lspinorb || PARAM.inp.noncolin)
{
if(PARAM.inp.nspin==4)
{
Expand Down
6 changes: 3 additions & 3 deletions source/module_elecstate/cal_nelec_nband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void cal_nbands(const int& nelec, const int& nlocal, const std::vector<double>&
if (PARAM.inp.nspin == 1)
{
const int nbands1 = static_cast<int>(occupied_bands) + 10;
const int nbands2 = static_cast<int>(1.2 * occupied_bands) + 1;
const int nbands2 = static_cast<int>(PARAM.inp.nbands_mul * occupied_bands) + 1;
nbands = std::max(nbands1, nbands2);
if (PARAM.inp.basis_type != "pw") {
nbands = std::min(nbands, nlocal);
Expand All @@ -93,7 +93,7 @@ void cal_nbands(const int& nelec, const int& nlocal, const std::vector<double>&
else if (PARAM.inp.nspin == 4)
{
const int nbands3 = nelec + 20;
const int nbands4 = static_cast<int>(1.2 * nelec) + 1;
const int nbands4 = static_cast<int>(PARAM.inp.nbands_mul * nelec) + 1;
nbands = std::max(nbands3, nbands4);
if (PARAM.inp.basis_type != "pw") {
nbands = std::min(nbands, nlocal);
Expand All @@ -103,7 +103,7 @@ void cal_nbands(const int& nelec, const int& nlocal, const std::vector<double>&
{
const double max_occ = std::max(nelec_spin[0], nelec_spin[1]);
const int nbands3 = static_cast<int>(max_occ) + 11;
const int nbands4 = static_cast<int>(1.2 * max_occ) + 1;
const int nbands4 = static_cast<int>(PARAM.inp.nbands_mul * max_occ) + 1;
nbands = std::max(nbands3, nbands4);
if (PARAM.inp.basis_type != "pw") {
nbands = std::min(nbands, nlocal);
Expand Down
12 changes: 12 additions & 0 deletions source/module_io/read_input_item_elec_stru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ void ReadInput::item_elec_stru()
};
this->add_item(item);
}
{
Input_Item item("nbands_mul");
item.annotation = "value to multiply the number of bands";
read_sync_double(input.nbands_mul);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.nbands_mul < 1.0)
{
ModuleBase::WARNING_QUIT("ReadInput", "nbands_mul should be greater than 1.0");
}
};
this->add_item(item);
}
{
Input_Item item("nelec");
item.annotation = "input number of electrons";
Expand Down
1 change: 1 addition & 0 deletions source/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct Input_para
std::string basis_type = "pw"; ///< xiaohui add 2013-09-01, for structural adjustment
bool use_paw = false; ///< whether to use PAW in pw calculation
int nbands = 0; ///< number of bands
double nbands_mul = 1.2; ///< multiplier for nbands
double nelec = 0.0; ///< total number of electrons
double nelec_delta = 0.0; ///< change in the number of total electrons
double nupdown = 0.0;
Expand Down
Loading