vayesta.edmet

Submodules

vayesta.edmet.edmet

class vayesta.edmet.edmet.Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, iao_minao: str = 'auto', maxiter: int = 1, charge_consistent: bool = True, max_elec_err: float = 0.0001, conv_tol: float = 1e-06, diis: bool = True, mixing_param: float = 0.5, mixing_variable: str = 'hl rdm', oneshot: bool = False, make_dd_moments: bool = False, old_sc_condition: bool = False, max_bos: int = inf, occ_proj_kernel: bool = False, boson_xc_kernel: bool = False, bosonic_interaction: str = 'xc')[source]

Bases: Options

maxiter: int = 1
make_dd_moments: bool = False
old_sc_condition: bool = False
max_bos: int = inf
occ_proj_kernel: bool = False
boson_xc_kernel: bool = False
bosonic_interaction: str = 'xc'
asdict(deepcopy=False)
classmethod change_dict_defaults(field, **kwargs)
charge_consistent: bool = True
conv_tol: float = 1e-06
static dict_with_defaults(**kwargs)
diis: bool = True
dm_with_frozen: bool = False
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
iao_minao: str = 'auto'
items()
keys()
max_elec_err: float = 0.0001
mixing_param: float = 0.5
mixing_variable: str = 'hl rdm'
oneshot: 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()
solver_options: dict
bath_options: dict
class vayesta.edmet.edmet.EDMETResults(cluster_sizes: numpy.ndarray = None, e_corr: float = None)[source]

Bases: object

cluster_sizes: ndarray = None
e_corr: float = None
class vayesta.edmet.edmet.EDMET(mf, solver='EBFCI', log=None, **kwargs)[source]

Bases: DMET

Fragment

alias of EDMETFragment

class Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, iao_minao: str = 'auto', maxiter: int = 1, charge_consistent: bool = True, max_elec_err: float = 0.0001, conv_tol: float = 1e-06, diis: bool = True, mixing_param: float = 0.5, mixing_variable: str = 'hl rdm', oneshot: bool = False, make_dd_moments: bool = False, old_sc_condition: bool = False, max_bos: int = inf, occ_proj_kernel: bool = False, boson_xc_kernel: bool = False, bosonic_interaction: str = 'xc')

Bases: Options

asdict(deepcopy=False)
boson_xc_kernel: bool = False
bosonic_interaction: str = 'xc'
classmethod change_dict_defaults(field, **kwargs)
charge_consistent: bool = True
conv_tol: float = 1e-06
static dict_with_defaults(**kwargs)
diis: bool = True
dm_with_frozen: bool = False
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
iao_minao: str = 'auto'
items()
keys()
make_dd_moments: bool = False
max_bos: int = inf
max_elec_err: float = 0.0001
maxiter: int = 1
mixing_param: float = 0.5
mixing_variable: str = 'hl rdm'
occ_proj_kernel: bool = False
old_sc_condition: bool = False
oneshot: 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()
solver_options: dict
bath_options: dict
valid_solvers = ['EBFCI', 'EBCCSD']
property with_df
property eps
kernel()[source]

Run DMET calculation.

set_up_fragments(sym_parents, nsym)[source]
calc_electron_number_defect(chempot, nelec_target, parent_fragments, nsym, construct_bath=True)[source]
get_updated_correlation_kernel(curr_dd0, curr_dd1, sym_parents, sym_children)[source]

Generate the update to our RPA exchange-correlation kernel this iteration.

improve_nl_energy(use_plasmon=True, deg=5)[source]

Perform exact adiabatic-connection integration to obtain improved estimate for the nonlocal correlation energy at the level of RPA. This is initially only calculated using a linear approximation.

run_exact_full_ac(xc_kernel=None, deg=5, calc_local=False, cluster_constrain=False, npoints=48)[source]

During calculation we only calculate the linearised nonlocal correlation energy, since this is relatively cheap (only a single RPA numerical integration). This instead performs the exact energy via numerical integration of the adiabatic connection.

brueckner_scmf(*args, **kwargs)

Decorator for Brueckner-DMET.

build_screened_eris(*args, **kwargs)

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.

  • calc_ecorrection (bool, optional.) – Whether to calculate a nonlocal energy correction at the level of RPA

  • 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.

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

cas_fragmentation(**kwargs)

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

change_options(**kwargs)
check_fragment_symmetry(dm1, charge_tol=1e-06, spin_tol=1e-06)
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_nuc

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

property e_tot
get_atomic_charges(pop)
get_average_cluster_size(average='mean')
get_cderi(mo_coeff, compact=False, blksize=None)

Get density-fitted three-center integrals in MO basis.

get_corrfunc(kind, dm1=None, dm2=None, **kwargs)

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_corrfunc_mf(kind, dm1=None, atoms=None, projection='sao')

dm1 in MO basis

get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True)

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.

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_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

get_exxdiv()

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_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_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_impurity_coeffs()
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)
is_rhf = True
is_uhf = False
loop()

Loop over fragments.

make_rdm1(*args, **kwargs)

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_rdm1_demo(*args, **kwargs)

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 – One-particle reduced density matrix in AO (if ao_basis=True) or MO basis (default).

Return type:

(n, n) array

make_rdm2(*args, **kwargs)

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.

Returns:

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

Return type:

(n, n, n, n) array

make_rdm2_demo(*args, **kwargs)

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.

Returns:

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

Return type:

(n, n, n, n) array

property mo_coeff

Molecular orbital coefficients.

property mo_coeff_occ

Occupied MO coefficients.

property mo_coeff_vir

Virtual MO 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.

property nmo

Total number of molecular orbitals (MOs).

property nocc

Number of occupied MOs.

property nvir

Number of virtual MOs.

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

Decorator for p-DMET.

pop_analysis(dm1, mo_coeff=None, local_orbitals='lowdin', minao='auto', write=True, filename=None, filemode='a', orbital_resolved=False, mpi_rank=0)
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

print_clusters()

Print fragments of calculations.

print_results()
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.

spinsym = 'restricted'
update_mf(mo_coeff, mo_energy=None, veff=None)

Update underlying mean-field object.

update_vcorr(fock, curr_rdms)
write_population(pop, filename=None, filemode='a', orbital_resolved=False)
vayesta.edmet.edmet.REDMET

alias of EDMET

vayesta.edmet.fragment

exception vayesta.edmet.fragment.EDMETFragmentExit[source]

Bases: Exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class vayesta.edmet.fragment.Options(bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, coupled_fragments: list = <factory>, sym_factor: float = 1.0, make_dd_moments: bool = None, old_sc_condition: bool = None, max_bos: int = None, occ_proj_kernel: bool = None, boson_xc_kernel: bool = None, bosonic_interaction: str = None)[source]

Bases: Options

make_dd_moments: bool = None
old_sc_condition: bool = None
max_bos: int = None
occ_proj_kernel: bool = None
boson_xc_kernel: bool = None
bosonic_interaction: str = None
asdict(deepcopy=False)
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()
replace(**kwargs)
screening: Optional[str] = None
solver_options: dict = None
store_eris: bool = None
sym_factor: float = 1.0
update(**kwargs)
values()
coupled_fragments: list
class vayesta.edmet.fragment.Results(fid: int = None, converged: bool = None, e_corr: float = None, wf: vayesta.core.types.wf.WaveFunction = None, pwf: vayesta.core.types.wf.WaveFunction = None, n_active: int = None, e1: float = None, e2: float = None, dm1: numpy.ndarray = None, dm2: numpy.ndarray = None, dm_eb: numpy.ndarray = None, eb_couplings: numpy.ndarray = None, boson_freqs: tuple = None, dd_mom0: numpy.ndarray = None, dd_mom1: numpy.ndarray = None, e_fb: float = None)[source]

Bases: Results

dm_eb: ndarray = None
eb_couplings: ndarray = None
boson_freqs: tuple = None
dd_mom0: ndarray = None
dd_mom1: ndarray = None
e_fb: float = None
converged: bool = None
dm1: np.ndarray = None
dm2: np.ndarray = None
e1: float = None
e2: float = None
e_corr: float = None
fid: int = None
n_active: int = None
pwf: WaveFunction = None
wf: WaveFunction = None
class vayesta.edmet.fragment.EDMETFragment(*args, **kwargs)[source]

Bases: DMETFragment

class Options(bath_options: dict = None, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, coupled_fragments: list = <factory>, sym_factor: float = 1.0, make_dd_moments: bool = None, old_sc_condition: bool = None, max_bos: int = None, occ_proj_kernel: bool = None, boson_xc_kernel: bool = None, bosonic_interaction: str = None)

Bases: Options

asdict(deepcopy=False)
bath_options: dict = None
boson_xc_kernel: bool = None
bosonic_interaction: str = 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()
make_dd_moments: bool = None
max_bos: int = None
occ_proj_kernel: bool = None
old_sc_condition: bool = None
replace(**kwargs)
screening: Optional[str] = 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, wf: vayesta.core.types.wf.WaveFunction = None, pwf: vayesta.core.types.wf.WaveFunction = None, n_active: int = None, e1: float = None, e2: float = None, dm1: numpy.ndarray = None, dm2: numpy.ndarray = None, dm_eb: numpy.ndarray = None, eb_couplings: numpy.ndarray = None, boson_freqs: tuple = None, dd_mom0: numpy.ndarray = None, dd_mom1: numpy.ndarray = None, e_fb: float = None)

Bases: Results

boson_freqs: tuple = None
converged: bool = None
dd_mom0: ndarray = None
dd_mom1: ndarray = None
dm1: np.ndarray = None
dm2: np.ndarray = None
dm_eb: ndarray = None
e1: float = None
e2: float = None
e_corr: float = None
e_fb: float = None
eb_couplings: ndarray = None
fid: int = None
n_active: int = None
pwf: WaveFunction = None
wf: WaveFunction = None
property ov_active
property ov_active_tot
property ov_mf
property nbos
property r_bos
property r_bos_ao
property r_ao_bos
property energy_couplings
get_fock()[source]
get_co_active()[source]
get_cv_active()[source]
get_rot_to_mf_ov()[source]
get_fragment_projector_ov(proj='o', inc_bosons=False)[source]

In space of cluster p-h excitations, generate the projector to the impurity portion of the occupied index.

set_up_fermionic_bath()[source]

Set up the fermionic bath orbitals

define_bosons(rpa_mom, rot_ov=None, tol=1e-08)[source]

Given the RPA zeroth moment between the fermionic cluster excitations and the rest of the space, define our cluster bosons. Note that this doesn’t define our Hamiltonian, since we don’t yet have the required portion of our zeroth moment for the bosonic degrees of freedom.

construct_boson_hamil(eta0_bos, eps, xc_kernel)[source]

Given the zeroth moment coupling of our bosons to the remainder of the space, along with stored information, generate the components of our interacting electron-boson Hamiltonian. At the same time, calculate the local RPA correlation energy since this requires all the same information we already have to hand.

store_cluster_rpa(eta0_bos, eps, xc_kernel)[source]

This function just stores all required information for the

get_eri_couplings(rot)[source]

Obtain eri in a space defined by an arbitrary rotation of the mean-field particle-hole excitations of our systems. Note that this should only really be used in the case that such a rotation cannot be described by a rotation of the underlying single-particle basis, since highly efficient routines already exist for this case..

conv_to_aos(ra, rb)[source]
get_xc_couplings(xc_kernel, rot)[source]
get_loc_eps(eps, rot)[source]
proj_hamil_qba(exchange_between_bos=True)[source]

Generate quasi-bosonic Hamiltonian via projection of appropriate Hamiltonian elements of full system. This represents the bosons as an explicit sum of environmental excitations, which we then approximate as bosonic

degrees of freedom.

check_qba_approx(rdm1)[source]

Given boson and cluster coefficient definitions, checks deviation from exact bosonic commutation relations within our cluster projected onto the ground state. This will hopefully tell us whether our bosons are likely to be a good approximation to the full system. We could take the L2 norm of the overall deviation, but given most of the resultant operators have essentially negligible expectation values with the ground state this is an unnecessarily pessimistic estimator.

get_rbos_split()[source]
kernel(solver=None, eris=None, construct_bath=False, chempot=None)[source]

Solve the fragment with the specified solver and chemical potential.

get_solver_options(solver)[source]
get_edmet_energy_contrib(eris=None)[source]

Generate EDMET energy contribution, according to expression given in appendix of EDMET preprint

construct_correlation_kernel_contrib(epsilon, m0_new, m1_new, eris=None, svdtol=1e-12)[source]

Generate the contribution to the correlation kernel arising from this fragment, in terms of local degrees of freedom (ie cluster orbitals and bosons).

get_correlation_kernel_contrib(contrib)[source]

Gets contribution to xc kernel in full space of system.

get_composite_moments(m0_new, m1_new)[source]

Construct composite moments using the local solver dd moments and the lattice RPA moments

get_rot_ov_frag()[source]

Get rotations between the relevant space for fragment two-point excitations and the cluster active occupied- virtual excitations.

calc_exact_ac(eps, use_plasmon=True, deg=5)[source]

Evaluate the exact local energy for RPA in this cluster via the Adiabatic Connection, with or without the plasmon formula. Note that although

test_total_rpa_energy(eps, use_plasmon=True, deg=5)[source]

Evaluate the exact local energy for RPA in this cluster via the Adiabatic Connection, with or without the plasmon formula. Note that although

property ov_active_ab
property nocc_ab
property nclus_ab
property nvir_ab
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
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)
property cluster
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_dmet_energy_contrib(eris=None)

Calculate the contribution of this fragment to the overall DMET energy.

TODO: use core.qemb.fragment.get_fragment_dmet_energy instead?

get_frag_hl_dm()
get_fragment_dmet_energy(dm1=None, dm2=None, h1e_eff=None, eris=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.

  • eris (array, optional) – Cluster electron-repulsion integrals in cluster basis. If None, the ERIs are reevaluated. Default: None.

  • 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_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_nelectron_hl()
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_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 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_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

make_tsymmetric_fragments(*args, **kwargs)
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)
property results
split_ov_spin_components(mat)[source]
property symmetry_factor

Includes children of children, etc.

trimmed_name(length=10, add_dots=True)

Fragment name trimmed to a given maximum length.

vayesta.edmet.fragment.bogoliubov_decouple(apb, amb)[source]

vayesta.edmet.uedmet

class vayesta.edmet.uedmet.UEDMET(mf, solver='EBFCI', log=None, **kwargs)[source]

Bases: EDMET, UDMET

property eps
Fragment

alias of UEDMETFragment

class Options(store_eris: bool = True, global_frag_chempot: float = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e-06, symmetry_mf_tol: float = 1e-05, screening: Union[str, NoneType] = None, iao_minao: str = 'auto', maxiter: int = 1, charge_consistent: bool = True, max_elec_err: float = 0.0001, conv_tol: float = 1e-06, diis: bool = True, mixing_param: float = 0.5, mixing_variable: str = 'hl rdm', oneshot: bool = False, make_dd_moments: bool = False, old_sc_condition: bool = False, max_bos: int = inf, occ_proj_kernel: bool = False, boson_xc_kernel: bool = False, bosonic_interaction: str = 'xc')

Bases: Options

asdict(deepcopy=False)
boson_xc_kernel: bool = False
bosonic_interaction: str = 'xc'
classmethod change_dict_defaults(field, **kwargs)
charge_consistent: bool = True
conv_tol: float = 1e-06
static dict_with_defaults(**kwargs)
diis: bool = True
dm_with_frozen: bool = False
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
iao_minao: str = 'auto'
items()
keys()
make_dd_moments: bool = False
max_bos: int = inf
max_elec_err: float = 0.0001
maxiter: int = 1
mixing_param: float = 0.5
mixing_variable: str = 'hl rdm'
occ_proj_kernel: bool = False
old_sc_condition: bool = False
oneshot: 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()
solver_options: dict
bath_options: dict
brueckner_scmf(*args, **kwargs)

Decorator for Brueckner-DMET.

build_screened_eris(*args, **kwargs)

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.

  • calc_ecorrection (bool, optional.) – Whether to calculate a nonlocal energy correction at the level of RPA

  • 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.

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

calc_electron_number_defect(chempot, nelec_target, parent_fragments, nsym, construct_bath=True)
cas_fragmentation(**kwargs)

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

change_options(**kwargs)
check_fragment_symmetry(dm1, charge_tol=1e-06, spin_tol=1e-06)
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_nuc

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

property e_tot
get_atomic_charges(pop)
get_average_cluster_size(average='mean')
get_cderi(mo_coeff, compact=False, blksize=None)

Get density-fitted three-center integrals in MO basis.

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

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_corrfunc_mf(kind, dm1=None, atoms=None, projection='sao')

dm1 in MO basis

get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True)

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.

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_eris_array_uhf(mo_coeff, mo_coeff2=None, compact=False)

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)

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

get_exxdiv()

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_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_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_impurity_coeffs()
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_updated_correlation_kernel(curr_dd0, curr_dd1, sym_parents, sym_children)

Generate the update to our RPA exchange-correlation kernel this iteration.

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’

improve_nl_energy(use_plasmon=True, deg=5)

Perform exact adiabatic-connection integration to obtain improved estimate for the nonlocal correlation energy at the level of RPA. This is initially only calculated using a linear approximation.

init_mf(mf)
is_rhf = False
is_uhf = True
kernel()

Run DMET calculation.

loop()

Loop over fragments.

make_rdm1(*args, **kwargs)

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_rdm1_demo(*args, **kwargs)

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(*args, **kwargs)

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.

Returns:

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

Return type:

(n, n, n, n) array

make_rdm2_demo(*args, **kwargs)

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.

Returns:

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

Return type:

(n, n, n, n) array

property mo_coeff

Molecular orbital coefficients.

property mo_coeff_occ

Occupied MO coefficients.

property mo_coeff_vir

Virtual MO 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.

property nmo

Total number of molecular orbitals (MOs).

property nocc

Number of occupied MOs.

property nvir

Number of virtual MOs.

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

Decorator for p-DMET.

pop_analysis(dm1, mo_coeff=None, local_orbitals='lowdin', write=True, minao='auto', mpi_rank=0, **kwargs)
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

print_clusters()

Print fragments of calculations.

print_results()
require_complete_fragmentation(message=None, incl_virtual=True, **kwargs)
reset(*args, **kwargs)
run_exact_full_ac(xc_kernel=None, deg=5, calc_local=False, cluster_constrain=False, npoints=48)

During calculation we only calculate the linearised nonlocal correlation energy, since this is relatively cheap (only a single RPA numerical integration). This instead performs the exact energy via numerical integration of the adiabatic connection.

sao_fragmentation(**kwargs)

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

set_hcore(value)
set_ovlp(value)
set_up_fragments(sym_parents, nsym)
set_veff(value)
site_fragmentation(**kwargs)

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

spinsym = 'unrestricted'
update_mf(mo_coeff, mo_energy=None, veff=None)

Update underlying mean-field object.

update_vcorr(fock, curr_rdms)
valid_solvers = ['EBFCI', 'EBCCSD']
property with_df
write_population(pop, filename=None, filemode='a', orbital_resolved=False)

vayesta.edmet.ufragment

class vayesta.edmet.ufragment.UEDMETFragment(*args, **kwargs)[source]

Bases: UDMETFragment, EDMETFragment

property ov_active
property ov_active_tot
property ov_mf
property r_bos_ao
get_fock()[source]
get_co_active()[source]
get_cv_active()[source]
get_rot_to_mf_ov()[source]
get_fragment_projector_ov(proj='o', inc_bosons=False)[source]

In space of cluster p-h excitations, generate the projector to the .

conv_to_aos(ra, rb)[source]
get_eri_couplings(rot)[source]

Obtain eri in a space defined by an arbitrary rotation of the mean-field particle-hole excitations of our systems. Note that this should only really be used in the case that such a rotation cannot be described by a rotation of the underlying single-particle basis, since highly efficient routines already exist for this case..

get_rbos_split()[source]
get_rot_ov_frag()[source]

Get rotations between the relevant space for fragment two-point excitations and the cluster active occupied- virtual excitations.

get_correlation_kernel_contrib(contrib)[source]

Gets contribution to xc kernel in full space of system.

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, solver_options: dict = None, store_eris: bool = None, dm_with_frozen: bool = None, screening: Union[str, NoneType] = None, coupled_fragments: list = <factory>, sym_factor: float = 1.0, make_dd_moments: bool = None, old_sc_condition: bool = None, max_bos: int = None, occ_proj_kernel: bool = None, boson_xc_kernel: bool = None, bosonic_interaction: str = None)

Bases: Options

asdict(deepcopy=False)
bath_options: dict = None
boson_xc_kernel: bool = None
bosonic_interaction: str = 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()
make_dd_moments: bool = None
max_bos: int = None
occ_proj_kernel: bool = None
old_sc_condition: bool = None
replace(**kwargs)
screening: Optional[str] = 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, wf: vayesta.core.types.wf.WaveFunction = None, pwf: vayesta.core.types.wf.WaveFunction = None, n_active: int = None, e1: float = None, e2: float = None, dm1: numpy.ndarray = None, dm2: numpy.ndarray = None, dm_eb: numpy.ndarray = None, eb_couplings: numpy.ndarray = None, boson_freqs: tuple = None, dd_mom0: numpy.ndarray = None, dd_mom1: numpy.ndarray = None, e_fb: float = None)

Bases: Results

boson_freqs: tuple = None
converged: bool = None
dd_mom0: ndarray = None
dd_mom1: ndarray = None
dm1: np.ndarray = None
dm2: np.ndarray = None
dm_eb: ndarray = None
e1: float = None
e2: float = None
e_corr: float = None
e_fb: float = None
eb_couplings: ndarray = None
fid: int = None
n_active: int = 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

calc_exact_ac(eps, use_plasmon=True, deg=5)

Evaluate the exact local energy for RPA in this cluster via the Adiabatic Connection, with or without the plasmon formula. Note that although

canonicalize_mo(*mo_coeff, fock=None, **kwargs)

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.

change_options(**kwargs)
check_qba_approx(rdm1)

Given boson and cluster coefficient definitions, checks deviation from exact bosonic commutation relations within our cluster projected onto the ground state. This will hopefully tell us whether our bosons are likely to be a good approximation to the full system. We could take the L2 norm of the overall deviation, but given most of the resultant operators have essentially negligible expectation values with the ground state this is an unnecessarily pessimistic estimator.

property cluster
construct_boson_hamil(eta0_bos, eps, xc_kernel)

Given the zeroth moment coupling of our bosons to the remainder of the space, along with stored information, generate the components of our interacting electron-boson Hamiltonian. At the same time, calculate the local RPA correlation energy since this requires all the same information we already have to hand.

construct_correlation_kernel_contrib(epsilon, m0_new, m1_new, eris=None, svdtol=1e-12)

Generate the contribution to the correlation kernel arising from this fragment, in terms of local degrees of freedom (ie cluster orbitals and bosons).

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)
define_bosons(rpa_mom, rot_ov=None, tol=1e-08)

Given the RPA zeroth moment between the fermionic cluster excitations and the rest of the space, define our cluster bosons. Note that this doesn’t define our Hamiltonian, since we don’t yet have the required portion of our zeroth moment for the bosonic degrees of freedom.

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

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.

property energy_couplings
get_coeff_env()
get_composite_moments(m0_new, m1_new)

Construct composite moments using the local solver dd moments and the lattice RPA moments

get_dmet_energy_contrib(eris=None)

Calculate the contribution of this fragment to the overall DMET energy.

get_edmet_energy_contrib(eris=None)

Generate EDMET energy contribution, according to expression given in appendix of EDMET preprint

get_frag_hl_dm()
get_fragment_dmet_energy(dm1=None, dm2=None, h1e_eff=None, eris=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.

  • eris (array, optional) – Cluster electron-repulsion integrals in cluster basis. If None, the ERIs are reevaluated. Default: None.

  • 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, **kwargs)

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_loc_eps(eps, rot)
get_mo_occupation(*mo_coeff, dm1=None, **kwargs)

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)

get_nelectron_hl()
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_options(solver)
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]), …]

get_xc_couplings(xc_kernel, rot)
property id_name

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

kernel(solver=None, eris=None, construct_bath=False, chempot=None)

Solve the fragment with the specified solver and chemical potential.

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_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

make_tsymmetric_fragments(*args, **kwargs)
property mf
property mol
property n_frag

Number of fragment orbitals.

property n_symmetry_children

Includes children of children, etc.

property nbos
property nclus_ab
property nelectron

Number of mean-field electrons.

property nocc_ab
property nvir_ab
property ov_active_ab
plot3d(filename, gridsize=(100, 100, 100), **kwargs)

Write cube density data of fragment orbitals to file.

pop_analysis(cluster=None, dm1=None, **kwargs)
proj_hamil_qba(exchange_between_bos=True)

Generate quasi-bosonic Hamiltonian via projection of appropriate Hamiltonian elements of full system. This represents the bosons as an explicit sum of environmental excitations, which we then approximate as bosonic

degrees of freedom.

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.

property r_ao_bos
property r_bos
reset(reset_bath=True, reset_cluster=True, reset_eris=True)
property results
set_cas(*args, **kwargs)
set_up_fermionic_bath()

Set up the fermionic bath orbitals

split_ov_spin_components(mat)
store_cluster_rpa(eta0_bos, eps, xc_kernel)

This function just stores all required information for the

property symmetry_factor

Includes children of children, etc.

test_total_rpa_energy(eps, use_plasmon=True, deg=5)

Evaluate the exact local energy for RPA in this cluster via the Adiabatic Connection, with or without the plasmon formula. Note that although

trimmed_name(length=10, add_dots=True)

Fragment name trimmed to a given maximum length.

Module contents

Extended Density Matrix Embedding Theory (EDMET) method Author: Charles Scott email: cjcargillscott@gmail.com

vayesta.edmet.EDMET(mf, *args, **kwargs)[source]

Determine restricted or unrestricted by inspection of mean-field object