Handling Fragments

Molecular fragments

class molbe.pfrag.Frags(fsites, ifrag, edge=None, center=None, edge_idx=None, center_idx=None, efac=None, eri_file='eri_file.h5', centerf_idx=None, unrestricted=False)

Class for handling fragments in bootstrap embedding.

This class contains various functionalities required for managing and manipulating fragments for BE calculations.

__init__(fsites, ifrag, edge=None, center=None, edge_idx=None, center_idx=None, efac=None, eri_file='eri_file.h5', centerf_idx=None, unrestricted=False)

Constructor function for Frags class.

Parameters:
  • fsites (list) – list of AOs in the fragment (i.e. BE.fsites[i] or fragpart.fsites[i])

  • ifrag (int) – fragment index (∈ [0, BE.Nfrag])

  • edge (list, optional) – list of lists of edge site AOs for each atom in the fragment, by default None

  • center (list, optional) – list of fragment indices where edge site AOs are center site, by default None

  • edge_idx (list, optional) – list of lists of indices for edge site AOs within the fragment, by default None

  • center_idx (list, optional) – list of lists of indices within the fragment specified in center that points to the edge site AOs , by default None

  • efac (list, optional) – weight used for energy contributions, by default None

  • eri_file (str, optional) – two-electron integrals stored as h5py file, by default ‘eri_file.h5’

  • centerf_idx (list, optional) – indices of the center site atoms in the fragment, by default None

  • unrestricted (bool, optional) – unrestricted calculation, by default False

cons_fock(hf_veff, S, dm, eri_=None)

Construct the Fock matrix for the fragment.

Parameters:
  • hf_veff (numpy.ndarray) – Hartree-Fock effective potential.

  • S (numpy.ndarray) – Overlap matrix.

  • dm (numpy.ndarray) – Density matrix.

  • eri (numpy.ndarray, optional) – Electron repulsion integrals, by default None.

cons_h1(h1)

Construct the one-electron Hamiltonian for the fragment.

Parameters:

h1 (numpy.ndarray) – One-electron Hamiltonian matrix.

get_nsocc(S, C, nocc, ncore=0)

Get the number of occupied orbitals for the fragment.

Parameters:
  • S (numpy.ndarray) – Overlap matrix.

  • C (numpy.ndarray) – Molecular orbital coefficients.

  • nocc (int) – Number of occupied orbitals.

  • ncore (int, optional) – Number of core orbitals, by default 0.

Returns:

Projected density matrix.

Return type:

numpy.ndarray

scf(heff=None, fs=False, eri=None, dm0=None, unrestricted=False, spin_ind=None)

Perform self-consistent field (SCF) calculation for the fragment.

Parameters:
  • heff (numpy.ndarray, optional) – Effective Hamiltonian, by default None.

  • fs (bool, optional) – Flag for full SCF, by default False.

  • eri (numpy.ndarray, optional) – Electron repulsion integrals, by default None.

  • dm0 (numpy.ndarray, optional) – Initial density matrix, by default None.

  • unrestricted (bool, optional) – Specify if unrestricted calculation, by default False

  • spin_ind (int, optional) – Alpha (0) or beta (1) spin for unrestricted calculation, by default None

sd(lao, lmo, nocc, norb=None, return_orb_count=False)

Perform Schmidt decomposition for the fragment.

Parameters:
  • lao (numpy.ndarray) – Orthogonalized AOs

  • lmo (numpy.ndarray) – Local molecular orbital coefficients.

  • nocc (int) – Number of occupied orbitals.

  • norb (int, optional) – Specify number of bath orbitals. Used for UBE, where different number of alpha and beta orbitals Default is None, allowing orbitals to be chosen by threshold

  • return_orb_count (bool, optional) – Retrun the number of orbitals in each space, for UBE use/ Default is False

update_heff(u, cout=None, return_heff=False, only_chem=False)

Update the effective Hamiltonian for the fragment.

Periodic fragments

class kbe.pfrag.Frags(fsites, ifrag, edge=None, center=None, edge_idx=None, center_idx=None, efac=None, eri_file='eri_file.h5', unitcell_nkpt=1, ewald_ek=None, centerf_idx=None, unitcell=1)

Class for handling fragments in periodic bootstrap embedding.

This class contains various functionalities required for managing and manipulating fragments for periodic BE calculations.

__init__(fsites, ifrag, edge=None, center=None, edge_idx=None, center_idx=None, efac=None, eri_file='eri_file.h5', unitcell_nkpt=1, ewald_ek=None, centerf_idx=None, unitcell=1)

Constructor function for Frags class.

Parameters:
  • fsites (list) – list of AOs in the fragment (i.e. pbe.fsites[i] or fragpart.fsites[i])

  • ifrag (int) – fragment index (∈ [0, pbe.Nfrag])

  • edge (list, optional) – list of lists of edge site AOs for each atom in the fragment, by default None

  • center (list, optional) – list of fragment indices where edge site AOs are center site, by default None

  • edge_idx (list, optional) – list of lists of indices for edge site AOs within the fragment, by default None

  • center_idx (list, optional) – list of lists of indices within the fragment specified in center that points to the edge site AOs , by default None

  • efac (list, optional) – weight used for energy contributions, by default None

  • eri_file (str, optional) – two-electron integrals stored as h5py file, by default ‘eri_file.h5’

  • centerf_idx (list, optional) – indices of the center site atoms in the fragment, by default None

cons_fock(hf_veff, S, dm, eri_=None)

Construct the Fock matrix for the fragment.

Parameters:
  • hf_veff (numpy.ndarray) – Hartree-Fock effective potential.

  • S (numpy.ndarray) – Overlap matrix.

  • dm (numpy.ndarray) – Density matrix.

  • eri (numpy.ndarray, optional) – Electron repulsion integrals, by default None.

cons_h1(h1)

Construct the one-electron Hamiltonian for the fragment.

Parameters:

h1 (numpy.ndarray) – One-electron Hamiltonian matrix.

get_nsocc(S, C, nocc, ncore=0)

Get the number of occupied orbitals for the fragment.

Parameters:
  • S (numpy.ndarray) – Overlap matrix.

  • C (numpy.ndarray) – Molecular orbital coefficients.

  • nocc (int) – Number of occupied orbitals.

  • ncore (int, optional) – Number of core orbitals, by default 0.

Returns:

Projected density matrix.

Return type:

numpy.ndarray

scf(heff=None, fs=False, eri=None, pert_h=False, pert_list=None, save_chkfile=False, dm0=None)

Perform self-consistent field (SCF) calculation for the fragment.

Parameters:
  • heff (numpy.ndarray, optional) – Effective Hamiltonian, by default None.

  • fs (bool, optional) – Flag for full SCF, by default False.

  • eri (numpy.ndarray, optional) – Electron repulsion integrals, by default None.

  • dm0 (numpy.ndarray, optional) – Initial density matrix, by default None.

sd(lao, lmo, nocc, frag_type='autogen', cell=None, kpts=None, kmesh=None, h1=None)

Perform Schmidt decomposition for the fragment.

Parameters:
  • lao (numpy.ndarray) – Orthogonalized AOs

  • lmo (numpy.ndarray) – Local molecular orbital coefficients.

  • nocc (int) – Number of occupied orbitals.

  • cell (pyscf.pbc.gto.Cell) – PySCF pbc.gto.Cell object defining the unit cell and lattice vectors.

  • kpts (list of list of float) – k-points in the reciprocal space for periodic computations

  • kmesh (list of int) – Number of k-points in each lattice vector direction

update_heff(u, cout=None, return_heff=False, be_iter=None, no_chempot=False, tmp_add=False, only_chem=False)

Update the effective Hamiltonian for the fragment.