lumeq.embedding package
Submodules
lumeq.embedding.fragment_entangle module
- class EmbeddingMeanField(mf, frgm_list, method='pipek_mezey', extra_orb=0, min_weight=0.8)[source]
Bases:
objectEmbedding system class of mean field ground-state
- emb_basis_dmet(mf, ifrgm, embed_method=0)[source]
Build embedding basis for a given fragment
- Parameters:
mf – Converged PySCF mean-field object. This should be the same object passed during initialization.
ifrgm (int) – Index of the fragment chosen as the impurity.
embed_method (int) – Embedding method selector.
0corresponds to DMET.
- Returns:
Embedding-orbital coefficients in the AO basis and density matrix in the EO basis.
- Return type:
tuple
- fragment_localization(mf, frgm_list, method='pipek_mezey', extra_orb=0, min_weight=0.8)[source]
Get the localized orbitals and density matrix for fragment analysis
- Parameters:
mf – PySCF mean-field object such as HF/DFT.
frgm_list (list) – Atom indices in each fragment.
method (str) – Localization method.
extra_orb (int) – Number of virtual orbitals added in the density-matrix build.
min_weight (float) – Threshold for the fragment LO partition.
- Returns:
Localized-orbital basis coefficients
C^{AO,LO}. dm_lo_in_ao: Density matrix in the LO basis. frgm_lo_idx (list): Local-orbital indices for each fragment.- Return type:
coeff_lo_in_ao
- get_embedding_energy(mf, coeff_eo_in_ao, dm_eo_in_ao, neo_imp, extra_orb=0)[source]
Calculate electronic energy of the impurity in the embedding orbital basis
- Parameters:
mf – Converged PySCF mean-field object.
coeff_eo_in_ao – Embedding-orbital coefficients
C^{AO,EO}in AO basis.dm_eo_in_ao – Density matrix
P^{EO,EO}in the EO basis.neo_imp (int) – Number of impurity embedding orbitals.
extra_orb (int) – Number of virtual MO orbitals in the top-level SCF.
- Returns:
Embedded-system energy, occupied EO count, EO energies, and EO coefficients.
- Return type:
tuple
- get_embedding_orbital(dm_lo_in_ao, coeff_lo_in_ao, ovlp_ao, imp_lo_idx, env_lo_idx, method=0, threshold=1e-12)[source]
Embedding orbital construction from the density matrix in localized orbital basis
- Parameters:
dm_lo_in_ao (numpy.ndarray) – Density matrix in the localized-orbital basis.
coeff_lo_in_ao (numpy.ndarray) – Localized-orbital basis coefficients.
ovlp_ao (numpy.ndarray) – Overlap matrix in the AO basis.
imp_lo_idx (list) – Impurity localized-orbital indices from
frgm_lo_idx.env_lo_idx (list) – Environment localized-orbital indices from
frgm_lo_idx.method (int) – Bath-orbital selection method.
0uses singular vectors of the off-diagonal block of the density matrix in the LO basis, and1uses eigenvectors of the environment diagonal block of the density matrix in the LO basis.threshold (float) – Cutoff for singular values or eigenvalues.
- Returns:
Embedding-orbital coefficients
C^{AO,EO}in the AO basis and density matrixP^{EO,EO}in the EO basis.- Return type:
tuple
- get_embedding_system(mf, frgm_idx, ifrgm=0, extra_orb=0)[source]
Embedding energy calculation for a given fragment
- Parameters:
mf – PySCF mean-field object.
frgm_idx (list) – Atomic indices for each fragment.
ifrgm (int) – Fragment index treated as the impurity. If
-1, loop over all fragments.extra_orb (int) – Number of extra orbitals to include in the density matrix.
- Returns:
- For a chosen fragment, returns the values from
get_embedding_energy. Otherwise computes the whole-system energy.
- Return type:
tuple or None
- get_localized_orbital_rdm(coeff_lo_in_ao, coeff_mo_in_ao, ovlp_ao, nocc, scale=2.0, extra_orb=0)[source]
Compute total density matrix alpha+beta in localized orbital (LO) basis S^{1/2} P S^{1/2} = C_lo^T S C_mo occ C_mo occ^T S C_lo
- Parameters:
coeff_lo_in_ao – LO basis coefficients
C^{AO,LO}.coeff_mo_in_ao – MO coefficients
C^{AO,MO}in AO basis.ovlp_ao – AO overlap matrix
S.nocc (int) – Number of occupied orbitals.
scale (float) – Scaling factor,
2for the restricted case.extra_orb (int) – Number of virtual orbitals added to the density matrix.
- Returns:
Density matrix
P^{LO,LO}in the LO basis.- Return type:
numpy.ndarray
lumeq.embedding.mol_lo_tools module
- lo_weight_on_ao(mol: Mole = None, coeff_ao_lo: ndarray = None, ovlp_ao: ndarray = None)[source]
A function to calculate the weight of local orbitals on atomic orbitals.
- Parameters:
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
ovlp_ao (numpy.ndarray) – The overlap matrix of atomic orbitals.
- Returns:
The weight of local orbitals on atomic orbitals.
- Return type:
w2_ao_lo (numpy.ndarray)
- lo_weight_on_atom(mol: Mole, coeff_ao_lo: ndarray = None, ovlp_ao: ndarray = None)[source]
A function to calculate the weight of local orbitals on atomic orbitals.
- Parameters:
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
ovlp_ao (numpy.ndarray) – The overlap matrix of atomic orbitals.
- Returns:
The weight of local orbitals on each atom.
- Return type:
w2_atm_lo (numpy.ndarray)
- lo_weight_on_frag(frag_atms_list: list, mol: Mole, coeff_ao_lo: ndarray = None, ovlp_ao: ndarray = None)[source]
A function to calculate the weight of local orbitals on fragments.
- Parameters:
frag_atms_list (list) – A list of atoms in each fragment.
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
ovlp_ao (numpy.ndarray) – The overlap matrix of atomic orbitals.
- Returns:
The weight of local orbitals on each fragment.
- Return type:
w2_frag_lo (numpy.ndarray)
- partition_lo_to_atms(mol: Mole = None, coeff_ao_lo: ndarray = None, w2_atm_lo: ndarray = None, min_weight: float = 0.9)[source]
A function to partition local orbitals to atoms.
- Parameters:
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
w2_atm_lo (numpy.ndarray) – The weight of local orbitals on each atom.
min_weight (float) – The minimum weight of local orbitals on each atom. If the max weight is smaller than min_weight, the local orbital will not be assigned to the atom.
- Returns:
The list of local orbital indices on each atom.
- Return type:
lo_idx_on_atm_list (list)
- partition_lo_to_frags(frag_atms_list: list, mol: Mole = None, coeff_ao_lo: ndarray = None, w2_frag_lo: ndarray = None, min_weight: float = 0.9)[source]
A function to partition local orbitals to fragments.
- Parameters:
frag_atms_list (list) – The list of atoms in each fragment.
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
w2_frag_lo (numpy.ndarray) – The weight of local orbitals on each atom.
min_weight (float) – The minimum weight of local orbitals on each atom. If the max weight is smaller than min_weight, the local orbital will not be assigned to the atom.
- Returns:
The list of local orbital indices on each fragment.
- Return type:
lo_idx_on_frag_list (list)
- partition_lo_to_imps(frag_atms_list: list, mol: Mole = None, coeff_ao_lo: ndarray = None, w2_frag_lo: ndarray = None, min_weight: float = 0.9)
A function to partition local orbitals to fragments.
- Parameters:
frag_atms_list (list) – The list of atoms in each fragment.
mol (pyscf.gto.Mole) – The molecule object.
coeff_ao_lo (numpy.ndarray) – The coefficient matrix to transform atomic orbitals to local orbitals.
w2_frag_lo (numpy.ndarray) – The weight of local orbitals on each atom.
min_weight (float) – The minimum weight of local orbitals on each atom. If the max weight is smaller than min_weight, the local orbital will not be assigned to the atom.
- Returns:
The list of local orbital indices on each fragment.
- Return type:
lo_idx_on_frag_list (list)