From 2bb787dc6ae5ab28020651014a2c3047b6120df4 Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Tue, 7 Apr 2026 19:31:46 +0800 Subject: [PATCH 1/5] Add test for small cell --- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT | 35 +++++++++++++++++++ tests/06_SDFT/24_PW_SDFT_SMALL_CELL/KPT | 4 +++ tests/06_SDFT/24_PW_SDFT_SMALL_CELL/README | 1 + tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU | 23 ++++++++++++ .../06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref | 8 +++++ tests/06_SDFT/CASES_CPU.txt | 1 + 6 files changed, 72 insertions(+) create mode 100644 tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT create mode 100644 tests/06_SDFT/24_PW_SDFT_SMALL_CELL/KPT create mode 100644 tests/06_SDFT/24_PW_SDFT_SMALL_CELL/README create mode 100644 tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU create mode 100644 tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT new file mode 100644 index 0000000000..1d7144a83a --- /dev/null +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT @@ -0,0 +1,35 @@ +INPUT_PARAMETERS +#Parameters (1.General) +suffix autotest +calculation scf +esolver_type sdft +symmetry 1 +pseudo_dir ../../PP_ORB +orbital_dir . +basis_type pw +ecutwfc 335 +cal_stress 1 +cal_force 1 +kpar 1 +bndpar 1 + +#Parameters (2. SCF iterations) +scf_nmax 12 +scf_thr 1e-4 + +#Parameters (3. Solve KS equation) +nbands 0 +nbands_sto 24 +nche_sto 20 +seed_sto -20000 +method_sto 2 +ks_solver cg + +#Parameters (4.Smearing) +smearing_method fd +smearing_sigma 25.33454852 + +#Parameters (5.Mixing) +mixing_type broyden +mixing_beta 0.7 +mixing_gg0 0 diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/KPT b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/KPT new file mode 100644 index 0000000000..e769af7638 --- /dev/null +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/KPT @@ -0,0 +1,4 @@ +K_POINTS +0 +Gamma +2 1 1 0 0 0 diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/README b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/README new file mode 100644 index 0000000000..3e0c8e2639 --- /dev/null +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/README @@ -0,0 +1 @@ +test SDFT SCF correctness on a very small cell with lightweight settings diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU new file mode 100644 index 0000000000..99e6c13930 --- /dev/null +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU @@ -0,0 +1,23 @@ +#This is the atom file containing all the information +#about the lattice structure. + +ATOMIC_SPECIES +D 2.0141017778 H.SG15.PBE.UPF #Element, Mass, Pseudopotential + +LATTICE_CONSTANT +0.3838341862 #Lattice constant + +LATTICE_VECTORS +1.0 0.0 0.0 #Lattice vector 1 +0.0 1.0 0.0 #Lattice vector 2 +0.0 0.0 1.0 #Lattice vector 3 + +ATOMIC_POSITIONS +Direct +D #Name of element +0.0 +4 +0.000 0.000 0.000 1 1 1 +0.000 0.500 0.500 1 1 1 +0.500 0.000 0.500 1 1 1 +0.500 0.500 0.000 1 1 1 diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref new file mode 100644 index 0000000000..5d047c84eb --- /dev/null +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref @@ -0,0 +1,8 @@ +etotref 3259.9075590236229800 +etotperatomref 814.9768897559 +totalforceref 0.000000 +totalstressref 1272740774.201760 +pointgroupref O_h +spacegroupref O_h +nksibzref 2 +totaltimeref 14.61 diff --git a/tests/06_SDFT/CASES_CPU.txt b/tests/06_SDFT/CASES_CPU.txt index f115a7fdfd..99e536ceef 100644 --- a/tests/06_SDFT/CASES_CPU.txt +++ b/tests/06_SDFT/CASES_CPU.txt @@ -21,3 +21,4 @@ 21_PW_SKG_10D10S 22_PW_SKG_ALL 23_PW_SNLKG_10D10S +24_PW_SDFT_SMALL_CELL From 0d43a2ee2b570c1ada57fb15b4ac81461a80b0d2 Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Tue, 7 Apr 2026 20:36:52 +0800 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU index 99e6c13930..5217e244e0 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/STRU @@ -13,9 +13,9 @@ LATTICE_VECTORS 0.0 0.0 1.0 #Lattice vector 3 ATOMIC_POSITIONS -Direct -D #Name of element -0.0 +Direct +D #Name of element +0.0 4 0.000 0.000 0.000 1 1 1 0.000 0.500 0.500 1 1 1 From 464d8c486e1eb8481d2a429700e46d69311ee93d Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Wed, 8 Apr 2026 01:12:44 +0800 Subject: [PATCH 3/5] Update input and ref --- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT | 2 +- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT index 1d7144a83a..1c18d9c1e1 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT @@ -7,7 +7,7 @@ symmetry 1 pseudo_dir ../../PP_ORB orbital_dir . basis_type pw -ecutwfc 335 +ecutwfc 500 cal_stress 1 cal_force 1 kpar 1 diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref index 5d047c84eb..486e9c8bfa 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref @@ -1,8 +1,8 @@ -etotref 3259.9075590236229800 -etotperatomref 814.9768897559 +etotref 3258.3242743008886464 +etotperatomref 814.5810685752 totalforceref 0.000000 -totalstressref 1272740774.201760 +totalstressref 1269449593.508682 pointgroupref O_h spacegroupref O_h nksibzref 2 -totaltimeref 14.61 +totaltimeref 14.55 From af1f043c571e5e9fb3a2326f1485594c2c1d62e5 Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Wed, 8 Apr 2026 01:43:37 +0800 Subject: [PATCH 4/5] Update input and ref --- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT | 2 +- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT index 1c18d9c1e1..ab896d7c87 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT @@ -15,7 +15,7 @@ bndpar 1 #Parameters (2. SCF iterations) scf_nmax 12 -scf_thr 1e-4 +scf_thr 1e-6 #Parameters (3. Solve KS equation) nbands 0 diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref index 486e9c8bfa..44894534cb 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref @@ -1,8 +1,8 @@ -etotref 3258.3242743008886464 -etotperatomref 814.5810685752 +etotref 3258.3314262784492712 +etotperatomref 814.5828565696 totalforceref 0.000000 -totalstressref 1269449593.508682 +totalstressref 1269452743.259340 pointgroupref O_h spacegroupref O_h nksibzref 2 -totaltimeref 14.55 +totaltimeref 15.16 From 374ea65f7e43562156bd98e7872485abfa30293b Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Wed, 8 Apr 2026 02:53:35 +0800 Subject: [PATCH 5/5] Update input and ref --- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT | 8 ++++---- tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT index ab896d7c87..918e7e71db 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/INPUT @@ -14,14 +14,14 @@ kpar 1 bndpar 1 #Parameters (2. SCF iterations) -scf_nmax 12 scf_thr 1e-6 #Parameters (3. Solve KS equation) nbands 0 -nbands_sto 24 -nche_sto 20 -seed_sto -20000 +nbands_sto 96 +nche_sto 50 +seed_sto 20000 +pw_seed 1 method_sto 2 ks_solver cg diff --git a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref index 44894534cb..ca56281726 100644 --- a/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref +++ b/tests/06_SDFT/24_PW_SDFT_SMALL_CELL/result.ref @@ -1,8 +1,8 @@ -etotref 3258.3314262784492712 -etotperatomref 814.5828565696 +etotref 3259.2802240676614929 +etotperatomref 814.8200560169 totalforceref 0.000000 -totalstressref 1269452743.259340 +totalstressref 1271683315.068934 pointgroupref O_h spacegroupref O_h nksibzref 2 -totaltimeref 15.16 +totaltimeref 3.01