Task: Fix pbc empty cell error (pyscf/pyscf#1821)

org: pyscf
repo: pyscf
pr_number: 1821
issue_title: Fix pbc empty cell error
issue_body: fix issue #1819.
resolved_issues: number: 1819
title: example-pbc: 40-customize_kpts_hamiltonian.py
body: Hi all,
I tried to run 40-customize_kpts_hamiltonian.py, but got the error:

'''
Traceback (most recent call last):
  File "/home/jtolle/Software/pyscf_master/pyscf/examples/pbc/40-customize_kpts_hamiltonian.py", line 33, in <module>
    cell = pbc.gto.M(
  File "/home/jtolle/Software/pyscf_master/pyscf/pyscf/pbc/gto/cell.py", line 73, in M
    cell.build(**kwargs)
  File "/home/jtolle/Software/pyscf_master/pyscf/pyscf/pbc/gto/cell.py", line 1522, in build
    atom_boundary_max = scaled_atom_coords[:,:self.dimension].max(axis=0)
  File "/home/jtolle/anaconda3/lib/python3.9/site-packages/numpy/core/_methods.py", line 41, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity
'''
(using the current master)

Using this commit: 71391d862c3db83db28553bbb1518acee466662c it works.
Would be great if someone can help to resolve this issue.
Best regards,
Johannes



Reference solution:
fix_patch: diff --git a/pyscf/pbc/gto/cell.py b/pyscf/pbc/gto/cell.py
index 8ae280772a..8fc38d5e61 100644
--- a/pyscf/pbc/gto/cell.py
+++ b/pyscf/pbc/gto/cell.py
@@ -1517,7 +1517,7 @@ def build(self, dump_input=True, parse_arg=mole.ARGPARSE,
             logger.info(self, 'low_dim_ft_type = %s', self.low_dim_ft_type)
             logger.info(self, 'Cell volume = %g', self.vol)
             # Check atoms coordinates
-            if self.dimension > 0:
+            if self.dimension > 0 and self.natm > 0:
                 scaled_atom_coords = np.linalg.solve(_a.T, self.atom_coords().T).T
                 atom_boundary_max = scaled_atom_coords[:,:self.dimension].max(axis=0)
                 atom_boundary_min = scaled_atom_coords[:,:self.dimension].min(axis=0)
diff --git a/pyscf/pbc/tools/pbc.py b/pyscf/pbc/tools/pbc.py
index 985c0f2550..447f752590 100644
--- a/pyscf/pbc/tools/pbc.py
+++ b/pyscf/pbc/tools/pbc.py
@@ -503,7 +503,7 @@ def get_lattice_Ls(cell, nimgs=None, rcut=None, dimension=None, discard=True):
     if rcut is None:
         rcut = cell.rcut
 
-    if dimension == 0 or rcut <= 0:
+    if dimension == 0 or rcut <= 0 or cell.natm == 0:
         return np.zeros((1, 3))
 
     a = cell.lattice_vectors()