From 252cb3bde03c9c8fd346e75599f8c447c68136ff Mon Sep 17 00:00:00 2001
From: Liu Renxi <75369672+Liu-RX@users.noreply.github.com>
Date: Thu, 2 Jan 2025 15:43:59 +0800
Subject: [PATCH] Enable the support of singular number of electrions in DeepKS
 orbital label

---
 .../module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp b/source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp
index 7207a64a27..8f2c4d8779 100644
--- a/source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp
+++ b/source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp
@@ -69,7 +69,7 @@ void LCAO_Deepks_Interface<TK, TR>::out_deepks_labels(const double& etot,
 
         if (PARAM.inp.deepks_bandgap)
         {
-            const int nocc = PARAM.inp.nelec / 2;
+            const int nocc = (PARAM.inp.nelec+1) / 2;
             std::vector<double> o_tot(nks);
             for (int iks = 0; iks < nks; ++iks)
             {