parameters: (scf_data, ortho_ao, filename, rediag=True,
                    verbose=False, ndet_max=1, low=0.1, high=0.95)
return_statement: return nelec
docstring: Generate QMCPACK trial wavefunction for PBC simulation.
  
      Parameters
      ----------
      scf_data : dict
          Dictionary containing scf data extracted from pyscf checkpoint file.
      ortho_ao : bool
          Whether we are working in orthogonalised AO basis or not.
      filename : string
          HDF5 file path to store wavefunction to.
      rediag : bool
          Whether to rediagonalise Fock matrix to compute MO coeffs in
          orthoagonlised AO basis. Default: True.
      verbose : bool
          Print additional information. Default: False.
  
      Returns
      -------
      wfn : :class:`numpy.ndarray'
          Wavefunction as numpy array. Format depends on wavefunction.
docstring_summary: Generate QMCPACK trial wavefunction for PBC simulation.
docstring_tokens: Generate QMCPACK trial wavefunction for PBC simulation .
function: def write_wfn_pbc(scf_data, ortho_ao, filename, rediag=True,
                    verbose=False, ndet_max=1, low=0.1, high=0.95):
      """Generate QMCPACK trial wavefunction for PBC simulation.
  
      Parameters
      ----------
      scf_data : dict
          Dictionary containing scf data extracted from pyscf checkpoint file.
      ortho_ao : bool
          Whether we are working in orthogonalised AO basis or not.
      filename : string
          HDF5 file path to store wavefunction to.
      rediag : bool
          Whether to rediagonalise Fock matrix to compute MO coeffs in
          orthoagonlised AO basis. Default: True.
      verbose : bool
          Print additional information. Default: False.
  
      Returns
      -------
      wfn : :class:`numpy.ndarray'
          Wavefunction as numpy array. Format depends on wavefunction.
      """
      # Single determinant for the moment.
      cell = scf_data['cell']
      C = scf_data['mo_coeff']
      X = scf_data['X']
      mo_occ = numpy.array(scf_data['Xocc'])
      fock = scf_data['fock']
      nmo_pk = scf_data['nmo_pk']
      mo_energy = scf_data['mo_energy']
      nmo_tot = numpy.sum(nmo_pk)
      kpts = scf_data['kpts']
      nkpts = len(kpts)
      uhf = scf_data['isUHF']
      if len(fock.shape) == 3:
          fock = fock.reshape((1,)+fock.shape)
      if verbose:
          print(" # Generating QMCPACK trial wavefunction.")
          if uhf:
              print(" # UHF-like trial wavefunction.")
          else:
              print(" # RHF-like trial wavefunction.")
          print(" # k-points: ")
          for (i,k) in enumerate(kpts):
              print(" # {:d} {}".format(i,k))
      (eigs, orbs, ks, bands) = generate_orbitals(fock, X, nmo_pk, rediag, ortho_ao,
                                                  mo_energy, uhf, verbose=verbose)
      re_occ, trial, ndeg, srt, isrt = reoccupy(mo_occ, eigs, uhf, verbose,
                                                ndet_max=ndet_max, low=low,
                                                high=high)
      # mo_occs from pyscf is a list of numpy arrays of potentially different
      # length so can't just use numpy.sum.
      nalpha = int(round(sum(sum(occ) for occ in re_occ[0])))
      nbeta = int(round(sum(sum(occ) for occ in re_occ[1])))
      nelec = (nalpha, nbeta)
      if ndeg == 1 or ndet_max == 1:
          if verbose:
              print(" # Writing NOMSD single Slater determinant Trial.")
          wfn = create_wavefunction(orbs, re_occ, nmo_pk, nelec, uhf, verbose)
          coeff = numpy.array([1.0+0j])
          trial = (coeff, wfn)
      # For RHF only nalpha entries will be filled.
      orb_mat_a = scipy.linalg.block_diag(*orbs[0])
      print_eigenvalues(ks, bands, eigs, uhf, srt, nelec, verbose)
      if uhf:
          orb_mat_b = scipy.linalg.block_diag(*orbs[1])
      else:
          orb_mat_b = None
      write_qmcpack_wfn(filename, trial, uhf, (nalpha, nbeta), nmo_tot,
                        orbmat=(orb_mat_a, orb_mat_b), verbose=verbose)
      return nelec
function_tokens: def write_wfn_pbc ( scf_data , ortho_ao , filename , rediag = True , verbose = False , ndet_max = 1 , low = 0.1 , high = 0.95 ) : # Single determinant for the moment. cell = scf_data [ 'cell' ] C = scf_data [ 'mo_coeff' ] X = scf_data [ 'X' ] mo_occ = numpy . array ( scf_data [ 'Xocc' ] ) fock = scf_data [ 'fock' ] nmo_pk = scf_data [ 'nmo_pk' ] mo_energy = scf_data [ 'mo_energy' ] nmo_tot = numpy . sum ( nmo_pk ) kpts = scf_data [ 'kpts' ] nkpts = len ( kpts ) uhf = scf_data [ 'isUHF' ] if len ( fock . shape ) == 3 : fock = fock . reshape ( ( 1 , ) + fock . shape ) if verbose : print ( " # Generating QMCPACK trial wavefunction." ) if uhf : print ( " # UHF-like trial wavefunction." ) else : print ( " # RHF-like trial wavefunction." ) print ( " # k-points: " ) for ( i , k ) in enumerate ( kpts ) : print ( " # {:d} {}" . format ( i , k ) ) ( eigs , orbs , ks , bands ) = generate_orbitals ( fock , X , nmo_pk , rediag , ortho_ao , mo_energy , uhf , verbose = verbose ) re_occ , trial , ndeg , srt , isrt = reoccupy ( mo_occ , eigs , uhf , verbose , ndet_max = ndet_max , low = low , high = high ) # mo_occs from pyscf is a list of numpy arrays of potentially different # length so can't just use numpy.sum. nalpha = int ( round ( sum ( sum ( occ ) for occ in re_occ [ 0 ] ) ) ) nbeta = int ( round ( sum ( sum ( occ ) for occ in re_occ [ 1 ] ) ) ) nelec = ( nalpha , nbeta ) if ndeg == 1 or ndet_max == 1 : if verbose : print ( " # Writing NOMSD single Slater determinant Trial." ) wfn = create_wavefunction ( orbs , re_occ , nmo_pk , nelec , uhf , verbose ) coeff = numpy . array ( [ 1.0 + 0j ] ) trial = ( coeff , wfn ) # For RHF only nalpha entries will be filled. orb_mat_a = scipy . linalg . block_diag ( * orbs [ 0 ] ) print_eigenvalues ( ks , bands , eigs , uhf , srt , nelec , verbose ) if uhf : orb_mat_b = scipy . linalg . block_diag ( * orbs [ 1 ] ) else : orb_mat_b = None write_qmcpack_wfn ( filename , trial , uhf , ( nalpha , nbeta ) , nmo_tot , orbmat = ( orb_mat_a , orb_mat_b ) , verbose = verbose ) return nelec