Task: fix get_bands with k-point symmetry (pyscf/pyscf#1927)

org: pyscf
repo: pyscf
pr_number: 1927
issue_title: fix get_bands with k-point symmetry
issue_body: Fixes issue #1925.
resolved_issues: number: 1925
title: scf.KUKS(cell, kpts).getbands() has problems with symmetry 
body: Hello, 

I am using the scf.KUKS object to accelerate my simulations. But when I want to plot the band diagram, it has a problem with the length of different arrays in the KNumInt.eval_rho2 function. ao_kpts has a length of 27 (3x3x3) while mo_coeff_kpts and mo_occ_kpts both have a length of 4 due to symmetry. Am I doing something wrong or is it a bug in the pySCF code? 

```kmesh = [3, 3, 3]
kpts = cell.make_kpts(kmesh, space_group_symmetry=True, time_reversal_symmetry=True)

run_scf = True

if run_scf:
    PBE = scf.KUKS(cell, kpts)
    PBE = scf.addons.smearing_(PBE, sigma=.1, method='fermi')
    PBE.xc = 'PBE'
    PBE.verbose = 4
    PBE.init_guess_breaksym=False
    PBE.init_guess = "1e"
    PBE.chkfile = 'SrVO3_PBE.chk'
    PBE.run();

## Calculate PBE bands non-selfconsistently
run_bands = True

# Define high-symmetry k-paths:
hspoints = {
  "G": [0.0, 0.0, 0.0],
  "X": [0.5, 0.0, 0.0],
  "M": [0.5, 0.5, 0.0],
  "R": [0.5, 0.5, 0.5]}

G = hspoints['G']
X = hspoints['X']
M = hspoints['M']
R = hspoints['R']
kpath = [G, X, M, G, R, X]
band_kpts, kpath, sp_points = get_bandpath(kpath, cell.a, npoints=50);
# band_kpts = libkpts.make_kpts(cell, band_kpts, space_group_symmetry=True, time_reversal_symmetry=True)
# band_kpts = cell.get_scaled_kpts(band_kpts, kpts_in_ibz=True)
band_kpts = cell.get_abs_kpts(band_kpts);

print(band_kpts)


# nscf along high-symmetry path:
if run_bands:
    nscf = scf.KUKS(cell, kpts)
    nscf.__dict__.update(chkfile.load("SrVO3_PBE.chk", 'scf'))
    E_nk = nscf.get_bands(np.array(band_kpts), kpts = kpts)[0] #the error occurs at this line
    E_F = nscf.get_fermi()
```

Reference solution:
fix_patch: diff --git a/pyscf/pbc/dft/krks_ksymm.py b/pyscf/pbc/dft/krks_ksymm.py
index 087c0241f1..fb15bf6f40 100644
--- a/pyscf/pbc/dft/krks_ksymm.py
+++ b/pyscf/pbc/dft/krks_ksymm.py
@@ -42,14 +42,14 @@ def get_veff(ks, cell=None, dm=None, dm_last=0, vhf_last=0, hermi=1,
     ground_state = (isinstance(dm, np.ndarray) and dm.ndim == 3 and
                     kpts_band is None)
 
-    if kpts_band is None: kpts_band = kpts.kpts_ibz
-    dm_bz = dm
-    if ground_state:
-        if len(dm) != kpts.nkpts_ibz:
-            raise RuntimeError("Number of input density matrices does not \
-                               match the number of IBZ kpts: %d vs %d."
-                               % (len(dm), kpts.nkpts_ibz))
-        dm_bz = kpts.transform_dm(dm)
+    if kpts_band is None:
+        kpts_band = kpts.kpts_ibz
+
+    if len(dm) != kpts.nkpts_ibz:
+        raise KeyError('Shape of the input density matrix does not '
+                       'match the number of IBZ k-points: '
+                       f'{len(dm)} vs {kpts.nkpts_ibz}.')
+    dm_bz = kpts.transform_dm(dm)
 
     hybrid = ni.libxc.is_hybrid_xc(ks.xc)
 
diff --git a/pyscf/pbc/dft/kuks_ksymm.py b/pyscf/pbc/dft/kuks_ksymm.py
index 465b2943fb..eb02e674e9 100644
--- a/pyscf/pbc/dft/kuks_ksymm.py
+++ b/pyscf/pbc/dft/kuks_ksymm.py
@@ -41,14 +41,14 @@ def get_veff(ks, cell=None, dm=None, dm_last=0, vhf_last=0, hermi=1,
     # ndim = 4 : dm.shape = ([alpha,beta], nkpts, nao, nao)
     ground_state = (dm.ndim == 4 and dm.shape[0] == 2 and kpts_band is None)
 
-    if kpts_band is None: kpts_band = kpts.kpts_ibz
-    dm_bz = dm
-    if ground_state:
-        if len(dm[0]) != kpts.nkpts_ibz:
-            raise RuntimeError("Number of input density matrices does not \
-                               match the number of IBZ kpts: %d vs %d."
-                               % (len(dm[0]), kpts.nkpts_ibz))
-        dm_bz = kpts.transform_dm(dm)
+    if kpts_band is None:
+        kpts_band = kpts.kpts_ibz
+
+    if len(dm[0]) != kpts.nkpts_ibz:
+        raise KeyError('Shape of the input density matrix does not '
+                       'match the number of IBZ k-points: '
+                       f'{len(dm[0])} vs {kpts.nkpts_ibz}.')
+    dm_bz = kpts.transform_dm(dm)
 
     hybrid = ni.libxc.is_hybrid_xc(ks.xc)