vayesta.core.qemb

Submodules

vayesta.core.qemb.corrfunc

Expectation values for quantum embedding methods.

vayesta.core.qemb.corrfunc.get_corrfunc_mf(emb, kind, dm1=None, atoms=None, projection='sao', orbital_filter=None)[source]

dm1 in MO basis

vayesta.core.qemb.corrfunc.get_corrfunc(emb, kind, dm1=None, dm2=None, atoms=None, projection='sao', dm2_with_dm1=None, use_symmetry=True, orbital_filter=None)[source]

Get expectation values <P(A) S_z P(B) S_z>, where P(X) are projectors onto atoms X.

TODO: MPI

Parameters:

atoms (list[int] or list[list[int]], optional) – Atom indices for which the spin-spin correlation function should be evaluated. If set to None (default), all atoms of the system will be considered. If a list is given, all atom pairs formed from this list will be considered. If a list of two lists is given, the first list contains the indices of atom A, and the second of atom B, for which <Sz(A) Sz(B)> will be evaluated. This is useful in cases where one is only interested in the correlation to a small subset of atoms. Default: None

Returns:

corr – Atom projected correlation function.

Return type:

array(N,M)

vayesta.core.qemb.corrfunc.get_corrfunc_unrestricted(emb, kind, dm1=None, dm2=None, atoms=None, projection='sao', dm2_with_dm1=None, use_symmetry=True, orbital_filter=None)[source]

Get expectation values <P(A) S_z P(B) S_z>, where P(X) are projectors onto atoms X.

TODO: MPI

Parameters:

atoms (list[int] or list[list[int]], optional) – Atom indices for which the spin-spin correlation function should be evaluated. If set to None (default), all atoms of the system will be considered. If a list is given, all atom pairs formed from this list will be considered. If a list of two lists is given, the first list contains the indices of atom A, and the second of atom B, for which <Sz(A) Sz(B)> will be evaluated. This is useful in cases where one is only interested in the correlation to a small subset of atoms. Default: None

Returns:

corr – Atom projected correlation function.

Return type:

array(N,M)

vayesta.core.qemb.fragment

vayesta.core.qemb.fragment.get_fragment_mpi_rank(*args)
class vayesta.core.qemb.fragment.Options(bath_options: dict = None, bosonic_bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, match_cluster_fock: bool = None, auxiliary: bool = False, coupled_fragments: list = <factory>, sym_factor: float = 1.0)[source]

Bases: OptionsBase

bath_options: dict = None
bosonic_bath_options: dict = None
solver_options: dict = None
store_eris: bool = None
dm_with_frozen: bool = None
screening: str | None = None
match_cluster_fock: bool = None
auxiliary: bool = False
coupled_fragments: list
sym_factor: float = 1.0
asdict(deepcopy=False)
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
items()
keys()
replace(**kwargs)
update(**kwargs)
values()
class vayesta.core.qemb.fragment.Fragment(base, fid, name, c_frag, c_env, solver=None, atoms=None, aos=None, active=True, sym_parent=None, sym_op=None, mpi_rank=0, flags=None, log=None, **kwargs)[source]

Bases: object

class Options(bath_options: dict = None, bosonic_bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, match_cluster_fock: bool = None, auxiliary: bool = False, coupled_fragments: list = <factory>, sym_factor: float = 1.0)

Bases: OptionsBase

asdict(deepcopy=False)
auxiliary: bool = False
bath_options: dict = None
bosonic_bath_options: dict = None
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
dm_with_frozen: bool = None
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
items()
keys()
match_cluster_fock: bool = None
replace(**kwargs)
screening: str | None = None
solver_options: dict = None
store_eris: bool = None
sym_factor: float = 1.0
update(**kwargs)
values()
coupled_fragments: list
class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: int | NoneType = None)[source]

Bases: object

is_envelop: bool = True
is_secfrag: bool = False
bath_parent_fragment_id: int | None = None
class Results(fid: int = None, converged: bool = None, e_corr: float = None, e_corr_rpa: float = None, wf: vayesta.core.types.wf.wf.WaveFunction = None, pwf: vayesta.core.types.wf.wf.WaveFunction = None, moms: tuple = None)[source]

Bases: object

fid: int = None
converged: bool = None
e_corr: float = None
e_corr_rpa: float = None
wf: WaveFunction = None
pwf: WaveFunction = None
moms: tuple = None
log_info()[source]
property mol
property mf
property n_frag

Number of fragment orbitals.

property nelectron

Number of mean-field electrons.

trimmed_name(length=10, add_dots=True)[source]

Fragment name trimmed to a given maximum length.

property id_name

Use this whenever a unique name is needed (for example to open a separate file for each fragment).

change_options(**kwargs)[source]
property hamil
get_overlap(key)[source]

Get overlap between cluster orbitals, fragment orbitals, or MOs.

The return value is cached but not copied; do not modify the array in place without creating a copy!

Examples: >>> s = self.get_overlap(‘cluster|mo’) >>> s = self.get_overlap(‘cluster|frag’) >>> s = self.get_overlap(‘mo[occ]|cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]|cluster[vir]’)

get_coeff_env()[source]
property results
property cluster
reset(reset_bath=True, reset_cluster=True, reset_eris=True, reset_inactive=True)[source]
get_fragments_with_overlap(tol=1e-08, **kwargs)[source]

Get list of fragments which overlap both in occupied and virtual space.

couple_to_fragment(frag)[source]
couple_to_fragments(frags)[source]
get_fragment_mf_energy()[source]

Calculate the part of the mean-field energy associated with the fragment.

Does not include nuclear-nuclear repulsion!

property contributes

True if fragment contributes to expectation values, else False.

get_fragment_projector(coeff, c_proj=None, inverse=False)[source]

Projector for one index of amplitudes local energy expression.

Cost: N^2 if O(1) coeffs , N^3 if O(N) coeffs

Parameters:
  • coeff (ndarray, shape(n(AO), N)) – Occupied or virtual orbital coefficients.

  • inverse (bool, optional) – Return 1-p instead. Default: False.

Returns:

p – Projection matrix.

Return type:

(n, n) array

get_mo_occupation(*mo_coeff, dm1=None)[source]

Get mean-field occupation numbers (diagonal of 1-RDM) of orbitals.

Parameters:

mo_coeff (ndarray, shape(N, M)) – Orbital coefficients.

Returns:

occup – Occupation numbers of orbitals.

Return type:

ndarray, shape(M)

canonicalize_mo(*mo_coeff, fock=None, eigvals=False, sign_convention=True)[source]

Diagonalize Fock matrix within subspace.

TODO: move to Embedding class

Parameters:
  • *mo_coeff (ndarrays) – Orbital coefficients.

  • eigenvalues (ndarray) – Return MO energies of canonicalized orbitals.

Returns:

  • mo_canon (ndarray) – Canonicalized orbital coefficients.

  • rot (ndarray) – Rotation matrix: np.dot(mo_coeff, rot) = mo_canon.

diagonalize_cluster_dm(*mo_coeff, dm1=None, norm=2, tol=0.0001)[source]

Diagonalize cluster (fragment+bath) DM to get fully occupied and virtual orbitals.

Parameters:
  • *mo_coeff (array or list of arrays) – Orbital coefficients. If multiple are given, they will be stacked along their second dimension.

  • dm1 (array, optional) – Mean-field density matrix, used to separate occupied and virtual cluster orbitals. If None, self.mf.make_rdm1() is used. Default: None.

  • tol (float, optional) – If set, check that all eigenvalues of the cluster DM are close to 0 or 2, with the tolerance given by tol. Default= 1e-4.

Returns:

  • c_cluster_occ ((n(AO), n(occ cluster)) array) – Occupied cluster orbital coefficients.

  • c_cluster_vir ((n(AO), n(vir cluster)) array) – Virtual cluster orbital coefficients.

project_ref_orbitals(c_ref, c)[source]

Project reference orbitals into available space in new geometry.

The projected orbitals will be ordered according to their eigenvalues within the space.

Parameters:
  • c (ndarray) – Orbital coefficients.

  • c_ref (ndarray) – Orbital coefficients of reference orbitals.

copy(fid=None, name=None, **kwargs)[source]

Create copy of fragment, without adding it to the fragments list.

add_tsymmetric_fragments(tvecs, symtol=1e-06)[source]
Parameters:
  • tvecs (array(3) of integers) – Each element represent the number of translation vector corresponding to the a0, a1, and a2 lattice vectors of the cell.

  • symtol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of T-symmetry related fragments. These will be automatically added to base.fragments and have the attributes sym_parent and sym_op set.

Return type:

list

get_symmetry_parent()[source]
get_symmetry_operation()[source]
get_symmetry_generations(maxgen=None, **filters)[source]
get_symmetry_children(maxgen=None, **filters)[source]
get_symmetry_tree(maxgen=None, **filters)[source]

Returns a recursive tree:

[(x, [children of x]), (y, [children of y]), …]

loop_symmetry_children(arrays=None, axes=None, symtree=None, maxgen=None, include_self=False)[source]

Loop over all symmetry related fragments, including children of children, etc.

Parameters:
  • arrays (ndarray or list[ndarray], optional) – If arrays are passed, the symmetry operation of each symmetry related fragment will be applied to this array along the axis given in axes.

  • axes (list[int], optional) – List of axes, along which the symmetry operation is applied for each element of arrays. If None, the first axis will be used.

property n_symmetry_children

Includes children of children, etc.

property symmetry_factor

Includes children of children, etc.

get_symmetry_error(frag, dm1=None)[source]

Get translational symmetry error between two fragments.

make_bath()[source]
make_cluster()[source]
make_bosonic_bath_target()[source]

Get the target space for bosonic bath orbitals. This can either be the DMET cluster or the full space, and can include a projection onto the fragment.

make_bosonic_cluster(m0_target)[source]

Set bosonic component of the cluster.

get_fragment_mo_energy(c_active=None, fock=None)[source]

Returns approximate MO energies, using the the diagonal of the Fock matrix.

Parameters:
  • c_active (array, optional) –

  • fock (array, optional) –

get_fragment_dmet_energy(dm1=None, dm2=None, h1e_eff=None, hamil=None, part_cumulant=True, approx_cumulant=True)[source]

Get fragment contribution to whole system DMET energy from cluster DMs.

After fragment summation, the nuclear-nuclear repulsion must be added to get the total energy!

Parameters:
  • dm1 (array, optional) – Cluster one-electron reduced density-matrix in cluster basis. If None, self.results.dm1 is used. Default: None.

  • dm2 (array, optional) – Cluster two-electron reduced density-matrix in cluster basis. If None, self.results.dm2 is used. Default: None.

  • hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.

  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

Returns:

e_dmet – Electronic fragment DMET energy.

Return type:

float

make_counterpoise_mol(rmax, nimages=1, unit='A', **kwargs)[source]

Make molecule object for counterposise calculation.

WARNING: This has only been tested for periodic systems so far!

Parameters:
  • rmax (float) – All atom centers within range rmax are added as ghost-atoms in the counterpoise correction.

  • nimages (int, optional) – Number of neighboring unit cell in each spatial direction. Has no effect in open boundary calculations. Default: 5.

  • unit (['A', 'B']) – Unit for rmax, either Angstrom (A) or Bohr (B).

  • **kwargs – Additional keyword arguments for returned PySCF Mole/Cell object.

Returns:

mol_cp – Mole or Cell object with periodic boundary conditions removed and with ghost atoms added depending on rmax and nimages.

Return type:

pyscf.gto.Mole or pyscf.pbc.gto.Cell

pop_analysis(cluster=None, dm1=None, **kwargs)[source]
plot3d(filename, gridsize=(100, 100, 100), **kwargs)[source]

Write cube density data of fragment orbitals to file.

check_solver(solver)[source]
get_solver(solver=None)[source]
get_local_rpa_correction(hamil=None)[source]
get_frag_hamil()[source]
get_solver_options(*args, **kwargs)[source]

vayesta.core.qemb.qemb

class vayesta.core.qemb.qemb.Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, ext_rpa_correction: Union[str, NoneType] = None, match_cluster_fock: bool = False)[source]

Bases: OptionsBase

store_eris: bool = True
global_frag_chempot: float = None
dm_with_frozen: bool = False
bath_options: dict
bosonic_bath_options: dict
solver_options: dict
symmetry_tol: float = 1e-06
symmetry_mf_tol: float = 1e-05
screening: str | None = None
ext_rpa_correction: str | None = None
match_cluster_fock: bool = False
asdict(deepcopy=False)
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
items()
keys()
replace(**kwargs)
update(**kwargs)
values()
class vayesta.core.qemb.qemb.Embedding(mf, solver='CCSD', log=None, overwrite=None, **kwargs)[source]

Bases: object

Base class for quantum embedding methods.

Parameters:
  • mf (pyscf.scf.SCF) – PySCF mean-field object.

  • solver (str, optional) – Default solver for cluster problems. The available solvers depend on the embedding class. Default: ‘CCSD’.

  • log (logging.Logger, optional) – Vayesta logger object. Default: None

  • bath_options (dict, optional) –

    Bath specific options. The bath type is determined by the key bathtype (default: ‘DMET’). The following bath specific options can be specified.

    All bath types:

    dmet_thresholdfloat, optional

    Threshold for DMET bath orbitals. Orbitals with eigenvalues larger than dmet_threshold or smaller than 1-dmet_threshold will be added as bath orbitals. Default: 1e-6.

    MP2 bath (bathtype = ‘MP2’):

    thresholdfloat

    Threshold for MP2 natural orbital truncation. Orbitals with eigenvalues larger than threshold will be added as bath orbitals.

    R2 bath (bathtype = ‘R2’):

    rcutfloat

    Range cutoff for R2 bath. Orbitals with eigenvalues smaller than rcut will be added as bath orbitals.

    unit{‘Ang’, ‘Bohr’}, optional

    Unit of rcut. Default: ‘Ang’.

  • solver_options – Solver specific options. The following solver specific options can be specified.

mol
nao
ncells
nmo
nfrag
e_mf
log

Logger object.

Type:

logging.Logger

self.mf

PySCF mean-field object.

Type:

pyscf.scf.SCF

self.mo_energy

MO energies.

Type:

(nMO) array

self.mo_occ

MO occupation numbers.

Type:

(nMO) array

self.mo_coeff

MO coefficients.

Type:

(nAO, nMO) array

self.fragments

List of fragments for embedding calculation.

Type:

list

self.kcell

For k-point sampled mean-field calculation, which have been folded to the supercell, this will hold the original primitive unit cell.

Type:

pyscf.pbc.gto.Cell

self.kpts

For k-point sampled mean-field calculation, which have been folded to the supercell, this will hold the original k-points.

Type:

(nK, 3) array

self.kdf

For k-point sampled mean-field calculation, which have been folded to the supercell, this will hold the original Gaussian density-fitting object.

Type:

pyscf.pbc.df.GDF

class Fragment(base, fid, name, c_frag, c_env, solver=None, atoms=None, aos=None, active=True, sym_parent=None, sym_op=None, mpi_rank=0, flags=None, log=None, **kwargs)

Bases: object

class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: int | NoneType = None)

Bases: object

bath_parent_fragment_id: int | None = None
is_envelop: bool = True
is_secfrag: bool = False
class Options(bath_options: dict = None, bosonic_bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, match_cluster_fock: bool = None, auxiliary: bool = False, coupled_fragments: list = <factory>, sym_factor: float = 1.0)

Bases: OptionsBase

asdict(deepcopy=False)
auxiliary: bool = False
bath_options: dict = None
bosonic_bath_options: dict = None
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
dm_with_frozen: bool = None
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
items()
keys()
match_cluster_fock: bool = None
replace(**kwargs)
screening: str | None = None
solver_options: dict = None
store_eris: bool = None
sym_factor: float = 1.0
update(**kwargs)
values()
coupled_fragments: list
class Results(fid: int = None, converged: bool = None, e_corr: float = None, e_corr_rpa: float = None, wf: vayesta.core.types.wf.wf.WaveFunction = None, pwf: vayesta.core.types.wf.wf.WaveFunction = None, moms: tuple = None)

Bases: object

converged: bool = None
e_corr: float = None
e_corr_rpa: float = None
fid: int = None
moms: tuple = None
pwf: WaveFunction = None
wf: WaveFunction = None
add_tsymmetric_fragments(tvecs, symtol=1e-06)
Parameters:
  • tvecs (array(3) of integers) – Each element represent the number of translation vector corresponding to the a0, a1, and a2 lattice vectors of the cell.

  • symtol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of T-symmetry related fragments. These will be automatically added to base.fragments and have the attributes sym_parent and sym_op set.

Return type:

list

canonicalize_mo(*mo_coeff, fock=None, eigvals=False, sign_convention=True)

Diagonalize Fock matrix within subspace.

TODO: move to Embedding class

Parameters:
  • *mo_coeff (ndarrays) – Orbital coefficients.

  • eigenvalues (ndarray) – Return MO energies of canonicalized orbitals.

Returns:

  • mo_canon (ndarray) – Canonicalized orbital coefficients.

  • rot (ndarray) – Rotation matrix: np.dot(mo_coeff, rot) = mo_canon.

change_options(**kwargs)
check_solver(solver)
property cluster
property contributes

True if fragment contributes to expectation values, else False.

copy(fid=None, name=None, **kwargs)

Create copy of fragment, without adding it to the fragments list.

couple_to_fragment(frag)
couple_to_fragments(frags)
diagonalize_cluster_dm(*mo_coeff, dm1=None, norm=2, tol=0.0001)

Diagonalize cluster (fragment+bath) DM to get fully occupied and virtual orbitals.

Parameters:
  • *mo_coeff (array or list of arrays) – Orbital coefficients. If multiple are given, they will be stacked along their second dimension.

  • dm1 (array, optional) – Mean-field density matrix, used to separate occupied and virtual cluster orbitals. If None, self.mf.make_rdm1() is used. Default: None.

  • tol (float, optional) – If set, check that all eigenvalues of the cluster DM are close to 0 or 2, with the tolerance given by tol. Default= 1e-4.

Returns:

  • c_cluster_occ ((n(AO), n(occ cluster)) array) – Occupied cluster orbital coefficients.

  • c_cluster_vir ((n(AO), n(vir cluster)) array) – Virtual cluster orbital coefficients.

get_coeff_env()
get_frag_hamil()
get_fragment_dmet_energy(dm1=None, dm2=None, h1e_eff=None, hamil=None, part_cumulant=True, approx_cumulant=True)

Get fragment contribution to whole system DMET energy from cluster DMs.

After fragment summation, the nuclear-nuclear repulsion must be added to get the total energy!

Parameters:
  • dm1 (array, optional) – Cluster one-electron reduced density-matrix in cluster basis. If None, self.results.dm1 is used. Default: None.

  • dm2 (array, optional) – Cluster two-electron reduced density-matrix in cluster basis. If None, self.results.dm2 is used. Default: None.

  • hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.

  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

Returns:

e_dmet – Electronic fragment DMET energy.

Return type:

float

get_fragment_mf_energy()

Calculate the part of the mean-field energy associated with the fragment.

Does not include nuclear-nuclear repulsion!

get_fragment_mo_energy(c_active=None, fock=None)

Returns approximate MO energies, using the the diagonal of the Fock matrix.

Parameters:
  • c_active (array, optional) –

  • fock (array, optional) –

get_fragment_projector(coeff, c_proj=None, inverse=False)

Projector for one index of amplitudes local energy expression.

Cost: N^2 if O(1) coeffs , N^3 if O(N) coeffs

Parameters:
  • coeff (ndarray, shape(n(AO), N)) – Occupied or virtual orbital coefficients.

  • inverse (bool, optional) – Return 1-p instead. Default: False.

Returns:

p – Projection matrix.

Return type:

(n, n) array

get_fragments_with_overlap(tol=1e-08, **kwargs)

Get list of fragments which overlap both in occupied and virtual space.

get_local_rpa_correction(hamil=None)
get_mo_occupation(*mo_coeff, dm1=None)

Get mean-field occupation numbers (diagonal of 1-RDM) of orbitals.

Parameters:

mo_coeff (ndarray, shape(N, M)) – Orbital coefficients.

Returns:

occup – Occupation numbers of orbitals.

Return type:

ndarray, shape(M)

get_overlap(key)

Get overlap between cluster orbitals, fragment orbitals, or MOs.

The return value is cached but not copied; do not modify the array in place without creating a copy!

Examples: >>> s = self.get_overlap(‘cluster|mo’) >>> s = self.get_overlap(‘cluster|frag’) >>> s = self.get_overlap(‘mo[occ]|cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]|cluster[vir]’)

get_solver(solver=None)
get_solver_options(*args, **kwargs)
get_symmetry_children(maxgen=None, **filters)
get_symmetry_error(frag, dm1=None)

Get translational symmetry error between two fragments.

get_symmetry_generations(maxgen=None, **filters)
get_symmetry_operation()
get_symmetry_parent()
get_symmetry_tree(maxgen=None, **filters)

Returns a recursive tree:

[(x, [children of x]), (y, [children of y]), …]

property hamil
property id_name

Use this whenever a unique name is needed (for example to open a separate file for each fragment).

log_info()
loop_symmetry_children(arrays=None, axes=None, symtree=None, maxgen=None, include_self=False)

Loop over all symmetry related fragments, including children of children, etc.

Parameters:
  • arrays (ndarray or list[ndarray], optional) – If arrays are passed, the symmetry operation of each symmetry related fragment will be applied to this array along the axis given in axes.

  • axes (list[int], optional) – List of axes, along which the symmetry operation is applied for each element of arrays. If None, the first axis will be used.

make_bath()
make_bosonic_bath_target()

Get the target space for bosonic bath orbitals. This can either be the DMET cluster or the full space, and can include a projection onto the fragment.

make_bosonic_cluster(m0_target)

Set bosonic component of the cluster.

make_cluster()
make_counterpoise_mol(rmax, nimages=1, unit='A', **kwargs)

Make molecule object for counterposise calculation.

WARNING: This has only been tested for periodic systems so far!

Parameters:
  • rmax (float) – All atom centers within range rmax are added as ghost-atoms in the counterpoise correction.

  • nimages (int, optional) – Number of neighboring unit cell in each spatial direction. Has no effect in open boundary calculations. Default: 5.

  • unit (['A', 'B']) – Unit for rmax, either Angstrom (A) or Bohr (B).

  • **kwargs – Additional keyword arguments for returned PySCF Mole/Cell object.

Returns:

mol_cp – Mole or Cell object with periodic boundary conditions removed and with ghost atoms added depending on rmax and nimages.

Return type:

pyscf.gto.Mole or pyscf.pbc.gto.Cell

property mf
property mol
property n_frag

Number of fragment orbitals.

property n_symmetry_children

Includes children of children, etc.

property nelectron

Number of mean-field electrons.

plot3d(filename, gridsize=(100, 100, 100), **kwargs)

Write cube density data of fragment orbitals to file.

pop_analysis(cluster=None, dm1=None, **kwargs)
project_ref_orbitals(c_ref, c)

Project reference orbitals into available space in new geometry.

The projected orbitals will be ordered according to their eigenvalues within the space.

Parameters:
  • c (ndarray) – Orbital coefficients.

  • c_ref (ndarray) – Orbital coefficients of reference orbitals.

reset(reset_bath=True, reset_cluster=True, reset_eris=True, reset_inactive=True)
property results
property symmetry_factor

Includes children of children, etc.

trimmed_name(length=10, add_dots=True)

Fragment name trimmed to a given maximum length.

class Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, ext_rpa_correction: Union[str, NoneType] = None, match_cluster_fock: bool = False)

Bases: OptionsBase

asdict(deepcopy=False)
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
dm_with_frozen: bool = False
ext_rpa_correction: str | None = None
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
global_frag_chempot: float = None
items()
keys()
match_cluster_fock: bool = False
replace(**kwargs)
screening: str | None = None
store_eris: bool = True
symmetry_mf_tol: float = 1e-05
symmetry_tol: float = 1e-06
update(**kwargs)
values()
bath_options: dict
bosonic_bath_options: dict
solver_options: dict
is_rhf = True
is_uhf = False
spinsym = 'restricted'
init_mf(mf)[source]
change_options(**kwargs)[source]
property mol

Mole or Cell object.

property has_exxdiv

Correction for divergent exact-exchange potential.

get_exxdiv()[source]

Get divergent exact-exchange (exxdiv) energy correction and potential.

Returns:

  • e_exxdiv (float) – Divergent exact-exchange energy correction per unit cell.

  • v_exxdiv (array) – Divergent exact-exchange potential correction in AO basis.

property pbc_dimension
property nao

Number of atomic orbitals.

property ncells

Number of primitive cells within supercell.

property has_df
property df
property mo_energy

Molecular orbital energies.

property mo_coeff

Molecular orbital coefficients.

property mo_occ

Molecular orbital occupations.

property nmo

Total number of molecular orbitals (MOs).

property nocc

Number of occupied MOs.

property nvir

Number of virtual MOs.

property mo_energy_occ

Occupied MO energies.

property mo_energy_vir

Virtual MO coefficients.

property mo_coeff_occ

Occupied MO coefficients.

property mo_coeff_vir

Virtual MO coefficients.

property e_mf

Total mean-field energy per unit cell (not folded supercell). Note that the input unit cell itself can be a supercell, in which case e_mf refers to this cell.

property e_nuc

Nuclear-repulsion energy per unit cell (not folded supercell).

property e_nonlocal
property nfrag

Number of fragments.

loop()[source]

Loop over fragments.

get_ovlp()[source]

AO-overlap matrix.

get_hcore()[source]

Core Hamiltonian (kinetic energy plus nuclear-electron attraction).

get_veff(dm1=None, with_exxdiv=True)[source]

Hartree-Fock Coulomb and exchange potential in AO basis.

get_fock(dm1=None, with_exxdiv=True)[source]

Fock matrix in AO basis.

set_ovlp(value)[source]
set_hcore(value)[source]
set_veff(value)[source]
get_hcore_for_energy()[source]

Core Hamiltonian used for energy evaluation.

get_veff_for_energy(dm1=None, with_exxdiv=True)[source]

Hartree-Fock potential used for energy evaluation.

get_fock_for_energy(dm1=None, with_exxdiv=True)[source]

Fock matrix used for energy evaluation.

get_fock_for_bath(dm1=None, with_exxdiv=True)[source]

Fock matrix used for bath orbitals.

get_ovlp_power(power)[source]

get power of AO overlap matrix.

For folded calculations, this uses the k-point sampled overlap, for better performance and accuracy.

Parameters:

power (float) – Matrix power.

Returns:

spow – Matrix power of AO overlap matrix

Return type:

(n(AO), n(AO)) array

get_cderi(mo_coeff, compact=False, blksize=None)
get_cderi_exspace(ex_coeff, compact=False, blksize=None)
get_eris_array(mo_coeff, compact=False)

Get electron-repulsion integrals in MO basis as a NumPy array.

Parameters:

mo_coeff ([list(4) of] (n(AO), n(MO)) array) – MO coefficients.

Returns:

eris – Electron-repulsion integrals in MO basis.

Return type:

(n(MO), n(MO), n(MO), n(MO)) array

get_eris_object(postscf, fock=None)

Get ERIs for post-SCF methods.

For folded PBC calculations, this folds the MO back into k-space and contracts with the k-space three-center integrals..

Parameters:

postscf (one of the following PySCF methods: MP2, CCSD, RCCSD, DFCCSD) – Post-SCF method with attribute mo_coeff set.

Returns:

eris – ERIs which can be used for the respective post-scf method.

Return type:

_ChemistsERIs

build_screened_interactions(*args, **kwargs)[source]

Build screened interactions, be they dynamic or static.

build_bosonic_bath()[source]
build_screened_eris(*args, **kwargs)[source]

Generates renormalised coulomb interactions for use in local cluster calculations. Currently requires unrestricted system.

Parameters:
  • emb (Embedding) – Embedding instance.

  • fragments (list of vayesta.qemb.Fragment subclasses, optional) – List of fragments for the calculation, used to define local interaction spaces. If None, emb.get_fragments(sym_parent=None) is used. Default: None.

  • cderi_ov (np.array or tuple of np.array, optional.) – Cholesky-decomposed ERIs in the particle-hole basis of mf. If mf is unrestricted this should be a list of arrays corresponding to the different spin channels.

  • store_m0 (bool, optional.) – Whether to store the local zeroth moment in the fragment class for use later.

  • npoints (int, optional) – Number of points for numerical integration. Default: 48.

  • log (logging.Logger, optional) – Logger object. If None, the logger of the emb object is used. Default: None.

Returns:

  • seris_ov (list of tuples of np.array) – List of spin-dependent screened (ov|ov), for each fragment provided.

  • erpa (float) – Delta RPA correction computed as difference between full system RPA energy and cluster correlation energies; currently only functional in CAS fragmentations.

create_symmetric_fragments(symmetry, fragments=None, symbol=None, mf_tol=None, check_mf=True)[source]

Add rotationally or translationally symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: self.opts.symmetry_mf_tol.

Returns:

fragments – List of T-symmetry related fragments. These will have the attributes sym_parent and sym_op set.

Return type:

list

create_invsym_fragments(center, fragments=None, unit='Ang', **kwargs)[source]

Create inversion symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of inversion-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_mirrorsym_fragments(axis, center, fragments=None, unit='Ang', **kwargs)[source]

Create mirror symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of mirror-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_rotsym_fragments(order, axis, center, fragments=None, unit='Ang', **kwargs)[source]

Create rotationally symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of rotationally-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_transsym_fragments(translation, fragments=None, **kwargs)[source]

Create translationally symmetric fragments.

Parameters:
  • translation (array(3) of integers) – Each element represent the number of translation vector corresponding to the a0, a1, and a2 lattice vectors of the cell.

  • mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of T-symmetry related fragments. These will have the attributes sym_parent and sym_op set.

Return type:

list

get_symmetry_parent_fragments()[source]

Returns a list of all fragments, which are parents to symmetry related child fragments.

Returns:

parents – A list of all parent fragments, ordered in the same way as they appear in self.fragments.

Return type:

list

get_symmetry_child_fragments(include_parents=False)[source]

Returns a list of all fragments, which are children to symmetry related parent fragments.

Parameters:

include_parents (bool, optional) – If true, the parent fragment of each symmetry group is prepended to each symmetry sublist.

Returns:

children – A list with the length of the number of parent fragments in the system, each element being another list containing all the children fragments of the given parent fragment. Both the outer and inner lists are ordered in the same way that the fragments appear in self.fragments.

Return type:

list of lists

get_fragments(fragments=None, options=None, flags=None, **filters)[source]

Return all fragments which obey the specified conditions.

Parameters:

**filters – List of returned fragments will be filtered according to specified keyword arguments.

Returns:

fragments – List of fragments.

Return type:

list

Examples

Only returns fragments with mpi_rank 0, 1, or 2:

>>> self.get_fragments(mpi_rank=[0,1,2])

Only returns fragments with no symmetry parent:

>>> self.get_fragments(sym_parent=None)
get_fragment_overlap_norm(fragments=None, occupied=True, virtual=True, norm=2)[source]

Get matrix of overlap norms between fragments.

communicate_clusters()[source]

Communicate cluster orbitals between MPI ranks.

make_rdm1_demo(*args, **kwargs)[source]

Make democratically partitioned one-particle reduced density-matrix from fragment calculations.

Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg, Lowdin-AO or IAO+PAO fragmentation).

Parameters:
  • ao_basis (bool, optional) – Return the density-matrix in the AO basis. Default: False.

  • with_mf (bool, optional) – Add the mean-field contribution to the density-matrix (double counting is accounted for). Is only used if partition = ‘dm’. Default: False.

  • symmetrize (bool, optional) – Symmetrize the density-matrix at the end of the calculation. Default: True.

  • mpi_target (int or None, optional) – If set to an integer, the result will only be available at the specified MPI rank. If set to None, an MPI allreduce will be performed and the result will be available at all MPI ranks. Default: None.

Returns:

dm1 – One-particle reduced density matrix in AO (if ao_basis=True) or MO basis (default).

Return type:

(n, n) array

make_rdm2_demo(*args, **kwargs)[source]

Make democratically partitioned two-particle reduced density-matrix from fragment calculations.

Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg. Lowdin-AO (SAO) or IAO+PAO fragmentation).

Energies can be evaluated as follows from the 1-DM and 2-DM:

1) Literature DMET energy: >>> e_nuc = mol.energy_nuc() >>> hcore = mf.get_hcore() >>> eris = pyscf.ao2mo.kernel(mol, mf.mo_coeff, compact=False).reshape([mol.nao]*4) >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=False, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)

…or in terms of the (approximated) cumulant: >>> vhf = mf.get_veff() >>> ddm1 = 2*dm1 - mf.make_rdm1() >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=False, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*ddm2) + np.sum(vhf*ddm1)/2

2) Improved DMET energy (same as emb.get_dmet_energy(part_cumulant=True)): >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=True, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)/2

…or in terms of the (approximated) cumulant: >>> fock = mf.get_fock() >>> ddm1 = emb.make_rdm1_demo(ao_basis=True, with_mf=False) >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=True, approx_cumulant=True) >>> e_tot = mf.e_tot + np.sum(fock*ddm1) + np.sum(eris*ddm2)/2

3) Improved DMET energy with true cumulant (same as emb.get_dmet_energy(part_cumulant=True, approx_cumulant=False)): >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=True, approx_cumulant=False) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)/2

…or in terms of the cumulant: >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=True, approx_cumulant=False) >>> fcorr = mf.get_fock(dm=dm1) >>> e_tot = e_nuc + np.sum((hcore+fcorr)*dm1)/2 + np.sum(eris*ddm2)/2

Parameters:
  • ao_basis (bool, optional) – Return the density-matrix in the AO basis. Default: False.

  • with_dm1 (bool, optional) – If True, the non-cumulant part of the 2-DM will be added. See also approx_cumulant. Default: False.

  • part_cumulant (bool, optional) – If False, the mixed non-cumulant contributions, “DM1(MF) * [DM1(corr)-DM1(MF)]”, will be projected symmetrically between both factors. This will return a 2-DM will evaluates to the DMET-energy of the literature. If True, only the second factor will be projected. This will generally give better expectation values and is the recommended setting. Default: True.

  • approx_cumulant (bool or int, optional) – If True, the cumulant of the 2-DM will be approximated and contain the non-cumulant contribution “delta[DM1(corr)-DM1(MF)]^2”. This value is ignored if part_cumulant is False and with_dm1 is True. Default: True.

  • symmetrize (bool, optional) – Symmetrize the density-matrix at the end of the calculation. Default: True.

  • mpi_target (int or None, optional) – If set to an integer, the result will only be available at the specified MPI rank. If set to None, an MPI allreduce will be performed and the result will be available at all MPI ranks. Default: None.

Returns:

dm2 – Two-particle reduced density matrix in AO (if ao_basis=True) or MO basis (default).

Return type:

(n, n, n, n) array

get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True, mpi_target=None)[source]

Calculate electronic DMET energy via democratically partitioned density-matrices.

Parameters:
  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

  • mpi_target (int or None, optional) – If set to an integer, the result will only be available at the specified MPI rank. If set to None, an MPI allreduce will be performed and the result will be available at all MPI ranks. Default: None.

Returns:

e_dmet – Electronic DMET energy.

Return type:

float

get_dmet_energy(part_cumulant=True, approx_cumulant=True, with_nuc=True, with_exxdiv=True)[source]

Calculate DMET energy via democratically partitioned density-matrices.

Parameters:
  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

  • with_nuc (bool, optional) – Include nuclear-repulsion energy. Default: True.

  • with_exxdiv (bool, optional) – Include divergent exact-exchange correction. Default: True.

Returns:

e_dmet – DMET energy.

Return type:

float

get_corrfunc_mf(kind, dm1=None, atoms=None, projection='sao', orbital_filter=None)

dm1 in MO basis

get_corrfunc(kind, dm1=None, dm2=None, atoms=None, projection='sao', dm2_with_dm1=None, use_symmetry=True, orbital_filter=None)

Get expectation values <P(A) S_z P(B) S_z>, where P(X) are projectors onto atoms X.

TODO: MPI

Parameters:

atoms (list[int] or list[list[int]], optional) – Atom indices for which the spin-spin correlation function should be evaluated. If set to None (default), all atoms of the system will be considered. If a list is given, all atom pairs formed from this list will be considered. If a list of two lists is given, the first list contains the indices of atom A, and the second of atom B, for which <Sz(A) Sz(B)> will be evaluated. This is useful in cases where one is only interested in the correlation to a small subset of atoms. Default: None

Returns:

corr – Atom projected correlation function.

Return type:

array(N,M)

get_mean_cluster_size()[source]
get_average_cluster_size(average='mean')[source]
get_min_cluster_size()[source]
get_max_cluster_size()[source]
get_lo_coeff(local_orbitals='lowdin', minao='auto')[source]
pop_analysis(dm1, mo_coeff=None, local_orbitals='lowdin', minao='auto', write=True, filename=None, filemode='a', orbital_resolved=False, mpi_rank=0)[source]
Parameters:
  • dm1 ((N, N) array) – If mo_coeff is None, AO representation is assumed.

  • local_orbitals ({'lowdin', 'mulliken', 'iao+pao'} or array) – Kind of population analysis. Default: ‘lowdin’.

Returns:

pop – Population of atomic orbitals.

Return type:

  1. array

get_atomic_charges(pop)[source]
write_population(pop, filename=None, filemode='a', orbital_resolved=False)[source]
sao_fragmentation(**kwargs)[source]

Initialize the quantum embedding method for the use of SAO (Lowdin-AO) fragments.

site_fragmentation(**kwargs)[source]

Initialize the quantum embedding method for the use of site fragments.

iao_fragmentation(minao='auto', **kwargs)[source]

Initialize the quantum embedding method for the use of IAO fragments.

Parameters:

minao (str, optional) – IAO reference basis set. Default: ‘auto’

iaopao_fragmentation(minao='auto', **kwargs)[source]

Initialize the quantum embedding method for the use of IAO+PAO fragments.

Parameters:

minao (str, optional) – IAO reference basis set. Default: ‘auto’

cas_fragmentation(**kwargs)[source]

Initialize the quantum embedding method for the use of site fragments.

has_orthonormal_fragmentation(**kwargs)[source]

Check if union of fragment spaces is orthonormal.

has_complete_fragmentation(**kwargs)[source]

Check if union of fragment spaces is orthonormal and complete.

has_complete_occupied_fragmentation(**kwargs)[source]

Check if union of fragment spaces is orthonormal and complete in the occupied space.

has_complete_virtual_fragmentation(**kwargs)[source]

Check if union of fragment spaces is orthonormal and complete in the virtual space.

require_complete_fragmentation(message=None, incl_virtual=True, **kwargs)[source]
reset(*args, **kwargs)[source]
update_mf(mo_coeff, mo_energy=None, veff=None)[source]

Update underlying mean-field object.

check_fragment_symmetry(dm1, symtol=1e-06)[source]

Check that the mean-field obeys the symmetry between fragments.

optimize_chempot(cpt_init=0.0, dm1func=None, dm1kwds=None, robust=False)[source]
pdmet_scmf(*args, **kwargs)[source]

Decorator for p-DMET.

brueckner_scmf(*args, **kwargs)[source]

Decorator for Brueckner-DMET.

qpewdmet_scmf(*args, **kwargs)[source]

Decorator for QP-EWDMET.

check_solver(solver)[source]

vayesta.core.qemb.register

class vayesta.core.qemb.register.FragmentRegister(mpi_size=None)[source]

Bases: object

get_next_id()[source]
get_next_mpi_rank(runtime=None, memory=None)[source]

TODO: get next MPI rank based on runtime and memory estimates.

get_next(*args, **kwargs)[source]

Get next free fragment ID and MPI rank.

vayesta.core.qemb.self_energy

Routines to reconstruct the full system self-energy from cluster spectral moments

vayesta.core.qemb.self_energy.make_self_energy_moments(emb, n_se_mom, use_sym=True, proj=1, eta=0.01)[source]

Construct full system self-energy moments from cluster spectral moments

Parameters:
  • emb (EWF object) – Embedding object

  • n_se_mom (int) – Number of self-energy moments

  • use_sym (bool) – Use symmetry to reconstruct self-energy

  • proj (int) – Number of projectors to use (1 or 2)

  • eta (float) – Broadening factor for static potential

Returns:

  • self_energy_moms (ndarry (n_se_mom, nmo, nmo)) – Full system self-energy moments (MO basis)

  • static_self_energy (ndarray (nmo,nmo)) – Static part of self-energy (MO basis)

  • static_potential (ndarray (nao,nao)) – Static potential (AO basis)

vayesta.core.qemb.self_energy.make_self_energy_1proj(emb, use_sym=True, use_svd=True, eta=0.01, aux_shift_frag=False, se_degen_tol=0.0001, se_eval_tol=1e-06, drop_non_causal=False)[source]

Construct full system self-energy in Lehmann representation from cluster spectral moments using 1 projector

TODO: MPI, SVD

Parameters:
  • emb (EWF object) – Embedding object

  • use_sym (bool) – Use symmetry to reconstruct self-energy

  • use_svd (bool) – Use SVD to decompose the self-energy as outer product

  • eta (float) – Broadening factor for static potential

  • se_degen_tol (float) – Tolerance for degeneracy in Lehmann representation

  • se_eval_tol (float) – Tolerance for self-energy eigenvalues assumed to be kept

  • drop_non_causal (bool) – Drop non-causal poles (negative eigenvalues) of self-energy

Returns:

  • self_energy (Lehmann object) – Reconstructed self-energy in Lehmann representation (MO basis)

  • static_self_energy (ndarray (nmo,nmo)) – Static part of self-energy (MO basis)

  • static_potential (ndarray (nao,nao)) – Static potential (AO basis)

vayesta.core.qemb.self_energy.make_self_energy_2proj(emb, use_sym=True, eta=0.01)[source]

Construct full system self-energy in Lehmann representation from cluster spectral moments using 2 projectors

TODO: MPI, SVD

Parameters:
  • emb (EWF object) – Embedding object

  • use_sym (bool) – Use symmetry to reconstruct self-energy

  • eta (float) – Broadening factor for static potential

Returns:

  • self_energy (Lehmann object) – Reconstructed self-energy in Lehmann representation (MO basis)

  • static_self_energy (ndarray (nmo,nmo)) – Static part of self-energy (MO basis)

  • static_potential (ndarray (nao,nao)) – Static potential (AO basis)

vayesta.core.qemb.self_energy.remove_se_degeneracy(emb, se, dtol=1e-08, etol=1e-06, drop_non_causal=False)[source]
vayesta.core.qemb.self_energy.get_unique(array, atol=1e-15)[source]
vayesta.core.qemb.self_energy.fit_hermitian(se)[source]

Fit a causal self-energy

Parameters:

se (Lehmann) – Self-energy in Lehmann representation

Returns:

se – Fitted causal self-energy

Return type:

Lehmann

vayesta.core.qemb.ufragment

class vayesta.core.qemb.ufragment.UFragment(base, fid, name, c_frag, c_env, solver=None, atoms=None, aos=None, active=True, sym_parent=None, sym_op=None, mpi_rank=0, flags=None, log=None, **kwargs)[source]

Bases: Fragment

log_info()[source]
property n_frag

Number of fragment orbitals.

property nelectron

Number of mean-field electrons.

get_mo_occupation(*mo_coeff, dm1=None, **kwargs)[source]

Get mean-field occupation numbers (diagonal of 1-RDM) of orbitals.

Parameters:

mo_coeff (ndarray, shape(N, M)) – Orbital coefficients.

Returns:

occ – Occupation numbers of orbitals.

Return type:

ndarray, shape(M)

canonicalize_mo(*mo_coeff, fock=None, **kwargs)[source]

Diagonalize Fock matrix within subspace.

Parameters:
  • *mo_coeff (ndarrays) – Orbital coefficients.

  • eigenvalues (ndarray) – Return MO energies of canonicalized orbitals.

Returns:

  • mo_canon (ndarray) – Canonicalized orbital coefficients.

  • rot (ndarray) – Rotation matrix: np.dot(mo_coeff, rot) = mo_canon.

diagonalize_cluster_dm(*mo_coeff, dm1=None, norm=1, **kwargs)[source]

Diagonalize cluster (fragment+bath) DM to get fully occupied and virtual orbitals.

Parameters:
  • *mo_coeff (ndarrays) – Orbital coefficients.

  • tol (float, optional) – If set, check that all eigenvalues of the cluster DM are close to 0 or 1, with the tolerance given by tol. Default= 1e-4.

Returns:

  • c_cluster_occ (ndarray) – Occupied cluster orbitals.

  • c_cluster_vir (ndarray) – Virtual cluster orbitals.

get_fragment_projector(coeff, c_proj=None, **kwargs)[source]

Projector for one index of amplitudes local energy expression.

Cost: N^2 if O(1) coeffs , N^3 if O(N) coeffs

Parameters:
  • coeff (ndarray, shape(n(AO), N)) – Occupied or virtual orbital coefficients.

  • inverse (bool, optional) – Return 1-p instead. Default: False.

Returns:

p – Projection matrix.

Return type:

(n, n) array

get_fragment_mf_energy()[source]

Calculate the part of the mean-field energy associated with the fragment.

Does not include nuclear-nuclear repulsion!

get_fragment_mo_energy(c_active=None, fock=None)[source]

Returns approximate MO energies, using the the diagonal of the Fock matrix.

Parameters:
  • c_active (array, optional) –

  • fock (array, optional) –

get_fragment_dmet_energy(dm1=None, dm2=None, h1e_eff=None, hamil=None, part_cumulant=True, approx_cumulant=True)[source]

Get fragment contribution to whole system DMET energy from cluster DMs.

After fragment summation, the nuclear-nuclear repulsion must be added to get the total energy!

Parameters:
  • dm1 (array, optional) – Cluster one-electron reduced density-matrix in cluster basis. If None, self.results.dm1 is used. Default: None.

  • dm2 (array, optional) – Cluster two-electron reduced density-matrix in cluster basis. If None, self.results.dm2 is used. Default: None.

  • hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.

  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

Returns:

e_dmet – Electronic fragment DMET energy.

Return type:

float

get_symmetry_error(frag, dm1=None)[source]

Get translational symmetry error between two fragments.

class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: int | NoneType = None)

Bases: object

bath_parent_fragment_id: int | None = None
is_envelop: bool = True
is_secfrag: bool = False
class Options(bath_options: dict = None, bosonic_bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, match_cluster_fock: bool = None, auxiliary: bool = False, coupled_fragments: list = <factory>, sym_factor: float = 1.0)

Bases: OptionsBase

asdict(deepcopy=False)
auxiliary: bool = False
bath_options: dict = None
bosonic_bath_options: dict = None
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
dm_with_frozen: bool = None
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
items()
keys()
match_cluster_fock: bool = None
replace(**kwargs)
screening: str | None = None
solver_options: dict = None
store_eris: bool = None
sym_factor: float = 1.0
update(**kwargs)
values()
coupled_fragments: list
class Results(fid: int = None, converged: bool = None, e_corr: float = None, e_corr_rpa: float = None, wf: vayesta.core.types.wf.wf.WaveFunction = None, pwf: vayesta.core.types.wf.wf.WaveFunction = None, moms: tuple = None)

Bases: object

converged: bool = None
e_corr: float = None
e_corr_rpa: float = None
fid: int = None
moms: tuple = None
pwf: WaveFunction = None
wf: WaveFunction = None
add_tsymmetric_fragments(tvecs, symtol=1e-06)
Parameters:
  • tvecs (array(3) of integers) – Each element represent the number of translation vector corresponding to the a0, a1, and a2 lattice vectors of the cell.

  • symtol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of T-symmetry related fragments. These will be automatically added to base.fragments and have the attributes sym_parent and sym_op set.

Return type:

list

change_options(**kwargs)
check_solver(solver)
property cluster
property contributes

True if fragment contributes to expectation values, else False.

copy(fid=None, name=None, **kwargs)

Create copy of fragment, without adding it to the fragments list.

couple_to_fragment(frag)
couple_to_fragments(frags)
get_coeff_env()
get_frag_hamil()
get_fragments_with_overlap(tol=1e-08, **kwargs)

Get list of fragments which overlap both in occupied and virtual space.

get_local_rpa_correction(hamil=None)
get_overlap(key)

Get overlap between cluster orbitals, fragment orbitals, or MOs.

The return value is cached but not copied; do not modify the array in place without creating a copy!

Examples: >>> s = self.get_overlap(‘cluster|mo’) >>> s = self.get_overlap(‘cluster|frag’) >>> s = self.get_overlap(‘mo[occ]|cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]|cluster[vir]’)

get_solver(solver=None)
get_solver_options(*args, **kwargs)
get_symmetry_children(maxgen=None, **filters)
get_symmetry_generations(maxgen=None, **filters)
get_symmetry_operation()
get_symmetry_parent()
get_symmetry_tree(maxgen=None, **filters)

Returns a recursive tree:

[(x, [children of x]), (y, [children of y]), …]

property hamil
property id_name

Use this whenever a unique name is needed (for example to open a separate file for each fragment).

loop_symmetry_children(arrays=None, axes=None, symtree=None, maxgen=None, include_self=False)

Loop over all symmetry related fragments, including children of children, etc.

Parameters:
  • arrays (ndarray or list[ndarray], optional) – If arrays are passed, the symmetry operation of each symmetry related fragment will be applied to this array along the axis given in axes.

  • axes (list[int], optional) – List of axes, along which the symmetry operation is applied for each element of arrays. If None, the first axis will be used.

make_bath()
make_bosonic_bath_target()

Get the target space for bosonic bath orbitals. This can either be the DMET cluster or the full space, and can include a projection onto the fragment.

make_bosonic_cluster(m0_target)

Set bosonic component of the cluster.

make_cluster()
make_counterpoise_mol(rmax, nimages=1, unit='A', **kwargs)

Make molecule object for counterposise calculation.

WARNING: This has only been tested for periodic systems so far!

Parameters:
  • rmax (float) – All atom centers within range rmax are added as ghost-atoms in the counterpoise correction.

  • nimages (int, optional) – Number of neighboring unit cell in each spatial direction. Has no effect in open boundary calculations. Default: 5.

  • unit (['A', 'B']) – Unit for rmax, either Angstrom (A) or Bohr (B).

  • **kwargs – Additional keyword arguments for returned PySCF Mole/Cell object.

Returns:

mol_cp – Mole or Cell object with periodic boundary conditions removed and with ghost atoms added depending on rmax and nimages.

Return type:

pyscf.gto.Mole or pyscf.pbc.gto.Cell

property mf
property mol
property n_symmetry_children

Includes children of children, etc.

plot3d(filename, gridsize=(100, 100, 100), **kwargs)

Write cube density data of fragment orbitals to file.

pop_analysis(cluster=None, dm1=None, **kwargs)
project_ref_orbitals(c_ref, c)

Project reference orbitals into available space in new geometry.

The projected orbitals will be ordered according to their eigenvalues within the space.

Parameters:
  • c (ndarray) – Orbital coefficients.

  • c_ref (ndarray) – Orbital coefficients of reference orbitals.

reset(reset_bath=True, reset_cluster=True, reset_eris=True, reset_inactive=True)
property results
property symmetry_factor

Includes children of children, etc.

trimmed_name(length=10, add_dots=True)

Fragment name trimmed to a given maximum length.

vayesta.core.qemb.uqemb

class vayesta.core.qemb.uqemb.UEmbedding(mf, solver='CCSD', log=None, overwrite=None, **kwargs)[source]

Bases: Embedding

Spin unrestricted quantum embedding.

Fragment

alias of UFragment

is_rhf = False
is_uhf = True
spinsym = 'unrestricted'
property nmo

Total number of molecular orbitals (MOs).

property nocc

Number of occupied MOs.

property nvir

Number of virtual MOs.

property mo_coeff_occ

Occupied MO coefficients.

property mo_coeff_vir

Virtual MO coefficients.

get_exxdiv()[source]

Get divergent exact-exchange (exxdiv) energy correction and potential.

Returns:

  • e_exxdiv (float) – Divergent exact-exchange energy correction per unit cell.

  • v_exxdiv (array) – Divergent exact-exchange potential correction in AO basis.

get_eris_array_uhf(mo_coeff, mo_coeff2=None, compact=False)[source]

Get electron-repulsion integrals in MO basis as a NumPy array.

Parameters:

mo_coeff (tuple(2) of (n(AO), n(MO)) array) – MO coefficients.

Returns:

Electron-repulsion integrals in MO basis.

Return type:

eris

get_eris_object(postscf, fock=None)[source]

Get ERIs for post-SCF methods.

For folded PBC calculations, this folds the MO back into k-space and contracts with the k-space three-center integrals..

Parameters:

postscf (one of the following post-SCF methods: MP2, CCSD, RCCSD, DFCCSD) – Post-SCF method with attribute mo_coeff set.

Returns:

eris – ERIs which can be used for the respective post-SCF method.

Return type:

_ChemistsERIs

build_screened_eris(*args, **kwargs)[source]

Generates renormalised coulomb interactions for use in local cluster calculations. Currently requires unrestricted system.

Parameters:
  • emb (Embedding) – Embedding instance.

  • fragments (list of vayesta.qemb.Fragment subclasses, optional) – List of fragments for the calculation, used to define local interaction spaces. If None, emb.get_fragments(sym_parent=None) is used. Default: None.

  • cderi_ov (np.array or tuple of np.array, optional.) – Cholesky-decomposed ERIs in the particle-hole basis of mf. If mf is unrestricted this should be a list of arrays corresponding to the different spin channels.

  • store_m0 (bool, optional.) – Whether to store the local zeroth moment in the fragment class for use later.

  • npoints (int, optional) – Number of points for numerical integration. Default: 48.

  • log (logging.Logger, optional) – Logger object. If None, the logger of the emb object is used. Default: None.

Returns:

  • seris_ov (list of tuples of np.array) – List of spin-dependent screened (ov|ov), for each fragment provided.

  • erpa (float) – Delta RPA correction computed as difference between full system RPA energy and cluster correlation energies; currently only functional in CAS fragmentations.

update_mf(mo_coeff, mo_energy=None, veff=None)[source]

Update underlying mean-field object.

check_fragment_symmetry(dm1, charge_tol=1e-06, spin_tol=1e-06)[source]

Check that the mean-field obeys the symmetry between fragments.

make_rdm1_demo(*args, **kwargs)[source]

Make democratically partitioned one-particle reduced density-matrix from fragment calculations.

Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg, Lowdin-AO or IAO+PAO fragmentation).

Parameters:
  • ao_basis (bool, optional) – Return the density-matrix in the AO basis. Default: False.

  • with_mf (bool, optional) – Add the mean-field contribution to the density-matrix (double counting is accounted for). Is only used if partition = ‘dm’. Default: False.

  • symmetrize (bool, optional) – Symmetrize the density-matrix at the end of the calculation. Default: True.

Returns:

dm1 – Alpha- and beta one-particle reduced density matrix in AO (if ao_basis=True) or MO basis (default).

Return type:

tuple of (n, n) arrays

make_rdm2_demo(*args, **kwargs)[source]

Make democratically partitioned two-particle reduced density-matrix from fragment calculations.

Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg. Lowdin-AO (SAO) or IAO+PAO fragmentation).

Energies can be evaluated as follows from the 1-DM and 2-DM:

1) Literature DMET energy: >>> e_nuc = mol.energy_nuc() >>> hcore = mf.get_hcore() >>> eris = pyscf.ao2mo.kernel(mol, mf.mo_coeff, compact=False).reshape([mol.nao]*4) >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=False, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)

…or in terms of the (approximated) cumulant: >>> vhf = mf.get_veff() >>> ddm1 = 2*dm1 - mf.make_rdm1() >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=False, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*ddm2) + np.sum(vhf*ddm1)/2

2) Improved DMET energy (same as emb.get_dmet_energy(part_cumulant=True)): >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=True, approx_cumulant=True) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)/2

…or in terms of the (approximated) cumulant: >>> fock = mf.get_fock() >>> ddm1 = emb.make_rdm1_demo(ao_basis=True, with_mf=False) >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=True, approx_cumulant=True) >>> e_tot = mf.e_tot + np.sum(fock*ddm1) + np.sum(eris*ddm2)/2

3) Improved DMET energy with true cumulant (same as emb.get_dmet_energy(part_cumulant=True, approx_cumulant=False)): >>> dm1 = emb.make_rdm1_demo(ao_basis=True) >>> dm2 = emb.make_rdm2_demo(ao_basis=True, part_cumulant=True, approx_cumulant=False) >>> e_tot = e_nuc + np.sum(hcore*dm1) + np.sum(eris*dm2)/2

…or in terms of the cumulant: >>> ddm2 = emb.make_rdm2_demo(ao_basis=True, with_dm1=False, part_cumulant=True, approx_cumulant=False) >>> fcorr = mf.get_fock(dm=dm1) >>> e_tot = e_nuc + np.sum((hcore+fcorr)*dm1)/2 + np.sum(eris*ddm2)/2

Parameters:
  • ao_basis (bool, optional) – Return the density-matrix in the AO basis. Default: False.

  • with_dm1 (bool, optional) – If True, the non-cumulant part of the 2-DM will be added. See also approx_cumulant. Default: False.

  • part_cumulant (bool, optional) – If False, the mixed non-cumulant contributions, “DM1(MF) * [DM1(corr)-DM1(MF)]”, will be projected symmetrically between both factors. This will return a 2-DM will evaluates to the DMET-energy of the literature. If True, only the second factor will be projected. This will generally give better expectation values and is the recommended setting. Default: True.

  • approx_cumulant (bool or int, optional) – If True, the cumulant of the 2-DM will be approximated and contain the non-cumulant contribution “delta[DM1(corr)-DM1(MF)]^2”. This value is ignored if part_cumulant is False and with_dm1 is True. Default: True.

  • symmetrize (bool, optional) – Symmetrize the density-matrix at the end of the calculation. Default: True.

  • mpi_target (int or None, optional) – If set to an integer, the result will only be available at the specified MPI rank. If set to None, an MPI allreduce will be performed and the result will be available at all MPI ranks. Default: None.

Returns:

dm2 – Two-particle reduced density matrix in AO (if ao_basis=True) or MO basis (default).

Return type:

(n, n, n, n) array

pop_analysis(dm1, mo_coeff=None, local_orbitals='lowdin', write=True, minao='auto', mpi_rank=0, **kwargs)[source]
Parameters:
  • dm1 ((N, N) array) – If mo_coeff is None, AO representation is assumed.

  • local_orbitals ({'lowdin', 'mulliken', 'iao+pao'} or array) – Kind of population analysis. Default: ‘lowdin’.

Returns:

pop – Population of atomic orbitals.

Return type:

  1. array

get_atomic_charges(pop)[source]
get_corrfunc(kind, dm1=None, dm2=None, atoms=None, projection='sao', dm2_with_dm1=None, use_symmetry=True, orbital_filter=None)

Get expectation values <P(A) S_z P(B) S_z>, where P(X) are projectors onto atoms X.

TODO: MPI

Parameters:

atoms (list[int] or list[list[int]], optional) – Atom indices for which the spin-spin correlation function should be evaluated. If set to None (default), all atoms of the system will be considered. If a list is given, all atom pairs formed from this list will be considered. If a list of two lists is given, the first list contains the indices of atom A, and the second of atom B, for which <Sz(A) Sz(B)> will be evaluated. This is useful in cases where one is only interested in the correlation to a small subset of atoms. Default: None

Returns:

corr – Atom projected correlation function.

Return type:

array(N,M)

class Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, ext_rpa_correction: Union[str, NoneType] = None, match_cluster_fock: bool = False)

Bases: OptionsBase

asdict(deepcopy=False)
classmethod change_dict_defaults(field, **kwargs)
static dict_with_defaults(**kwargs)
dm_with_frozen: bool = False
ext_rpa_correction: str | None = None
get(attr, default=None)

Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.

classmethod get_default(field)
classmethod get_default_factory(field)
global_frag_chempot: float = None
items()
keys()
match_cluster_fock: bool = False
replace(**kwargs)
screening: str | None = None
store_eris: bool = True
symmetry_mf_tol: float = 1e-05
symmetry_tol: float = 1e-06
update(**kwargs)
values()
bath_options: dict
bosonic_bath_options: dict
solver_options: dict
brueckner_scmf(*args, **kwargs)

Decorator for Brueckner-DMET.

build_bosonic_bath()
build_screened_interactions(*args, **kwargs)

Build screened interactions, be they dynamic or static.

cas_fragmentation(**kwargs)

Initialize the quantum embedding method for the use of site fragments.

change_options(**kwargs)
check_solver(solver)
communicate_clusters()

Communicate cluster orbitals between MPI ranks.

create_invsym_fragments(center, fragments=None, unit='Ang', **kwargs)

Create inversion symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of inversion-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_mirrorsym_fragments(axis, center, fragments=None, unit='Ang', **kwargs)

Create mirror symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of mirror-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_rotsym_fragments(order, axis, center, fragments=None, unit='Ang', **kwargs)

Create rotationally symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of rotationally-symmetry related fragments. These will have have the attributes sym_parent and sym_op set.

Return type:

list

create_symmetric_fragments(symmetry, fragments=None, symbol=None, mf_tol=None, check_mf=True)

Add rotationally or translationally symmetric fragments.

Parameters:

mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: self.opts.symmetry_mf_tol.

Returns:

fragments – List of T-symmetry related fragments. These will have the attributes sym_parent and sym_op set.

Return type:

list

create_transsym_fragments(translation, fragments=None, **kwargs)

Create translationally symmetric fragments.

Parameters:
  • translation (array(3) of integers) – Each element represent the number of translation vector corresponding to the a0, a1, and a2 lattice vectors of the cell.

  • mf_tol (float, optional) – Tolerance for the error of the mean-field density matrix between symmetry related fragments. If the largest absolute difference in the density-matrix is above this value, and exception will be raised. Default: 1e-6.

Returns:

fragments – List of T-symmetry related fragments. These will have the attributes sym_parent and sym_op set.

Return type:

list

property df
property e_mf

Total mean-field energy per unit cell (not folded supercell). Note that the input unit cell itself can be a supercell, in which case e_mf refers to this cell.

property e_nonlocal
property e_nuc

Nuclear-repulsion energy per unit cell (not folded supercell).

get_average_cluster_size(average='mean')
get_cderi(mo_coeff, compact=False, blksize=None)
get_cderi_exspace(ex_coeff, compact=False, blksize=None)
get_corrfunc_mf(kind, dm1=None, atoms=None, projection='sao', orbital_filter=None)

dm1 in MO basis

get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True, mpi_target=None)

Calculate electronic DMET energy via democratically partitioned density-matrices.

Parameters:
  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

  • mpi_target (int or None, optional) – If set to an integer, the result will only be available at the specified MPI rank. If set to None, an MPI allreduce will be performed and the result will be available at all MPI ranks. Default: None.

Returns:

e_dmet – Electronic DMET energy.

Return type:

float

get_dmet_energy(part_cumulant=True, approx_cumulant=True, with_nuc=True, with_exxdiv=True)

Calculate DMET energy via democratically partitioned density-matrices.

Parameters:
  • part_cumulant (bool, optional) – If True, the 2-DM cumulant will be partitioned to calculate the energy. If False, the full 2-DM will be partitioned, as it is done in most of the DMET literature. True is recommended, unless checking for agreement with literature results. Default: True.

  • approx_cumulant (bool, optional) – If True, the approximate cumulant, containing (delta 1-DM)-squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.

  • with_nuc (bool, optional) – Include nuclear-repulsion energy. Default: True.

  • with_exxdiv (bool, optional) – Include divergent exact-exchange correction. Default: True.

Returns:

e_dmet – DMET energy.

Return type:

float

get_eris_array(mo_coeff, compact=False)

Get electron-repulsion integrals in MO basis as a NumPy array.

Parameters:

mo_coeff ([list(4) of] (n(AO), n(MO)) array) – MO coefficients.

Returns:

eris – Electron-repulsion integrals in MO basis.

Return type:

(n(MO), n(MO), n(MO), n(MO)) array

get_fock(dm1=None, with_exxdiv=True)

Fock matrix in AO basis.

get_fock_for_bath(dm1=None, with_exxdiv=True)

Fock matrix used for bath orbitals.

get_fock_for_energy(dm1=None, with_exxdiv=True)

Fock matrix used for energy evaluation.

get_fragment_overlap_norm(fragments=None, occupied=True, virtual=True, norm=2)

Get matrix of overlap norms between fragments.

get_fragments(fragments=None, options=None, flags=None, **filters)

Return all fragments which obey the specified conditions.

Parameters:

**filters – List of returned fragments will be filtered according to specified keyword arguments.

Returns:

fragments – List of fragments.

Return type:

list

Examples

Only returns fragments with mpi_rank 0, 1, or 2:

>>> self.get_fragments(mpi_rank=[0,1,2])

Only returns fragments with no symmetry parent:

>>> self.get_fragments(sym_parent=None)
get_hcore()

Core Hamiltonian (kinetic energy plus nuclear-electron attraction).

get_hcore_for_energy()

Core Hamiltonian used for energy evaluation.

get_lo_coeff(local_orbitals='lowdin', minao='auto')
get_max_cluster_size()
get_mean_cluster_size()
get_min_cluster_size()
get_ovlp()

AO-overlap matrix.

get_ovlp_power(power)

get power of AO overlap matrix.

For folded calculations, this uses the k-point sampled overlap, for better performance and accuracy.

Parameters:

power (float) – Matrix power.

Returns:

spow – Matrix power of AO overlap matrix

Return type:

(n(AO), n(AO)) array

get_symmetry_child_fragments(include_parents=False)

Returns a list of all fragments, which are children to symmetry related parent fragments.

Parameters:

include_parents (bool, optional) – If true, the parent fragment of each symmetry group is prepended to each symmetry sublist.

Returns:

children – A list with the length of the number of parent fragments in the system, each element being another list containing all the children fragments of the given parent fragment. Both the outer and inner lists are ordered in the same way that the fragments appear in self.fragments.

Return type:

list of lists

get_symmetry_parent_fragments()

Returns a list of all fragments, which are parents to symmetry related child fragments.

Returns:

parents – A list of all parent fragments, ordered in the same way as they appear in self.fragments.

Return type:

list

get_veff(dm1=None, with_exxdiv=True)

Hartree-Fock Coulomb and exchange potential in AO basis.

get_veff_for_energy(dm1=None, with_exxdiv=True)

Hartree-Fock potential used for energy evaluation.

has_complete_fragmentation(**kwargs)

Check if union of fragment spaces is orthonormal and complete.

has_complete_occupied_fragmentation(**kwargs)

Check if union of fragment spaces is orthonormal and complete in the occupied space.

has_complete_virtual_fragmentation(**kwargs)

Check if union of fragment spaces is orthonormal and complete in the virtual space.

property has_df
property has_exxdiv

Correction for divergent exact-exchange potential.

has_orthonormal_fragmentation(**kwargs)

Check if union of fragment spaces is orthonormal.

iao_fragmentation(minao='auto', **kwargs)

Initialize the quantum embedding method for the use of IAO fragments.

Parameters:

minao (str, optional) – IAO reference basis set. Default: ‘auto’

iaopao_fragmentation(minao='auto', **kwargs)

Initialize the quantum embedding method for the use of IAO+PAO fragments.

Parameters:

minao (str, optional) – IAO reference basis set. Default: ‘auto’

init_mf(mf)
loop()

Loop over fragments.

property mo_coeff

Molecular orbital coefficients.

property mo_energy

Molecular orbital energies.

property mo_energy_occ

Occupied MO energies.

property mo_energy_vir

Virtual MO coefficients.

property mo_occ

Molecular orbital occupations.

property mol

Mole or Cell object.

property nao

Number of atomic orbitals.

property ncells

Number of primitive cells within supercell.

property nfrag

Number of fragments.

optimize_chempot(cpt_init=0.0, dm1func=None, dm1kwds=None, robust=False)
property pbc_dimension
pdmet_scmf(*args, **kwargs)

Decorator for p-DMET.

qpewdmet_scmf(*args, **kwargs)

Decorator for QP-EWDMET.

require_complete_fragmentation(message=None, incl_virtual=True, **kwargs)
reset(*args, **kwargs)
sao_fragmentation(**kwargs)

Initialize the quantum embedding method for the use of SAO (Lowdin-AO) fragments.

set_hcore(value)
set_ovlp(value)
set_veff(value)
site_fragmentation(**kwargs)

Initialize the quantum embedding method for the use of site fragments.

write_population(pop, filename=None, filemode='a', orbital_resolved=False)

Module contents