From 1bf55077f799e2130cbeb4e6398b322c8438e950 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 30 Aug 2022 12:38:30 +0800 Subject: [PATCH 1/2] test(performance): correct the reference result --- examples/performance/P000_si16_pw/INPUT | 1 + examples/performance/P000_si16_pw/result.ref | 10 +- examples/performance/P001_si32_pw/result.ref | 10 +- examples/performance/P002_si64_pw/result.ref | 10 +- examples/performance/P003_si128_pw/INPUT | 1 + examples/performance/P003_si128_pw/result.ref | 10 +- examples/performance/P004_cu4_pw/result.ref | 8 +- .../P005_Bi2Se2Cu2O2_pw/result.ref | 6 +- .../performance/P006_Ge4As8_pw/result.ref | 10 +- examples/performance/P007_H2O_pw/result.ref | 10 +- examples/performance/P008_C2H6O_pw/result.ref | 10 +- examples/performance/P009_32H2O_pw/result.ref | 8 +- examples/performance/P010_si2_pw/result.ref | 10 +- examples/performance/P100_si16_lcao/INPUT | 2 +- .../performance/P100_si16_lcao/result.ref | 10 +- examples/performance/P101_si32_lcao/INPUT | 2 +- .../performance/P101_si32_lcao/result.ref | 10 +- examples/performance/P102_si64_lcao/INPUT | 2 +- .../performance/P102_si64_lcao/result.ref | 10 +- examples/performance/P103_si128_lcao/INPUT | 2 +- .../performance/P103_si128_lcao/result.ref | 8 +- examples/performance/P104_si256_lcao/INPUT | 2 +- .../performance/P104_si256_lcao/result.ref | 10 +- examples/performance/P105_si512_lcao/INPUT | 2 +- .../performance/P105_si512_lcao/result.ref | 10 +- examples/performance/P106_Cu4_lcao/INPUT | 2 +- examples/performance/P106_Cu4_lcao/result.ref | 4 +- .../performance/P107_Bi2Se2Cu2O2_lcao/INPUT | 2 +- .../P107_Bi2Se2Cu2O2_lcao/result.ref | 4 +- examples/performance/P108_Ge4As8_lcao/INPUT | 2 +- .../performance/P108_Ge4As8_lcao/result.ref | 10 +- examples/performance/P109_H2O_lcao/INPUT | 2 +- examples/performance/P109_H2O_lcao/result.ref | 10 +- examples/performance/P110_C2H6O_lcao/INPUT | 2 +- .../performance/P110_C2H6O_lcao/result.ref | 10 +- examples/performance/P111_si32_lcaogo/INPUT | 2 +- .../performance/P111_si32_lcaogo/result.ref | 10 +- examples/performance/catch_properties.sh | 0 examples/performance/clean.sh | 0 examples/performance/run.sh | 31 ++- examples/performance/sumdat.py | 200 ++++++++++++++++++ examples/performance/sumdat.sh | 95 --------- 42 files changed, 338 insertions(+), 222 deletions(-) mode change 100755 => 100644 examples/performance/catch_properties.sh mode change 100755 => 100644 examples/performance/clean.sh mode change 100755 => 100644 examples/performance/run.sh create mode 100644 examples/performance/sumdat.py delete mode 100755 examples/performance/sumdat.sh diff --git a/examples/performance/P000_si16_pw/INPUT b/examples/performance/P000_si16_pw/INPUT index e78f06b9e3..cc6da184f0 100644 --- a/examples/performance/P000_si16_pw/INPUT +++ b/examples/performance/P000_si16_pw/INPUT @@ -23,3 +23,4 @@ smearing_sigma 0.002 #Parameters (5.Mixing) mixing_type pulay mixing_beta 0.3 +ks_solver dav diff --git a/examples/performance/P000_si16_pw/result.ref b/examples/performance/P000_si16_pw/result.ref index 82e19e7d35..67237f2ca4 100644 --- a/examples/performance/P000_si16_pw/result.ref +++ b/examples/performance/P000_si16_pw/result.ref @@ -1,5 +1,5 @@ -etotref -1813.8232293743853916 -etotperatomref -113.3639518359 -totalforceref 1.114578 -totalstressref 6239.868141 -totaltimeref +72.75981 +etotref -1715.7501099576329580 +etotperatomref -107.2343818724 +totalforceref 0.004764 +totalstressref 123.790635 +totaltimeref +25.75123 diff --git a/examples/performance/P001_si32_pw/result.ref b/examples/performance/P001_si32_pw/result.ref index d65949439b..ba1da1081d 100644 --- a/examples/performance/P001_si32_pw/result.ref +++ b/examples/performance/P001_si32_pw/result.ref @@ -1,5 +1,5 @@ -etotref -3627.6469120976985323 -etotperatomref -113.3639660031 -totalforceref 0.009692 -totalstressref 6239.895699 -totaltimeref +1860.40001 +etotref -3431.5054414149067270 +etotperatomref -107.2345450442 +totalforceref 0.042611 +totalstressref 123.951439 +totaltimeref +1366.56584 diff --git a/examples/performance/P002_si64_pw/result.ref b/examples/performance/P002_si64_pw/result.ref index a10dd63804..6de5e18c87 100644 --- a/examples/performance/P002_si64_pw/result.ref +++ b/examples/performance/P002_si64_pw/result.ref @@ -1,5 +1,5 @@ -etotref -7255.2941542726566695 -etotperatomref -113.3639711605 -totalforceref 0.013417 -totalstressref 6239.886155 -totaltimeref +8252.98900 +etotref -6863.0172219627384038 +etotperatomref -107.2346440932 +totalforceref 0.019341 +totalstressref 123.835879 +totaltimeref +6643.84303 diff --git a/examples/performance/P003_si128_pw/INPUT b/examples/performance/P003_si128_pw/INPUT index e78f06b9e3..cc6da184f0 100644 --- a/examples/performance/P003_si128_pw/INPUT +++ b/examples/performance/P003_si128_pw/INPUT @@ -23,3 +23,4 @@ smearing_sigma 0.002 #Parameters (5.Mixing) mixing_type pulay mixing_beta 0.3 +ks_solver dav diff --git a/examples/performance/P003_si128_pw/result.ref b/examples/performance/P003_si128_pw/result.ref index 25887c8505..f6b5907e15 100644 --- a/examples/performance/P003_si128_pw/result.ref +++ b/examples/performance/P003_si128_pw/result.ref @@ -1,5 +1,5 @@ -etotref -14510.5886767288666306 -etotperatomref -113.3639740369 -totalforceref 1.106514 -totalstressref 6239.872761 -totaltimeref +10000.76349 +etotref -13726.0389580394294171 +etotperatomref -107.2346793597 +totalforceref 0.062868 +totalstressref 123.761229 +totaltimeref +9719.06052 diff --git a/examples/performance/P004_cu4_pw/result.ref b/examples/performance/P004_cu4_pw/result.ref index a739d6110b..772f9c7f77 100644 --- a/examples/performance/P004_cu4_pw/result.ref +++ b/examples/performance/P004_cu4_pw/result.ref @@ -1,5 +1,5 @@ -etotref -19875.7846192815777613 -etotperatomref -4968.9461548204 +etotref -19875.7846192829383654 +etotperatomref -4968.9461548207 totalforceref 0.000000 -totalstressref 60.602631 -totaltimeref +120.47825 +totalstressref 60.602616 +totaltimeref +96.08679 diff --git a/examples/performance/P005_Bi2Se2Cu2O2_pw/result.ref b/examples/performance/P005_Bi2Se2Cu2O2_pw/result.ref index cb17fe5584..3116ba6026 100644 --- a/examples/performance/P005_Bi2Se2Cu2O2_pw/result.ref +++ b/examples/performance/P005_Bi2Se2Cu2O2_pw/result.ref @@ -1,5 +1,5 @@ -etotref -15022.5604312389677943 +etotref -15022.5604312389768893 etotperatomref -1877.8200539049 totalforceref 0.215792 -totalstressref 76.635660 -totaltimeref +348.56245 +totalstressref 76.635663 +totaltimeref +328.86734 diff --git a/examples/performance/P006_Ge4As8_pw/result.ref b/examples/performance/P006_Ge4As8_pw/result.ref index 84476a08f6..3d9f2630c0 100644 --- a/examples/performance/P006_Ge4As8_pw/result.ref +++ b/examples/performance/P006_Ge4As8_pw/result.ref @@ -1,5 +1,5 @@ -etotref -9082.5979882514984638 -etotperatomref -756.8831656876 -totalforceref 5.127964 -totalstressref 38.590104 -totaltimeref +668.60615 +etotref -9082.5979151626761450 +etotperatomref -756.8831595969 +totalforceref 5.130351 +totalstressref 38.595166 +totaltimeref +590.74517 diff --git a/examples/performance/P007_H2O_pw/result.ref b/examples/performance/P007_H2O_pw/result.ref index 94954b4eb6..dbefa9da15 100644 --- a/examples/performance/P007_H2O_pw/result.ref +++ b/examples/performance/P007_H2O_pw/result.ref @@ -1,5 +1,5 @@ -etotref -465.7921742342700213 -etotperatomref -155.2640580781 -totalforceref 4.075102 -totalstressref 7.660366 -totaltimeref +51.57967 +etotref -465.7921100666392249 +etotperatomref -155.2640366889 +totalforceref 4.074840 +totalstressref 7.659440 +totaltimeref +40.33883 diff --git a/examples/performance/P008_C2H6O_pw/result.ref b/examples/performance/P008_C2H6O_pw/result.ref index cbb00db61c..e7243c19fc 100644 --- a/examples/performance/P008_C2H6O_pw/result.ref +++ b/examples/performance/P008_C2H6O_pw/result.ref @@ -1,5 +1,5 @@ -etotref -668.3404404298806867 -etotperatomref -74.2600489367 -totalforceref 1630.183895 -totalstressref 417.838715 -totaltimeref +180.83038 +etotref -668.3402371764498184 +etotperatomref -74.2600263529 +totalforceref 1630.188100 +totalstressref 417.840919 +totaltimeref +143.67683 diff --git a/examples/performance/P009_32H2O_pw/result.ref b/examples/performance/P009_32H2O_pw/result.ref index f42386a6c1..25941342dd 100644 --- a/examples/performance/P009_32H2O_pw/result.ref +++ b/examples/performance/P009_32H2O_pw/result.ref @@ -1,5 +1,5 @@ -etotref -14954.9763105721995089 -etotperatomref -155.7810032351 +etotref -14954.9763107068374666 +etotperatomref -155.7810032365 totalforceref 172.080343 -totalstressref 42.560713 -totaltimeref +2643.46596 +totalstressref 42.560716 +totaltimeref +2280.55581 diff --git a/examples/performance/P010_si2_pw/result.ref b/examples/performance/P010_si2_pw/result.ref index 7062f5b6c2..1f15d65673 100644 --- a/examples/performance/P010_si2_pw/result.ref +++ b/examples/performance/P010_si2_pw/result.ref @@ -1,5 +1,5 @@ -etotref -214.4687637733708243 -etotperatomref -107.2343818867 -totalforceref 0.000054 -totalstressref 123.765297 -totaltimeref +89.03162 +etotref -214.4687637747962015 +etotperatomref -107.2343818874 +totalforceref 0.000064 +totalstressref 123.766236 +totaltimeref +38.95909 diff --git a/examples/performance/P100_si16_lcao/INPUT b/examples/performance/P100_si16_lcao/INPUT index b5a1891087..025d4124b8 100644 --- a/examples/performance/P100_si16_lcao/INPUT +++ b/examples/performance/P100_si16_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P100_si16_lcao/result.ref b/examples/performance/P100_si16_lcao/result.ref index b9bb1c1121..4ea3b76e7d 100644 --- a/examples/performance/P100_si16_lcao/result.ref +++ b/examples/performance/P100_si16_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -1807.5070138263956778 -etotperatomref -112.9691883641 -totalforceref 1.203810 -totalstressref 5529.335181 -totaltimeref +95.59393 +etotref -1713.6080222933944697 +etotperatomref -107.1005013933 +totalforceref 0.000000 +totalstressref 135.323331 +totaltimeref +42.29293 diff --git a/examples/performance/P101_si32_lcao/INPUT b/examples/performance/P101_si32_lcao/INPUT index b5a1891087..025d4124b8 100644 --- a/examples/performance/P101_si32_lcao/INPUT +++ b/examples/performance/P101_si32_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P101_si32_lcao/result.ref b/examples/performance/P101_si32_lcao/result.ref index 41a3a2c1ab..94762d1ba7 100644 --- a/examples/performance/P101_si32_lcao/result.ref +++ b/examples/performance/P101_si32_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -3603.7509498928329776 -etotperatomref -112.6172171842 -totalforceref 62.470368 -totalstressref 5801.799226 -totaltimeref +163.12668 +etotref -3404.7663590699248743 +etotperatomref -106.3989487209 +totalforceref 2.688768 +totalstressref 473.654463 +totaltimeref +85.40579 diff --git a/examples/performance/P102_si64_lcao/INPUT b/examples/performance/P102_si64_lcao/INPUT index 03fd75edb0..7cc3e573ec 100644 --- a/examples/performance/P102_si64_lcao/INPUT +++ b/examples/performance/P102_si64_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P102_si64_lcao/result.ref b/examples/performance/P102_si64_lcao/result.ref index 6c7ef44b3a..e5157df385 100644 --- a/examples/performance/P102_si64_lcao/result.ref +++ b/examples/performance/P102_si64_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -7221.4320750347806097 -etotperatomref -112.8348761724 -totalforceref 41.580492 -totalstressref 5627.126740 -totaltimeref +370.35803 +etotref -6835.4920909464335637 +etotperatomref -106.8045639210 +totalforceref 1.653184 +totalstressref 261.065678 +totaltimeref +173.93919 diff --git a/examples/performance/P103_si128_lcao/INPUT b/examples/performance/P103_si128_lcao/INPUT index 03fd75edb0..7cc3e573ec 100644 --- a/examples/performance/P103_si128_lcao/INPUT +++ b/examples/performance/P103_si128_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P103_si128_lcao/result.ref b/examples/performance/P103_si128_lcao/result.ref index 3c01b66137..7f67afa8b3 100644 --- a/examples/performance/P103_si128_lcao/result.ref +++ b/examples/performance/P103_si128_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -14456.8057257793589088 -etotperatomref -112.9437947327 +etotref -13696.8043910998439969 +etotperatomref -107.0062843055 totalforceref 0.000000 -totalstressref 5539.185699 -totaltimeref +738.71161 +totalstressref 155.083293 +totaltimeref +320.39071 diff --git a/examples/performance/P104_si256_lcao/INPUT b/examples/performance/P104_si256_lcao/INPUT index 03fd75edb0..7cc3e573ec 100644 --- a/examples/performance/P104_si256_lcao/INPUT +++ b/examples/performance/P104_si256_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P104_si256_lcao/result.ref b/examples/performance/P104_si256_lcao/result.ref index 7094e30634..ef3e0f24dc 100644 --- a/examples/performance/P104_si256_lcao/result.ref +++ b/examples/performance/P104_si256_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -28916.8486261587931949 -etotperatomref -112.9564399459 -totalforceref 41.733120 -totalstressref 5552.436942 -totaltimeref +1671.58626 +etotref -27405.5761485654911667 +etotperatomref -107.0530318303 +totalforceref 6.629376 +totalstressref 176.550534 +totaltimeref +771.28715 diff --git a/examples/performance/P105_si512_lcao/INPUT b/examples/performance/P105_si512_lcao/INPUT index 03fd75edb0..7cc3e573ec 100644 --- a/examples/performance/P105_si512_lcao/INPUT +++ b/examples/performance/P105_si512_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P105_si512_lcao/result.ref b/examples/performance/P105_si512_lcao/result.ref index be8c3cedf2..ca95306948 100644 --- a/examples/performance/P105_si512_lcao/result.ref +++ b/examples/performance/P105_si512_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -57838.0048262096606777 -etotperatomref -112.9648531762 -totalforceref 27.819520 -totalstressref 5537.133126 -totaltimeref +2495.54754 +etotref -54826.8683728054093081 +etotperatomref -107.0837272906 +totalforceref 4.463724 +totalstressref 149.187719 +totaltimeref +2199.73302 diff --git a/examples/performance/P106_Cu4_lcao/INPUT b/examples/performance/P106_Cu4_lcao/INPUT index b5a1891087..025d4124b8 100644 --- a/examples/performance/P106_Cu4_lcao/INPUT +++ b/examples/performance/P106_Cu4_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P106_Cu4_lcao/result.ref b/examples/performance/P106_Cu4_lcao/result.ref index d7ec1c12b4..d2625f99ed 100644 --- a/examples/performance/P106_Cu4_lcao/result.ref +++ b/examples/performance/P106_Cu4_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -19875.2448992901554448 +etotref -19875.2448992900463054 etotperatomref -4968.8112248225 totalforceref 0.000000 totalstressref 72.135528 -totaltimeref +156.76066 +totaltimeref +57.86606 diff --git a/examples/performance/P107_Bi2Se2Cu2O2_lcao/INPUT b/examples/performance/P107_Bi2Se2Cu2O2_lcao/INPUT index 838be24d26..c6e40fe235 100644 --- a/examples/performance/P107_Bi2Se2Cu2O2_lcao/INPUT +++ b/examples/performance/P107_Bi2Se2Cu2O2_lcao/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P107_Bi2Se2Cu2O2_lcao/result.ref b/examples/performance/P107_Bi2Se2Cu2O2_lcao/result.ref index d5ea9a23e1..85f767ad1a 100644 --- a/examples/performance/P107_Bi2Se2Cu2O2_lcao/result.ref +++ b/examples/performance/P107_Bi2Se2Cu2O2_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -15020.6344480121842935 +etotref -15020.6344480118095817 etotperatomref -1877.5793060015 totalforceref 1.139258 totalstressref 156.898124 -totaltimeref +110.65718 +totaltimeref +78.13561 diff --git a/examples/performance/P108_Ge4As8_lcao/INPUT b/examples/performance/P108_Ge4As8_lcao/INPUT index 2ebb0f1d7c..a75dc63eb5 100644 --- a/examples/performance/P108_Ge4As8_lcao/INPUT +++ b/examples/performance/P108_Ge4As8_lcao/INPUT @@ -9,7 +9,7 @@ symmetry 1 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P108_Ge4As8_lcao/result.ref b/examples/performance/P108_Ge4As8_lcao/result.ref index 3bdfed700f..8d4ae4a46b 100644 --- a/examples/performance/P108_Ge4As8_lcao/result.ref +++ b/examples/performance/P108_Ge4As8_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -9080.5795395555705909 -etotperatomref -756.7149616296 -totalforceref 5.022775 -totalstressref 41.675650 -totaltimeref +160.08277 +etotref -9080.5795179151664342 +etotperatomref -756.7149598263 +totalforceref 5.022774 +totalstressref 41.675317 +totaltimeref +103.11197 diff --git a/examples/performance/P109_H2O_lcao/INPUT b/examples/performance/P109_H2O_lcao/INPUT index 8ec8614a1e..bd36200db0 100644 --- a/examples/performance/P109_H2O_lcao/INPUT +++ b/examples/performance/P109_H2O_lcao/INPUT @@ -8,7 +8,7 @@ symmetry 0 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 50 #Parameters (3.Basis) diff --git a/examples/performance/P109_H2O_lcao/result.ref b/examples/performance/P109_H2O_lcao/result.ref index 6b4c845249..4d914b7408 100644 --- a/examples/performance/P109_H2O_lcao/result.ref +++ b/examples/performance/P109_H2O_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -466.4793575980526157 -etotperatomref -155.4931191994 -totalforceref 6.402913 -totalstressref 1.876309 -totaltimeref +17.29480 +etotref -466.4793197268618314 +etotperatomref -155.4931065756 +totalforceref 6.402360 +totalstressref 1.876446 +totaltimeref +16.16343 diff --git a/examples/performance/P110_C2H6O_lcao/INPUT b/examples/performance/P110_C2H6O_lcao/INPUT index e819775f60..c1b236ac8a 100644 --- a/examples/performance/P110_C2H6O_lcao/INPUT +++ b/examples/performance/P110_C2H6O_lcao/INPUT @@ -8,7 +8,7 @@ symmetry 0 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 50 #Parameters (3.Basis) diff --git a/examples/performance/P110_C2H6O_lcao/result.ref b/examples/performance/P110_C2H6O_lcao/result.ref index ba7a9a98d2..3b86742854 100644 --- a/examples/performance/P110_C2H6O_lcao/result.ref +++ b/examples/performance/P110_C2H6O_lcao/result.ref @@ -1,5 +1,5 @@ -etotref -663.3344113028714446 -etotperatomref -73.7038234781 -totalforceref 1684.619805 -totalstressref 447.107239 -totaltimeref +42.52489 +etotref -663.3342180246568205 +etotperatomref -73.7038020027 +totalforceref 1684.622352 +totalstressref 447.108626 +totaltimeref +38.45041 diff --git a/examples/performance/P111_si32_lcaogo/INPUT b/examples/performance/P111_si32_lcaogo/INPUT index fe27f66355..2cebe4e7a0 100644 --- a/examples/performance/P111_si32_lcaogo/INPUT +++ b/examples/performance/P111_si32_lcaogo/INPUT @@ -9,7 +9,7 @@ pseudo_type upf201 #Parameters (2.Iteration) ecutwfc 100 -scf_thr 1e-8 +scf_thr 1e-6 scf_nmax 100 cal_force 1 cal_stress 1 diff --git a/examples/performance/P111_si32_lcaogo/result.ref b/examples/performance/P111_si32_lcaogo/result.ref index fca624dc89..f460149b50 100644 --- a/examples/performance/P111_si32_lcaogo/result.ref +++ b/examples/performance/P111_si32_lcaogo/result.ref @@ -1,5 +1,5 @@ -etotref -3603.7509498927283857 -etotperatomref -112.6172171841 -totalforceref 62.471712 -totalstressref 5803.159128 -totaltimeref +136.35690 +etotref -3404.7663590698443841 +etotperatomref -106.3989487209 +totalforceref 2.689920 +totalstressref 473.654463 +totaltimeref +76.73421 diff --git a/examples/performance/catch_properties.sh b/examples/performance/catch_properties.sh old mode 100755 new mode 100644 diff --git a/examples/performance/clean.sh b/examples/performance/clean.sh old mode 100755 new mode 100644 diff --git a/examples/performance/run.sh b/examples/performance/run.sh old mode 100755 new mode 100644 index 3ca42e2e70..bc878900b5 --- a/examples/performance/run.sh +++ b/examples/performance/run.sh @@ -4,7 +4,8 @@ #RUNNING SET abacus=abacus #ABACUS running path thread=1 #Thread number -ca=8 #accuracy for comparing energy, force, and stress +ca=6 #accuracy for comparing energy +cafs=3 #accuracy for comparing force, and stress #ncpu=8 #parallel core number in mpirun, or use the below value ncpu=$(cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}') #the CPU cores in current machine ForceRun=0 #if ForceRun = 0, before run a job, it will check the file result.log @@ -34,25 +35,28 @@ check_out() { outfile=$1 properties=$(awk '{print $1}' $outfile) for key in $properties; do - cal=$(grep "$key" $outfile | awk '{printf "%.'$ca'f\n",$2}') - ref=$(grep "$key" result.ref | awk '{printf "%.'$ca'f\n",$2}') - deviation=$(awk 'BEGIN {x='$ref';y='$cal';if (xtime.log | tee result.log + OMP_NUM_THREADS=$2 /usr/bin/time -v mpirun -n $1 $abacus 1>result.log 2>time.log else printf "**result.log is normal end, skip this job** " fi @@ -131,7 +135,7 @@ if [[ $DoAllExampleRun != 0 ]]; then done #sum the critical timing information - bash sumdat.sh allcase sum.dat + python3 sumdat.py -i allcase -o sum.dat echo "##AllExampleRun" >>sumall.dat cat sum.dat >>sumall.dat echo "" >>sumall.dat @@ -255,5 +259,10 @@ if [[ $failed -eq 0 ]]; then else echo "Error: $failed jobs failed." | tee $GITHUB_STEP_SUMMARY echo -e "$failedfile" + for ifile in `echo -e "$failedfile"`;do + echo "" | tee $GITHUB_STEP_SUMMARY + echo $ifile | tee $GITHUB_STEP_SUMMARY + cat $ifile/result.log | tee $GITHUB_STEP_SUMMARY + done exit 1 fi diff --git a/examples/performance/sumdat.py b/examples/performance/sumdat.py new file mode 100644 index 0000000000..56fd367cfe --- /dev/null +++ b/examples/performance/sumdat.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python +import os,sys +import numpy as np + +''' +This script is used to summaried the timing information +of the examples. +By default, the key with time ratio larger than 10% will +be printed out. +''' + +time_ratio = 0.1 +key_unnece_pw = ['plane_wave_line','opt_cells_pw','opt_ions_pw',''] #unnecessay time +key_needed_pw = [] #needed time +key_unnece_lcao = ['lcao_line'] +key_needed_lcao = [] + +allcase_file = "allcase" +outputfile = "sumall.dat" +logfile = 'result.log' +for i,key in enumerate(sys.argv): + if key == "-i": allcase_file = sys.argv[i+1] + elif key == "-o": outputf = sys.argv[i+1] + elif key == '-log': logfile = sys.argv[i+1] + +allcase = [] +if os.path.isfile(allcase_file): + with open(allcase_file) as f1: + for line in f1.readlines(): + if line.strip() != '' and line[0] not in ['#']: + allcase.append(line.strip()) +else: + print("Can not find file %s, exit!" % allcase_file) + sys.exit(1) + +title_pw = ['example','ks_solver','NAtoms','ecut_wfc','kpt_ibz','NProc','Niter','TotTime','1st-ScfTime','ScfTime/iter'] +title_lcao = ['example','ks_solver','NAtoms','ecut_wfc','kpt_ibz','NProc','Niter','TotTime','ScfTime/iter'] +added_time_pw = [] +added_time_lcao = [] +data_pw = [] +data_lcao = [] +alltime_pw = [] +alltime_lcao = [] +res_title = 'MaxRes(MB)' + +for case in allcase: + if not os.path.isdir(case): + print("ERROR: no folder %s" % case) + continue + if not os.path.isfile(case+'/result.log'): + print("ERROR: no file %s/result.log" % case) + continue + if not os.path.isfile(case+'/INPUT'): + print("ERROR: no file %s/INPUT" % case) + continue + + suffix = 'ABACUS' + with open(case+'/INPUT') as f1: + for i,line in enumerate(f1.readlines()): + if line.strip().lower()[:6] == 'suffix': + suffix = line.split()[1] + break + if not os.path.isfile("%s/OUT.%s/INPUT" % (case,suffix)): + print("ERROR: no file %s/OUT.%s/INPUT" % (case,suffix)) + continue + with open(case+'/OUT.%s/INPUT'%suffix) as f1: + for i,line in enumerate(f1.readlines()): + if line.strip() == '':continue + elif line.split()[0] == 'basis_type': + basis = line.split()[1] + elif line.split()[0] == 'ks_solver': + solver = line.split()[1] + elif line.split()[0] == 'calculation': + calculation = line.split()[1] + elif line.split()[0] == 'ecutwfc': + encut = float(line.split()[1]) + if not os.path.isfile("%s/OUT.%s/running_%s.log" % (case,suffix,calculation)): + print("ERROR: no file %s/OUT.%s/running_%s.log" % (case,suffix,calculation)) + continue + + natom = 0 + with open("%s/OUT.%s/running_%s.log" % (case,suffix,calculation)) as f1: + for i,line in enumerate(f1.readlines()): + if line[13:41] == "number of atom for this type": natom += int(line.split()[-1]) + elif line[4:23] == 'Processor Number is' : nproc = int(line.split()[-1]) + elif line[31:41] == 'nkstot_ibz': kpt_ibz = int(line.split()[-1]) + + scftime = [] + all_time = {} + with open('%s/%s' % (case,logfile)) as f1: lines = f1.readlines() + for i,line in enumerate(lines): + if line[1:5] == 'ITER': + for j in range(i+1,len(lines)): + if lines[j][1:3] in ['CG','DA','GE','GV']:scftime.append(float(lines[j].split()[-1])) + elif line[23:28] == 'total': + all_time['total'] = float(line.split()[1]) + for j in range(i+1,len(lines)): + if lines[j][1:5] == '----': break + else: + sline = lines[j].split() + if lines[j][23:44] == 'build_Nonlocal_mu_new': + key = lines[j][23:44] + elif lines[j][23:43] == 'cal_fvnl_dbeta_k_new': + key = lines[j][23:43] + elif lines[j][23:43] == 'grid_expansion_index': + key = lines[j][23:43] + elif lines[j][23:46] == 'build_Nonlocal_beta_new': + key = lines[j][23:46] + elif lines[j][23:31] == 'cal_dm_R': + key = lines[j][23:31] + elif len(lines[j].split()) != 7: + print("WARNING: the time of below line (%d) in %s/%s is ignored\n%s" % (j+1,case,logfile,lines[j])) + continue + else: + key = sline[1] + all_time[key] = float(sline[-2]) + if float(sline[-2]) >= time_ratio*100: + if basis == 'pw' and key not in added_time_pw+key_unnece_pw: + added_time_pw.append(key) + elif basis == 'lcao' and key not in added_time_lcao+key_unnece_lcao: + added_time_lcao.append(key) + if 'total' not in all_time: + print("ERROR: can not find key 'total' in %s/%s" % (case,logfile)) + continue + if len(scftime) == 0: + print("ERROR: can not find the time of scf in %s/%s" % (case,logfile)) + continue + if os.path.isfile("%s/time.log" % case): + with open("%s/time.log" % case) as f1: lines = f1.readlines() + for line in lines: + if 'Maximum resident set size (kbytes):' in line: + all_time[res_title] = float(line.split()[-1])/1024 + if basis == 'pw': + data_pw.append([case,solver,str(natom),'%.1f'%encut,str(kpt_ibz),str(nproc),str(len(scftime)),'%.2f'%all_time['total'],'%.2f'%scftime[0],'%.2f'%(np.array(scftime[1:]).sum()/(len(scftime)-1))]) + alltime_pw.append(all_time) + elif basis == 'lcao': + data_lcao.append([case,solver,str(natom),'%.1f'%encut,str(kpt_ibz),str(nproc),str(len(scftime)),'%.2f'%all_time['total'],'%.2f'%(np.array(scftime).sum()/(len(scftime)))]) + alltime_lcao.append(all_time) + +added_time_pw.append(res_title) +added_time_lcao.append(res_title) +title_pw += key_needed_pw + added_time_pw +title_lcao += key_needed_lcao + added_time_lcao + +for i in range(len(alltime_pw)): + for j in key_needed_pw: + if j in alltime_pw[i]: + data_pw[i].append('%.1f' % alltime_pw[i][j]) + else: + data_pw[i].append('-') + for j in added_time_pw: + if j in alltime_pw[i]: + data_pw[i].append('%.1f' % alltime_pw[i][j]) + else: + data_pw[i].append('-') +for i in range(len(alltime_lcao)): + for j in key_needed_lcao: + if j in alltime_lcao[i]: + data_lcao[i].append('%.1f' % alltime_lcao[i][j]) + else: + data_lcao[i].append('-') + for j in added_time_lcao: + if j in alltime_lcao[i]: + data_lcao[i].append('%.1f' % alltime_lcao[i][j]) + else: + data_lcao[i].append('-') + +def TableOutput(datalist,maxlen=18,digitmax=3): + 'datalist = [[col1,col2..],[col1,col2..]..]' + context = '' + ncolumn = len(datalist[0]) + collen = [] + for i in datalist[0]: + collen.append(len(str(i))) + for i in range(1,len(datalist)): + if len(datalist[i]) != ncolumn: + print("number of column in each line is not same, line %d" % i) + print(datalist[i]) + return 0 + for j in range(len(datalist[i])): + if type(datalist[i][j]) == float: lencol = len(("%."+str(digitmax)+"f")%datalist[i][j]) + else: lencol = len(str(datalist[i][j])) + if lencol > collen[j] : collen[j] = lencol + format1 = '' + for i in range(len(collen)): + length = str(collen[i]) if collen[i] < maxlen else str(maxlen) + format1 = format1 + '%' + length + '.' + length + 's ' + + for i in range(len(datalist)): + value = [] + for j in datalist[i]: + if type(j) in [float]:j = ("%."+str(digitmax)+"f") % j + value.append(str(j) if j != None else '') + context += format1 % tuple(value) + context += '\n' + return context + +with open(outputf,'w') as f1: + f1.write(TableOutput([title_pw] + data_pw)) + f1.write(TableOutput([title_lcao] + data_lcao)) diff --git a/examples/performance/sumdat.sh b/examples/performance/sumdat.sh deleted file mode 100755 index a1d8f27d55..0000000000 --- a/examples/performance/sumdat.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -allcase=allcase -outf=sum.dat - -if [[ $# > 0 ]];then - allcase=$1 - if [[ $# > 1 ]];then - outf=$2 - fi -fi - -test -f $outf && rm $outf - -#title -printf "%20s %15s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s\n" \ -"example" "ks_solver" "Natoms" "EneCut" "k-points" "NProc" "Niter" "TotTime" "1stSCF" "SCF/iter" \ -"Run%" "h_psi%" "vloc%" "vnl%" "stress%" "force%" "MaxResSize" > $outf - -for i in `cat $allcase`;do - if [[ ! -f $i/result.log ]];then - echo "Error: NO FILE $i/result.log" - continue - #printf "%20s" $i >> sum.dat - fi - - basis=`awk '$1=="basis_type"{print $2}' ${i}/INPUT | tr [A-Z] [a-z]` - solver=`grep ks_solver ${i}/OUT.*/INPUT | awk '{print $2}'` - #echo $basis - if [[ "$basis" == "pw" ]];then - natoms=`sed -n '/ELEMENT NATOM/,/----/'p ${i}/result.log| sed '1d;$d' | awk 'BEGIN{a=0}{a+=$2}END{print a}'` - encut=`grep "energy cutoff for wavefunc" ${i}/OUT.*/running*|awk '{print $NF}'` - kpt=`grep -A 1 "KPOINTS" ${i}/result.log | tail -1 | awk '{print $2}'` - nproc=`grep -A 1 "KPOINTS" ${i}/result.log | tail -1 | awk '{print $3}'` - niter=`grep "ELEC=" $i/OUT.*/running* | awk -F "=" '{print $3}'| awk -F "-" 'END{print $1}'` - tottime=`awk '$1=="total"{printf"%.2f", $2}' ${i}/result.log` - scf1=`awk '{if($1 ~ /^CG1$|^DAV1$|^GE1$|^GV1$/) {printf"%.2f", $NF}}' ${i}/result.log` - totalscf=`awk '$2=="Run"{print $3}' ${i}/result.log` - scfpiter=`awk 'BEGIN{printf"%.2f",(ARGV[1]-ARGV[2])/(ARGV[3]-1)}' $totalscf $scf1 $niter` - #fft=`awk '$2=="FFT3D"{printf"%.1f",$6}' ${i}/result.log` - hpsi=`awk '$2=="h_psi"{printf"%.1f",$6}' ${i}/result.log` - vloc=`awk '$2=="vloc"{printf"%.1f",$6}' ${i}/result.log` - vnl=`awk '$2=="vnl"{printf"%.1f",$6}' ${i}/result.log` - sc=`awk '$2=="Run"{printf"%.1f",$6}' ${i}/result.log` - #cbands=`awk '$2=="c_bands"{printf"%.1f",$6}' ${i}/result.log` - #sbands=`awk '$2=="sum_band"{printf"%.1f",$6}' ${i}/result.log` - stress=`awk '$2=="cal_stress"{printf"%.1f",$6}' ${i}/result.log` - force=`awk '$2=="cal_force_nl"{printf"%.1f",$6}' ${i}/result.log` - elif [[ "$basis" == "lcao" ]];then - natoms=`sed -n '/ELEMENT ORBITALS/,/----/'p ${i}/result.log| sed '1d;$d' | awk 'BEGIN{a=0}{a+=$4}END{print a}'` - encut=`grep "energy cutoff for wavefunc" ${i}/OUT.*/running*|awk '{print $NF}'` - kpt=`grep -A 1 "KPOINTS" ${i}/result.log | tail -1 | awk '{print $2}'` - nproc=`grep -A 1 "KPOINTS" ${i}/result.log | tail -1 | awk '{print $3}'` - niter=`grep "ELEC=" $i/OUT.*/running* | awk -F "=" '{print $3}'| awk -F "-" 'END{print $1}'` - tottime=`awk '$1=="total"{printf"%.2f", $2}' ${i}/result.log` - scf1=`awk '{if($1 ~ /^CG1$|^DAV1$|^GE1$|^GV1$/) {printf"%.2f", $NF}}' ${i}/result.log` - totalscf=`awk '$2=="Run"{print $3}' ${i}/result.log` - scfpiter=`awk 'BEGIN{printf"%.2f",(ARGV[1]-ARGV[2])/(ARGV[3]-1)}' $totalscf $scf1 $niter` - #fft="-" - hpsi="-" - vloc=`awk '$2=="vlocal"{printf"%.1f",$6}' ${i}/result.log` - vnl="-" - sc=`awk '$2=="Run"{printf"%.1f",$6}' ${i}/result.log` - #cbands=`awk '$2=="cal_bands"{printf"%.1f",$6}' ${i}/result.log` - #sbands=`awk '$2=="sum_bands"{printf"%.1f",$6}' ${i}/result.log` - stress=`awk '$2=="evaluate_vl_stress"{printf"%.1f",$6}' ${i}/result.log` - force=`awk '$2=="evaluate_vl_force"{printf"%.1f",$6}' ${i}/result.log` - else - echo "ERROR: UNKNOW basis type $basis" - continue - fi - maxres=`grep "Maximum resident set size" ${i}/time.log | awk '{print $NF}'` - - if [[ $solver == "" ]]; then solver="-";fi - if [[ $natoms == "" ]]; then natoms="-";fi - if [[ $encut == "" ]]; then encut="-";fi - if [[ $kpt == "" ]]; then kpt="-";fi - if [[ $nproc == "" ]]; then nproc="-";fi - if [[ $niter == "" ]]; then niter="-";fi - if [[ $tottime == "" ]]; then tottime="-";fi - if [[ $scf1 == "" ]]; then scf1="-";fi - if [[ $scfpiter == "" ]]; then scfpiter="-";fi - if [[ $sc == "" ]]; then sc="-";fi - if [[ $hpsi == "" ]]; then hpsi="-";fi - if [[ $vloc == "" ]]; then vloc="-";fi - if [[ $vnl == "" ]]; then vnl="-";fi - if [[ $stress == "" ]]; then stress="-";fi - if [[ $force == "" ]]; then force="-";fi - if [[ $maxres == "" ]]; then maxres="-";fi - - printf "%20s %15s %7s %8s %8s %6s %6s %8s %8s %8s %8s %8s %8s %8s %8s %8s %s\n" \ - $i $solver $natoms $encut $kpt $nproc $niter $tottime $scf1 $scfpiter $sc $hpsi $vloc $vnl \ - $stress $force $maxres >> $outf - -done From 406a460ba0769995bb6155fc94512c520a571a4e Mon Sep 17 00:00:00 2001 From: dyzheng Date: Thu, 1 Sep 2022 23:35:28 +0800 Subject: [PATCH 2/2] Feature: added optional value "-1" for variable "symmetry" for no time-reversal symmetry --- docs/input-main.md | 5 ++++- source/input.cpp | 6 +++--- source/input.h | 6 +++++- source/module_elecstate/test/updaterhok_pw_test.cpp | 4 ++-- source/module_elecstate/test/updaterhok_pw_test.h | 2 +- source/module_esolver/esolver_ks_lcao_elec.cpp | 2 +- source/module_esolver/esolver_ks_pw.cpp | 2 +- source/module_symmetry/symmetry.cpp | 2 +- source/module_symmetry/symmetry.h | 7 +++++-- source/src_io/read_txt_input-general.cpp | 2 +- source/src_io/write_input.cpp | 2 +- source/src_lcao/test/gamma_rho_mock.h | 2 +- source/src_lcao/test/gamma_rho_test.cpp | 4 ++-- source/src_pw/klist.cpp | 2 +- source/src_pw/symmetry_rho.cpp | 2 +- source/src_pw/test/sum_band_mock.h | 2 +- source/src_pw/test/sum_band_test.cpp | 4 ++-- 17 files changed, 33 insertions(+), 23 deletions(-) diff --git a/docs/input-main.md b/docs/input-main.md index 60be0721de..7545f7f6ba 100644 --- a/docs/input-main.md +++ b/docs/input-main.md @@ -158,7 +158,10 @@ This part of variables are used to control general system parameters. #### symmetry - **Type**: Integer -- **Description**: takes value 0 and 1, if set to 1, symmetry analysis will be performed to determine the type of Bravais lattice and associated symmetry operations. +- **Description**: takes value 1, 0 and -1. + - if set to 1, symmetry analysis will be performed to determine the type of Bravais lattice and associated symmetry operations. (point groups only) + - if set to 0, only time reversal symmetry would be considered in symmetry operations, which implied k point and -k point would be treated as one double weight k point. + - if set to -1, any symmetry will not be considered. - **Default**: 0 #### kpar diff --git a/source/input.cpp b/source/input.cpp index d2963224f0..9481426fd0 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -177,7 +177,7 @@ void Input::Default(void) ks_solver = "default"; // xiaohui add 2013-09-01 search_radius = -1.0; // unit: a.u. -1.0 has no meaning. search_pbc = true; - symmetry = false; + symmetry = 0; init_vel = false; symmetry_prec = 1.0e-5; // LiuXh add 2021-08-12, accuracy for symmetry cal_force = 0; @@ -2015,7 +2015,7 @@ void Input::Bcast() Parallel_Common::bcast_double(search_radius); Parallel_Common::bcast_bool(search_pbc); Parallel_Common::bcast_double(search_radius); - Parallel_Common::bcast_bool(symmetry); + Parallel_Common::bcast_int(symmetry); Parallel_Common::bcast_bool(init_vel); // liuyu 2021-07-14 Parallel_Common::bcast_double(symmetry_prec); // LiuXh add 2021-08-12, accuracy for symmetry Parallel_Common::bcast_int(cal_force); @@ -2451,7 +2451,7 @@ void Input::Check(void) else if (calculation == "md" || calculation == "sto-md") // mohan add 2011-11-04 { GlobalV::CALCULATION = calculation; - symmetry = false; + symmetry = 0; cal_force = 1; if (mdp.md_nstep == 0) { diff --git a/source/input.h b/source/input.h index b4b99fcbf4..ac437e52c1 100644 --- a/source/input.h +++ b/source/input.h @@ -46,7 +46,11 @@ class Input bool init_vel; // read velocity from STRU or not liuyu 2021-07-14 - bool symmetry; // turn on symmetry or not + /* symmetry level: + -1, no symmetry at all; + 0, only basic time reversal would be considered; + 1, point group symmetry would be considered*/ + int symmetry; double symmetry_prec; // LiuXh add 2021-08-12, accuracy for symmetry int kpar; // ecch pool is for one k point diff --git a/source/module_elecstate/test/updaterhok_pw_test.cpp b/source/module_elecstate/test/updaterhok_pw_test.cpp index a766a9b335..ad4d2db1f2 100644 --- a/source/module_elecstate/test/updaterhok_pw_test.cpp +++ b/source/module_elecstate/test/updaterhok_pw_test.cpp @@ -120,7 +120,7 @@ struct ENVPrepare std::string latname_; int ntype_; double pseudo_rcut_; - bool symm_flag_; + int symm_flag_; std::string kpoint_card_; int nspin_; bool gamma_only_; @@ -155,7 +155,7 @@ struct ENVPrepare latname_ = "sc"; ntype_ = 1; pseudo_rcut_ = 15.0; - symm_flag_ = false; + symm_flag_ = 0; kpoint_card_ = "./support/KPT"; nspin_ = 1; gamma_only_ = false; diff --git a/source/module_elecstate/test/updaterhok_pw_test.h b/source/module_elecstate/test/updaterhok_pw_test.h index 164c04b402..188b6223da 100644 --- a/source/module_elecstate/test/updaterhok_pw_test.h +++ b/source/module_elecstate/test/updaterhok_pw_test.h @@ -27,7 +27,7 @@ #include "module_pw/pw_basis_k.h" #include "src_parallel/parallel_pw.h" -bool ModuleSymmetry::Symmetry::symm_flag; +int ModuleSymmetry::Symmetry::symm_flag; LCAO_Orbitals::LCAO_Orbitals(){} LCAO_Orbitals::~LCAO_Orbitals(){} diff --git a/source/module_esolver/esolver_ks_lcao_elec.cpp b/source/module_esolver/esolver_ks_lcao_elec.cpp index 59a111e319..2b67f6fad6 100644 --- a/source/module_esolver/esolver_ks_lcao_elec.cpp +++ b/source/module_esolver/esolver_ks_lcao_elec.cpp @@ -516,7 +516,7 @@ namespace ModuleESolver } // add by jingan - if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag == 0) + if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1) { berryphase bp(this->LOWF); bp.Macroscopic_polarization(this->psi); diff --git a/source/module_esolver/esolver_ks_pw.cpp b/source/module_esolver/esolver_ks_pw.cpp index 52c72ca808..2acdfa42cf 100644 --- a/source/module_esolver/esolver_ks_pw.cpp +++ b/source/module_esolver/esolver_ks_pw.cpp @@ -779,7 +779,7 @@ namespace ModuleESolver // Do a Berry phase polarization calculation if required //======================================================= - if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag == 0) + if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1) { berryphase bp; bp.Macroscopic_polarization(this->psi); diff --git a/source/module_symmetry/symmetry.cpp b/source/module_symmetry/symmetry.cpp index 77171ff7cc..44ec91deb2 100644 --- a/source/module_symmetry/symmetry.cpp +++ b/source/module_symmetry/symmetry.cpp @@ -22,7 +22,7 @@ Symmetry::~Symmetry() } -bool Symmetry::symm_flag=false; +int Symmetry::symm_flag=0; void Symmetry::analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_running) diff --git a/source/module_symmetry/symmetry.h b/source/module_symmetry/symmetry.h index 6c9ebefc7c..0bfbf65073 100644 --- a/source/module_symmetry/symmetry.h +++ b/source/module_symmetry/symmetry.h @@ -13,8 +13,11 @@ class Symmetry : public Symmetry_Basic Symmetry(); ~Symmetry(); - // mohan add 2021-02-21 - static bool symm_flag; + //symmetry flag for levels + //-1 : no symmetry at all, k points would be total nks in KPT + //0 : only basic time-reversal symmetry is considered, point k and -k would fold to k + //1 : point group symmetry is considered + static int symm_flag; void analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_running); bool available; diff --git a/source/src_io/read_txt_input-general.cpp b/source/src_io/read_txt_input-general.cpp index 9a60b089e3..f878edcbfc 100644 --- a/source/src_io/read_txt_input-general.cpp +++ b/source/src_io/read_txt_input-general.cpp @@ -56,7 +56,7 @@ namespace Read_Txt_Input item.annotation = "turn symmetry on or off"; item.convert = [](const Input_Item &self) { - ModuleSymmetry::Symmetry::symm_flag = self.values[0].getb(); + ModuleSymmetry::Symmetry::symm_flag = self.values[0].geti(); }; this->add_item(item); } diff --git a/source/src_io/write_input.cpp b/source/src_io/write_input.cpp index a177fc1156..ee6b25c3ae 100644 --- a/source/src_io/write_input.cpp +++ b/source/src_io/write_input.cpp @@ -55,7 +55,7 @@ void Input::Print(const std::string &fn) const "nbands_istate", nbands_istate, "number of bands around Fermi level for istate calulation"); - ModuleBase::GlobalFunc::OUTP(ofs, "symmetry", symmetry, "turn symmetry on or off"); + ModuleBase::GlobalFunc::OUTP(ofs, "symmetry", symmetry, "the control of symmetry"); ModuleBase::GlobalFunc::OUTP(ofs, "init_vel", init_vel, "read velocity from STRU or not"); ModuleBase::GlobalFunc::OUTP(ofs, "symmetry_prec", diff --git a/source/src_lcao/test/gamma_rho_mock.h b/source/src_lcao/test/gamma_rho_mock.h index 20e3f72177..f05e70a372 100644 --- a/source/src_lcao/test/gamma_rho_mock.h +++ b/source/src_lcao/test/gamma_rho_mock.h @@ -77,7 +77,7 @@ Local_Orbital_wfc::~Local_Orbital_wfc() #endif -bool ModuleSymmetry::Symmetry::symm_flag; +int ModuleSymmetry::Symmetry::symm_flag; ModuleSymmetry::Symmetry::Symmetry() { diff --git a/source/src_lcao/test/gamma_rho_test.cpp b/source/src_lcao/test/gamma_rho_test.cpp index 403bd85865..a02c8d3fed 100644 --- a/source/src_lcao/test/gamma_rho_test.cpp +++ b/source/src_lcao/test/gamma_rho_test.cpp @@ -52,7 +52,7 @@ struct ENVPrepare bool init_vel_; std::string fixed_axes_; double pseudo_rcut_; - bool symm_flag_; + int symm_flag_; std::string kpoint_card_; int nspin_; bool gamma_only_; @@ -103,7 +103,7 @@ struct ENVPrepare init_vel_ = false; fixed_axes_ = "None"; pseudo_rcut_ = 15.0; - symm_flag_ = false; + symm_flag_ = 0; kpoint_card_ = "./support/KPT_Gamma"; nspin_ = 1; gamma_only_ = true; diff --git a/source/src_pw/klist.cpp b/source/src_pw/klist.cpp index b40f4666a0..0518e65833 100644 --- a/source/src_pw/klist.cpp +++ b/source/src_pw/klist.cpp @@ -83,7 +83,7 @@ void K_Vectors::set( // (2) //only berry phase need all kpoints including time-reversal symmetry! //if symm_flag is not set, only time-reversal symmetry would be considered. - if(!berryphase::berry_phase_flag) + if(!berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != -1) { this->ibz_kpoint(symm, ModuleSymmetry::Symmetry::symm_flag); if(ModuleSymmetry::Symmetry::symm_flag || is_mp) diff --git a/source/src_pw/symmetry_rho.cpp b/source/src_pw/symmetry_rho.cpp index ae9262a945..76ad32c6de 100644 --- a/source/src_pw/symmetry_rho.cpp +++ b/source/src_pw/symmetry_rho.cpp @@ -16,7 +16,7 @@ void Symmetry_rho::begin(const int &spin_now, const Charge_Broyden &CHR, const M { assert(spin_now < 4);//added by zhengdy-soc - if(!ModuleSymmetry::Symmetry::symm_flag) return; + if(ModuleSymmetry::Symmetry::symm_flag != 1) return; #ifdef __MPI // parallel version psymm(CHR.rho[spin_now], rho_basis, Pgrid, symm); diff --git a/source/src_pw/test/sum_band_mock.h b/source/src_pw/test/sum_band_mock.h index ea95a84534..5f67dda7a1 100644 --- a/source/src_pw/test/sum_band_mock.h +++ b/source/src_pw/test/sum_band_mock.h @@ -27,7 +27,7 @@ #include "module_pw/pw_basis.h" #include "src_parallel/parallel_pw.h" -bool ModuleSymmetry::Symmetry::symm_flag; +int ModuleSymmetry::Symmetry::symm_flag; LCAO_Orbitals::LCAO_Orbitals(){} LCAO_Orbitals::~LCAO_Orbitals(){} diff --git a/source/src_pw/test/sum_band_test.cpp b/source/src_pw/test/sum_band_test.cpp index 38b4d4c593..cbefd48787 100644 --- a/source/src_pw/test/sum_band_test.cpp +++ b/source/src_pw/test/sum_band_test.cpp @@ -94,7 +94,7 @@ struct ENVPrepare std::string latname_; int ntype_; double pseudo_rcut_; - bool symm_flag_; + int symm_flag_; std::string kpoint_card_; int nspin_; bool gamma_only_; @@ -128,7 +128,7 @@ struct ENVPrepare latname_ = "sc"; ntype_ = 1; pseudo_rcut_ = 15.0; - symm_flag_ = false; + symm_flag_ = 0; kpoint_card_ = "KPT"; nspin_ = 1; gamma_only_ = false;