Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ calculations.

- **Type**: String
- **Description**: It indicates which occupation and smearing method is used in the calculation.
- **fixed**: fixed occupations.
- **fixed**: fixed occupations (available for non-coductors only)
- **gauss** or **gaussian**: Gaussian smearing method.
- **mp**: methfessel-paxton smearing method; recommended for metals.
- **fd**: Fermi-Dirac smearing method: $f=1/\{1+\exp[(E-\mu)/kT]\}$ and smearing_sigma below is the temperature $T$ (in Ry).
Expand Down
6 changes: 5 additions & 1 deletion source/module_elecstate/occupy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ void Occupy::iweights(const int nks,
const std::vector<int>& isk)
{
assert(is < 2);
double degspin = 2.0;
if (GlobalV::NSPIN == 4)
degspin = 1.0;
if (is != -1)
degspin = 1.0;

double degspin = (GlobalV::NSPIN == 1) ? 2.0 : 1.0;
double ib_mind = nelec / degspin;
int ib_min = std::ceil(ib_mind);
if (ib_min != int(ib_mind))
Expand Down
2 changes: 1 addition & 1 deletion source/module_elecstate/test/elecstate_occupy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ TEST_F(OccupyTest, IweightsWarning)
ekb(0, 0) = 0.1;

testing::internal::CaptureStdout();
EXPECT_EXIT(occupy.iweights(1, wk, 1, 1.0, ekb, ef, wg, 0, isk);, ::testing::ExitedWithCode(0), "");
EXPECT_EXIT(occupy.iweights(1, wk, 1, 1.0, ekb, ef, wg, -1, isk);, ::testing::ExitedWithCode(0), "");
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr("It is not a semiconductor or insulator. Change 'smearing_method'."));
}
Expand Down