Task: Fix k-point symmetry adapted KS-DFT with Newton solver (pyscf/pyscf#1594)

org: pyscf
repo: pyscf
pr_number: 1594
issue_title: Fix k-point symmetry adapted KS-DFT with Newton solver
issue_body: Fixes issue #1462.
resolved_issues: number: 1462
title: Newton method for krks_ksymm fails
body: Hi,
Second order SCF solver can be used for k-symmetry adapted HF class but fails for DFT calculations.
```
import numpy
from pyscf.pbc import gto, scf, dft

cell = gto.M(
    a = numpy.asarray([[0.0, 2.6935121974, 2.6935121974], 
                       [2.6935121974, 0.0, 2.6935121974], 
                       [2.6935121974, 2.6935121974, 0.0]]),
    atom = '''Si  0.0000000000 0.0000000000 0.0000000000
              Si  1.3467560987 1.3467560987 1.3467560987''', 
    basis = 'gth-szv',
    pseudo = 'gth-pade',
    mesh = [24,24,24],
    verbose = 5,)

nk = [2,2,2]
kpts = cell.make_kpts(nk, 
                      space_group_symmetry=True, 
                      time_reversal_symmetry=True,
                      symmorphic=True)

kmf = scf.KRKS(cell, kpts)
kmf.xc = 'pbe'
kmf = kmf.newton()
kmf.kernel()
```
The calculation will fail because of not correctly recognizing KPoints class.



Reference solution:
fix_patch: diff --git a/pyscf/pbc/dft/numint.py b/pyscf/pbc/dft/numint.py
index a8ca103c28..74ba8349fe 100644
--- a/pyscf/pbc/dft/numint.py
+++ b/pyscf/pbc/dft/numint.py
@@ -27,6 +27,7 @@
 from pyscf.dft.gen_grid import NBINS, CUTOFF, ALIGNMENT_UNIT
 from pyscf.pbc.dft.gen_grid import make_mask, BLKSIZE
 from pyscf.pbc.lib.kpts_helper import member, is_zero
+from pyscf.pbc.lib.kpts import KPoints
 
 
 def eval_ao(cell, coords, kpt=numpy.zeros(3), deriv=0, relativity=0, shls_slice=None,
@@ -554,6 +555,8 @@ def nr_rks_fxc(ni, cell, grids, xc_code, dm0, dms, relativity=0, hermi=0,
     '''
     if kpts is None:
         kpts = numpy.zeros((1,3))
+    if isinstance(kpts, KPoints):
+        kpts = kpts.kpts_ibz
     xctype = ni._xc_type(xc_code)
     if xctype == 'LDA':
         ao_deriv = 0
@@ -843,6 +846,10 @@ def cache_xc_kernel(ni, cell, grids, xc_code, mo_coeff, mo_occ, spin=0,
     '''
     if kpts is None:
         kpts = numpy.zeros((1,3))
+    if isinstance(kpts, KPoints):
+        mo_coeff = kpts.transform_mo_coeff(mo_coeff)
+        mo_occ = kpts.transform_mo_occ(mo_occ)
+        kpts = kpts.kpts
     xctype = ni._xc_type(xc_code)
     if xctype == 'GGA':
         ao_deriv = 1