parameters: (scf_data, ortho_ao, filename, wfn=None,
                    init=None, verbose=False)
return_statement: return nelec
docstring: Generate QMCPACK trial wavefunction.
  
      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.
      wfn : tuple
          User defined wavefunction. Not fully supported. Default None.
  
      Returns
      -------
      wfn : :class:`numpy.ndarray`
          Wavefunction as numpy array. Format depends on wavefunction.
docstring_summary: Generate QMCPACK trial wavefunction.
docstring_tokens: Generate QMCPACK trial wavefunction .
function: def write_wfn_mol(scf_data, ortho_ao, filename, wfn=None,
                    init=None, verbose=False):
      """Generate QMCPACK trial wavefunction.
  
      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.
      wfn : tuple
          User defined wavefunction. Not fully supported. Default None.
  
      Returns
      -------
      wfn : :class:`numpy.ndarray`
          Wavefunction as numpy array. Format depends on wavefunction.
      """
      ghf = False
      mol = scf_data['mol']
      nelec = mol.nelec
      nalpha, nbeta = nelec
      C = scf_data['mo_coeff']
      X = scf_data['X']
      rohf = scf_data.get('rohf', False)
      uhf = scf_data['isUHF']
      # For RHF only nalpha entries will be filled.
      if uhf:
          norb = C[0].shape[-1]
      else:
          norb = C.shape[-1]
      if wfn is None:
          wfn = numpy.zeros((1,norb,nalpha+nbeta), dtype=numpy.complex128)
          wfn_type = 'NOMSD'
          coeffs = numpy.array([1.0+0j])
          if ortho_ao:
              if X.shape[0] != X.shape[1]:
                  Xinv = scipy.linalg.pinv(X)
              else:
                  Xinv = scipy.linalg.inv(X)
              if uhf:
                  # We are assuming C matrix is energy ordered.
                  wfn[0,:,:nalpha] = numpy.dot(Xinv, C[0])[:,:nalpha]
                  wfn[0,:,nalpha:] = numpy.dot(Xinv, C[1])[:,:nbeta]
              elif rohf:
                  wfn[0,:,:nalpha] = numpy.dot(Xinv, C)[:,:nalpha]
                  wfn[0,:,nalpha:] = numpy.dot(Xinv, C)[:,:nbeta]
              else:
                  wfn[0,:,:nalpha] = numpy.dot(Xinv, C)[:,:nalpha]
          else:
              # Assuming we are working in MO basis, only works for RHF, ROHF trials.
              I = numpy.identity(C.shape[-1], dtype=numpy.float64)
              wfn[0,:,:nalpha] = I[:,:nalpha]
              if rohf:
                  wfn[0,:,nalpha:] = I[:,:nbeta]
              if uhf:
                  print(" # Warning: UHF trial wavefunction can only be used of "
                        "working in ortho AO basis.")
      write_qmcpack_wfn(filename, (numpy.array([1.0+0j]),wfn), uhf or rohf,
                        nelec, norb, verbose=verbose)
      return nelec
function_tokens: def write_wfn_mol ( scf_data , ortho_ao , filename , wfn = None , init = None , verbose = False ) : ghf = False mol = scf_data [ 'mol' ] nelec = mol . nelec nalpha , nbeta = nelec C = scf_data [ 'mo_coeff' ] X = scf_data [ 'X' ] rohf = scf_data . get ( 'rohf' , False ) uhf = scf_data [ 'isUHF' ] # For RHF only nalpha entries will be filled. if uhf : norb = C [ 0 ] . shape [ - 1 ] else : norb = C . shape [ - 1 ] if wfn is None : wfn = numpy . zeros ( ( 1 , norb , nalpha + nbeta ) , dtype = numpy . complex128 ) wfn_type = 'NOMSD' coeffs = numpy . array ( [ 1.0 + 0j ] ) if ortho_ao : if X . shape [ 0 ] != X . shape [ 1 ] : Xinv = scipy . linalg . pinv ( X ) else : Xinv = scipy . linalg . inv ( X ) if uhf : # We are assuming C matrix is energy ordered. wfn [ 0 , : , : nalpha ] = numpy . dot ( Xinv , C [ 0 ] ) [ : , : nalpha ] wfn [ 0 , : , nalpha : ] = numpy . dot ( Xinv , C [ 1 ] ) [ : , : nbeta ] elif rohf : wfn [ 0 , : , : nalpha ] = numpy . dot ( Xinv , C ) [ : , : nalpha ] wfn [ 0 , : , nalpha : ] = numpy . dot ( Xinv , C ) [ : , : nbeta ] else : wfn [ 0 , : , : nalpha ] = numpy . dot ( Xinv , C ) [ : , : nalpha ] else : # Assuming we are working in MO basis, only works for RHF, ROHF trials. I = numpy . identity ( C . shape [ - 1 ] , dtype = numpy . float64 ) wfn [ 0 , : , : nalpha ] = I [ : , : nalpha ] if rohf : wfn [ 0 , : , nalpha : ] = I [ : , : nbeta ] if uhf : print ( " # Warning: UHF trial wavefunction can only be used of " "working in ortho AO basis." ) write_qmcpack_wfn ( filename , ( numpy . array ( [ 1.0 + 0j ] ) , wfn ) , uhf or rohf , nelec , norb , verbose = verbose ) return nelec