Skip to content

Commit 5517a58

Browse files
dyzhengmohanchen
andauthored
fix(nupdown): only set two_fermi when nupdown is non-zero (#7371)
* fix(nupdown): only set two_fermi when nupdown is non-zero When nupdown=0.0 is explicitly set in INPUT, it should behave the same as not setting nupdown at all. Previously, reading any nupdown value would unconditionally set two_fermi=true, causing different code paths even when nupdown=0.0. Now two_fermi is only set to true when nupdown != 0.0, making nupdown=0 equivalent to not specifying the parameter. * test(scf_out_mul_nupdw): update reference files for nupdown=0 fix With the nupdown fix (two_fermi only set when nupdown!=0), the test now uses a single Fermi level instead of two, allowing the system with nelec=9 to naturally polarize to spin1=5/spin2=4 instead of the forced equal distribution of 4.5/4.5. --------- Co-authored-by: Mohan Chen <mohanchen@pku.edu.cn>
1 parent 0ee6b28 commit 5517a58

3 files changed

Lines changed: 50 additions & 50 deletions

File tree

source/source_io/module_parameter/read_input_item_elec_stru.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Then the user has to correct the input file and restart the calculation.)";
297297
item.availability = "";
298298
item.read_value = [](const Input_Item& item, Parameter& para) {
299299
para.input.nupdown = doublevalue;
300-
para.sys.two_fermi = true;
300+
para.sys.two_fermi = (doublevalue != 0.0);
301301
};
302302
item.reset_value = [](const Input_Item&, Parameter& para) {
303303
if (para.input.nspin == 1)
Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
--- Ionic Step 1 ---
22
Total charge 9
3-
Total charge of spin1 4.5
4-
Total charge of spin2 4.5
3+
Total charge of spin1 5
4+
Total charge of spin2 4
55
Decomposed Mulliken population analysis for each atom
66
l and m from Ylm, z stands for zeta orbital
77

88
------------------
99
Atom 1 is Si
1010
------------------
1111
zeta spin1 spin2 sum diff
12-
s 1 0.6711 0.6711 1.3422 0.0000
13-
s 2 0.0029 0.0029 0.0058 -0.0000
14-
sum mz 0.6740 0.6740 1.3480 0.0000
12+
s 1 0.6748 0.5438 1.2186 0.1309
13+
s 2 -0.0024 -0.0158 -0.0182 0.0134
14+
sum mz 0.6724 0.5281 1.2004 0.1443
1515

16-
pz 1 0.3982 0.3982 0.7964 -0.0000
17-
px 1 0.3836 0.3836 0.7673 -0.0000
18-
py 1 0.3836 0.3836 0.7673 -0.0000
19-
sum m 1.1655 1.1655 2.3310 -0.0000
20-
pz 2 0.0542 0.0542 0.1084 -0.0000
21-
px 2 0.0519 0.0519 0.1037 0.0000
22-
py 2 0.0519 0.0519 0.1037 0.0000
23-
sum m 0.1579 0.1579 0.3158 0.0000
24-
sum mz 1.3234 1.3234 2.6468 -0.0000
16+
pz 1 0.4954 0.3774 0.8727 0.1180
17+
px 1 0.4379 0.3722 0.8100 0.0657
18+
py 1 0.4379 0.3722 0.8100 0.0657
19+
sum m 1.3711 1.1217 2.4928 0.2494
20+
pz 2 0.0558 0.0519 0.1076 0.0039
21+
px 2 0.0517 0.0483 0.1000 0.0034
22+
py 2 0.0517 0.0483 0.1000 0.0034
23+
sum m 0.1591 0.1485 0.3076 0.0106
24+
sum mz 1.5302 1.2702 2.8004 0.2600
2525

26-
dz^2 1 0.0051 0.0051 0.0102 0.0000
27-
dxz 1 0.0814 0.0814 0.1629 0.0000
28-
dyz 1 0.0814 0.0814 0.1629 0.0000
29-
dx^2-y^2 1 0.0079 0.0079 0.0157 -0.0000
30-
dxy 1 0.0779 0.0779 0.1557 -0.0000
31-
sum m 0.2537 0.2537 0.5075 0.0000
32-
sum mz 0.2537 0.2537 0.5075 0.0000
26+
dz^2 1 0.0056 0.0052 0.0107 0.0004
27+
dxz 1 0.0924 0.0623 0.1546 0.0301
28+
dyz 1 0.0924 0.0623 0.1546 0.0301
29+
dx^2-y^2 1 0.0078 0.0098 0.0176 -0.0020
30+
dxy 1 0.0994 0.0633 0.1627 0.0362
31+
sum m 0.2975 0.2028 0.5003 0.0947
32+
sum mz 0.2975 0.2028 0.5003 0.0947
3333

34-
sum lmz 2.2512 2.2512 4.5023 -0.0000
34+
sum lmz 2.5001 2.0011 4.5011 0.4990
3535

36-
total charge on atom 1 4.5023
37-
total magnetism on atom 1 -0.0000
36+
total charge on atom 1 4.5011
37+
total magnetism on atom 1 0.4990
3838

3939
------------------
4040
Atom 2 is Si
4141
------------------
4242
zeta spin1 spin2 sum diff
43-
s 1 0.6704 0.6704 1.3407 0.0000
44-
s 2 0.0021 0.0021 0.0041 -0.0000
45-
sum mz 0.6724 0.6724 1.3449 0.0000
43+
s 1 0.6744 0.5434 1.2178 0.1309
44+
s 2 -0.0031 -0.0168 -0.0199 0.0137
45+
sum mz 0.6713 0.5267 1.1979 0.1446
4646

47-
pz 1 0.3958 0.3958 0.7917 -0.0000
48-
px 1 0.3828 0.3828 0.7657 -0.0000
49-
py 1 0.3828 0.3828 0.7657 -0.0000
50-
sum m 1.1615 1.1615 2.3230 -0.0000
51-
pz 2 0.0548 0.0548 0.1095 -0.0000
52-
px 2 0.0527 0.0527 0.1055 0.0000
53-
py 2 0.0527 0.0527 0.1055 0.0000
54-
sum m 0.1602 0.1602 0.3205 0.0000
55-
sum mz 1.3217 1.3217 2.6435 -0.0000
47+
pz 1 0.4936 0.3753 0.8689 0.1184
48+
px 1 0.4372 0.3715 0.8088 0.0657
49+
py 1 0.4372 0.3715 0.8088 0.0657
50+
sum m 1.3681 1.1184 2.4864 0.2497
51+
pz 2 0.0568 0.0523 0.1091 0.0045
52+
px 2 0.0532 0.0492 0.1023 0.0040
53+
py 2 0.0532 0.0492 0.1023 0.0040
54+
sum m 0.1631 0.1506 0.3137 0.0125
55+
sum mz 1.5312 1.2690 2.8002 0.2622
5656

57-
dz^2 1 0.0051 0.0051 0.0103 0.0000
58-
dxz 1 0.0817 0.0817 0.1634 0.0000
59-
dyz 1 0.0817 0.0817 0.1634 0.0000
60-
dx^2-y^2 1 0.0079 0.0079 0.0158 -0.0000
61-
dxy 1 0.0783 0.0783 0.1565 -0.0000
62-
sum m 0.2547 0.2547 0.5093 0.0000
63-
sum mz 0.2547 0.2547 0.5093 0.0000
57+
dz^2 1 0.0056 0.0052 0.0108 0.0004
58+
dxz 1 0.0924 0.0624 0.1548 0.0299
59+
dyz 1 0.0924 0.0624 0.1548 0.0299
60+
dx^2-y^2 1 0.0078 0.0098 0.0176 -0.0020
61+
dxy 1 0.0994 0.0635 0.1628 0.0359
62+
sum m 0.2975 0.2033 0.5008 0.0942
63+
sum mz 0.2975 0.2033 0.5008 0.0942
6464

65-
sum lmz 2.2488 2.2488 4.4977 0.0000
65+
sum lmz 2.4999 1.9989 4.4989 0.5010
6666

67-
total charge on atom 2 4.4977
68-
total magnetism on atom 2 0.0000
67+
total charge on atom 2 4.4989
68+
total magnetism on atom 2 0.5010
6969

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
etotref -193.6447413474452
2-
etotperatomref -96.8223706737
1+
etotref -193.9556401395348
2+
etotperatomref -96.9778200698
33
Compare_mulliken_pass 0
44
pointgroupref C_1h
55
spacegroupref C_2h
66
nksibzref 2
7-
totaltimeref 2.70
7+
totaltimeref 0.52

0 commit comments

Comments
 (0)