vayesta.ewf
Submodules
vayesta.ewf.ewf
 class vayesta.ewf.ewf.Options(store_eris: bool = True, global_frag_chempot: float  None = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e06, symmetry_mf_tol: float = 1e05, screening: str  None = None, ext_rpa_correction: str  None = None, match_cluster_fock: bool = False, iao_minao: str = 'auto', project_eris: bool = False, project_init_guess: bool = True, energy_functional: str = 'wf', calc_e_wf_corr: bool = True, calc_e_dm_corr: bool = False, t_as_lambda: bool  None = None, store_wf_type: str  None = None, bsse_correction: bool = True, bsse_rmax: float = 5.0, nelectron_target: int  None = None, sc_mode: int = 0, coupled_iterations: bool = False, _debug_wf: str  None = None)[source]
Bases:
Options
Options for EWF calculations.
 iao_minao: str = 'auto'
 bath_options: dict
 project_eris: bool = False
 project_init_guess: bool = True
 energy_functional: str = 'wf'
 calc_e_wf_corr: bool = True
 calc_e_dm_corr: bool = False
 t_as_lambda: bool = None
 store_wf_type: str = None
 bsse_correction: bool = True
 bsse_rmax: float = 5.0
 nelectron_target: int = None
 sc_mode: int = 0
 coupled_iterations: bool = False
 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)
Dictionarylike 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 = 1e05
 symmetry_tol: float = 1e06
 update(**kwargs)
 values()
 bosonic_bath_options: dict
 solver_options: dict
 class vayesta.ewf.ewf.EWF(mf, solver='CCSD', log=None, **kwargs)[source]
Bases:
Embedding
 class Fragment(*args, **kwargs)
Bases:
Fragment
 class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: Union[int, NoneType] = None, external_corrections: Union[List[Any], NoneType] = <factory>, test_extcorr: bool = False)
Bases:
Flags
 bath_parent_fragment_id: int  None = None
 is_envelop: bool = True
 is_secfrag: bool = False
 test_extcorr: bool = False
 external_corrections: List[Any]  None
 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, t_as_lambda: bool = None, bsse_correction: bool = None, bsse_rmax: float = None, sc_mode: int = None, nelectron_target: float = None, nelectron_target_atol: float = 1e06, nelectron_target_rtol: float = 1e06, calc_e_wf_corr: bool = None, calc_e_dm_corr: bool = None, store_wf_type: str = None, wf_factor: Union[int, NoneType] = None, c_cas_occ: numpy.ndarray = None, c_cas_vir: numpy.ndarray = None, tcc_fci_opts: dict = <factory>)
Bases:
Options
 asdict(deepcopy=False)
 auxiliary: bool = False
 bath_options: dict = None
 bosonic_bath_options: dict = None
 bsse_correction: bool = None
 bsse_rmax: float = None
 c_cas_occ: ndarray = None
 c_cas_vir: ndarray = None
 calc_e_dm_corr: bool = None
 calc_e_wf_corr: bool = None
 classmethod change_dict_defaults(field, **kwargs)
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = None
 get(attr, default=None)
Dictionarylike 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
 nelectron_target: float = None
 nelectron_target_atol: float = 1e06
 nelectron_target_rtol: float = 1e06
 replace(**kwargs)
 sc_mode: int = None
 screening: str  None = None
 solver_options: dict = None
 store_eris: bool = None
 store_wf_type: str = None
 sym_factor: float = 1.0
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 wf_factor: int  None = None
 tcc_fci_opts: dict
 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, e_corr_dm2cumulant: float = None, n_active: int = None, ip_energy: numpy.ndarray = None, ea_energy: numpy.ndarray = None)
Bases:
Results
 converged: bool = None
 property dm1
Cluster 1DM
 property dm2
Cluster 2DM
 e_corr: float = None
 e_corr_dm2cumulant: float = None
 e_corr_rpa: float = None
 ea_energy: ndarray = None
 fid: int = None
 ip_energy: ndarray = None
 moms: tuple = None
 n_active: int = None
 pwf: WaveFunction = None
 wf: WaveFunction = None
 add_external_corrections(fragments, correction_type='tailor', projectors=1, test_extcorr=False, low_level_coul=True)
Add tailoring or external correction from other fragment solutions to CCSD solver.
 Parameters:
fragments (list) – List of solved or auxiliary fragments, used for the correction.
correction_type (str, optional) –
 Type of correction:
’tailor’: replace CCSD T1 and T2 amplitudes with FCI amplitudes. ‘deltatailor’: Add the difference of FCI and CCSD T1 and T2 amplitudes ‘external’: externally correct CCSD T1 and T2 amplitudes from FCI T3 and T4 amplitudes.
Default: ‘tailor’.
projectors (int, optional) – Maximum number of projections applied to the occupied dimensions of the amplitude corrections. Default: 1.
test_extcorr (bool, optional) – Whether to perform additional checks on the external corrections.
low_level_coul (bool, optional) – This is an option specific to the ‘external’ correction. If True, then the T3V term is contracted with integrals spanning the ‘lowlevel’ (i.e. CCSD) solver, i.e. the cluster being constrained. If False, then the T3V term is contracted with the integrals in the ‘highlevel’ (i.e. FCI) solver, i.e. the cluster providing the constraints. In general, there should be a slight speed increase, and slight loss of accuracy for the low_level_coul=False option, but in practice, we find only minor differences. Default: True
 add_tsymmetric_fragments(tvecs, symtol=1e06)
 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry 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)
 clear_external_corrections()
Remove all tailoring or external correction which were added via add_external_corrections.
 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.
 counterpoise_calculation(rmax, dm0=None, nimages=5, unit='A')
 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) – Meanfield 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= 1e4.
 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_bsse(rmax=None, nimages=5, unit='A')
 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 nuclearnuclear repulsion must be added to get the total energy!
 Parameters:
dm1 (array, optional) – Cluster oneelectron reduced densitymatrix in cluster basis. If None, self.results.dm1 is used. Default: None.
dm2 (array, optional) – Cluster twoelectron reduced densitymatrix 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 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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_energy(c1, c2, hamil=None, fock=None, c2ba_order='ba', axis1='fragment')
Calculate fragment correlation energy contribution from projected C1, C2.
 Parameters:
c1 ((n(occCO), n(virCO)) array) – Fragment projected C1amplitudes.
c2 ((n(occCO), n(occCO), n(virCO), n(virCO)) array) – Fragment projected C2amplitudes.
hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.
fock ((n(AO), n(AO)) array, optional) – Fock matrix in AO representation. If None, self.base.get_fock_for_energy() is used. Default: None.
 Returns:
e_singles (float) – Fragment correlation energy contribution from single excitations.
e_doubles (float) – Fragment correlation energy contribution from double excitations.
e_corr (float) – Total fragment correlation energy contribution.
 get_fragment_mf_energy()
Calculate the part of the meanfield energy associated with the fragment.
Does not include nuclearnuclear 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 1p instead. Default: False.
 Returns:
p – Projection matrix.
 Return type:
(n, n) array
 get_fragments_with_overlap(tol=1e08, **kwargs)
Get list of fragments which overlap both in occupied and virtual space.
 get_init_guess(init_guess, solver, cluster)
 get_local_rpa_correction(hamil=None)
 get_mo_occupation(*mo_coeff, dm1=None)
Get meanfield occupation numbers (diagonal of 1RDM) 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(‘clustermo’) >>> s = self.get_overlap(‘clusterfrag’) >>> s = self.get_overlap(‘mo[occ]cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]cluster[vir]’)
 get_solver(solver=None)
 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]), …]
 property hamil
 property id_name
Use this whenever a unique name is needed (for example to open a separate file for each fragment).
 kernel(solver=None, init_guess=None)
 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 ghostatoms 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_fragment_dm1(t_as_lambda=False, sym_t2=True)
Currently CCSD only.
Without meanfield contribution!
 make_fragment_dm2cumulant(t_as_lambda=False, sym_t2=True, sym_dm2=True, full_shape=True, approx_cumulant=True)
Currently MP2/CCSD only
 make_fragment_dm2cumulant_energy(hamil=None, t_as_lambda=False, sym_t2=True, approx_cumulant=True)
 property mf
 property mol
 property n_frag
Number of fragment orbitals.
 property n_symmetry_children
Includes children of children, etc.
 property nelectron
Number of meanfield 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
 set_cas(iaos=None, c_occ=None, c_vir=None, minao='auto', dmet_threshold=None)
Set complete active space for tailored CCSD and activespace CC methods.
 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 = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e06, symmetry_mf_tol: float = 1e05, screening: str  None = None, ext_rpa_correction: str  None = None, match_cluster_fock: bool = False, iao_minao: str = 'auto', project_eris: bool = False, project_init_guess: bool = True, energy_functional: str = 'wf', calc_e_wf_corr: bool = True, calc_e_dm_corr: bool = False, t_as_lambda: bool  None = None, store_wf_type: str  None = None, bsse_correction: bool = True, bsse_rmax: float = 5.0, nelectron_target: int  None = None, sc_mode: int = 0, coupled_iterations: bool = False, _debug_wf: str  None = None)
Bases:
Options
Options for EWF calculations.
 asdict(deepcopy=False)
 bsse_correction: bool = True
 bsse_rmax: float = 5.0
 calc_e_dm_corr: bool = False
 calc_e_wf_corr: bool = True
 classmethod change_dict_defaults(field, **kwargs)
 coupled_iterations: bool = False
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = False
 energy_functional: str = 'wf'
 ext_rpa_correction: str  None = None
 get(attr, default=None)
Dictionarylike 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()
 match_cluster_fock: bool = False
 nelectron_target: int = None
 project_eris: bool = False
 project_init_guess: bool = True
 replace(**kwargs)
 sc_mode: int = 0
 screening: str  None = None
 store_eris: bool = True
 store_wf_type: str = None
 symmetry_mf_tol: float = 1e05
 symmetry_tol: float = 1e06
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 bath_options: dict
 bosonic_bath_options: dict
 solver_options: dict
 get_global_t1(get_lambda=False, mpi_target=None, ao_basis=False, for_dm2=False)
Get global CCSD T1 amplitudes from fragment calculations.
Runtime: N(frag)/N(MPI) * N^2
 Parameters:
get_lambda (bool, optional) – If True, return L1 amplitudes. Default: False.
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:
t1 – Global T1 amplitudes.
 Return type:
(n(occ), n(vir)) array
 get_global_t2(get_lambda=False, symmetrize=True, mpi_target=None, ao_basis=False, for_dm2=False)
Get global CCSD T2 amplitudes from fragment calculations.
Runtime: N(frag)/N(MPI) * N^4
 Parameters:
get_lambda (bool, optional) – If True, return L1 amplitudes. Default: False.
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:
t2 – Global T2 amplitudes.
 Return type:
(n(occ), n(occ), n(vir), n(vir)) array
 get_dm_corr_energy(dm1='globalwf', dm2='projectedlambda', t_as_lambda=None, with_exxdiv=None)[source]
 get_dm_corr_energy_e2(dm2='projectedlambda', t_as_lambda=None)[source]
Correlation energy due to cumulant
 get_ccsd_corr_energy(full_wf=False)[source]
Get projected correlation energy from partitioned CCSD WF.
This is the projected (T1, T2) energy expression, instead of the projected (C1, C2) expression used in PRX (the differences are very small).
For testing only, UHF and MPI not implemented
 property e_tot
Total energy.
 get_fbc_energy(occupied=True, virtual=True)[source]
Get finitebath correction (FBC) energy.
This correction consists of two independent contributions, one due to the finite occupied, and one due to the finite virtual space.
The virtual correction for a given fragment x is calculated as “E(MP2)[occ=D,vir=F]  E(MP2)[occ=D,vir=C]”, where D is the DMET cluster space, F is the full space, and C is the full cluster space. For the occupied correction, occ and vir spaces are swapped. Fragments which do not have a BNO bath are skipped.
 Parameters:
occupied (bool, optional) – If True, the FBC energy from the occupied space is included. Default: True.
virtual (bool, optional) – If True, the FBC energy from the virtual space is included. Default: True.
 Returns:
e_fbc – Finite bath correction (FBC) energy.
 Return type:
float
 brueckner_scmf(*args, **kwargs)
Decorator for BruecknerDMET.
 build_bosonic_bath()
 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.) – Choleskydecomposed ERIs in the particlehole 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 spindependent screened (ovov), 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.
 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_fragment_symmetry(dm1, symtol=1e06)
Check that the meanfield obeys the symmetry between fragments.
 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of inversionsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of mirrorsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of rotationallysymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: self.opts.symmetry_mf_tol.
 Returns:
fragments – List of Tsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry related fragments. These will have the attributes sym_parent and sym_op set.
 Return type:
list
 property df
 property e_mf
Total meanfield 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
Nuclearrepulsion energy per unit cell (not folded supercell).
 get_atomic_charges(pop)
 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(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 spinspin 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', orbital_filter=None)
dm1 in MO basis
 get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True)
Calculate electronic DMET energy via democratically partitioned densitymatrices.
 Parameters:
part_cumulant (bool, optional) – If True, the 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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 densitymatrices.
 Parameters:
part_cumulant (bool, optional) – If True, the 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.
with_nuc (bool, optional) – Include nuclearrepulsion energy. Default: True.
with_exxdiv (bool, optional) – Include divergent exactexchange correction. Default: True.
 Returns:
e_dmet – DMET energy.
 Return type:
float
 get_eris_array(mo_coeff, compact=False)
Get electronrepulsion integrals in MO basis as a NumPy array.
 Parameters:
mo_coeff ([list(4) of] (n(AO), n(MO)) array) – MO coefficients.
 Returns:
eris – Electronrepulsion integrals in MO basis.
 Return type:
(n(MO), n(MO), n(MO), n(MO)) array
 get_eris_object(postscf, fock=None)
Get ERIs for postSCF methods.
For folded PBC calculations, this folds the MO back into kspace and contracts with the kspace threecenter integrals..
 Parameters:
postscf (one of the following PySCF methods: MP2, CCSD, RCCSD, DFCCSD) – PostSCF method with attribute mo_coeff set.
 Returns:
eris – ERIs which can be used for the respective postscf method.
 Return type:
_ChemistsERIs
 get_exxdiv()
Get divergent exactexchange (exxdiv) energy correction and potential.
 Returns:
e_exxdiv (float) – Divergent exactexchange energy correction per unit cell.
v_exxdiv (array) – Divergent exactexchange 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_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 nuclearelectron 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()
AOoverlap matrix.
 get_ovlp_power(power)
get power of AO overlap matrix.
For folded calculations, this uses the kpoint 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)
HartreeFock Coulomb and exchange potential in AO basis.
 get_veff_for_energy(dm1=None, with_exxdiv=True)
HartreeFock 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 exactexchange 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_demo(*args, **kwargs)
Make democratically partitioned oneparticle reduced densitymatrix from fragment calculations.
Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg, LowdinAO or IAO+PAO fragmentation).
 Parameters:
ao_basis (bool, optional) – Return the densitymatrix in the AO basis. Default: False.
with_mf (bool, optional) – Add the meanfield contribution to the densitymatrix (double counting is accounted for). Is only used if partition = ‘dm’. Default: False.
symmetrize (bool, optional) – Symmetrize the densitymatrix at the end of the calculation. Default: True.
 Returns:
dm1 – Oneparticle reduced density matrix in AO (if ao_basis=True) or MO basis (default).
 Return type:
(n, n) array
 make_rdm2_demo(*args, **kwargs)
Make democratically partitioned twoparticle reduced densitymatrix from fragment calculations.
Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg. LowdinAO (SAO) or IAO+PAO fragmentation).
Energies can be evaluated as follows from the 1DM and 2DM:
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 densitymatrix in the AO basis. Default: False.
with_dm1 (bool, optional) – If True, the noncumulant part of the 2DM will be added. See also approx_cumulant. Default: False.
part_cumulant (bool, optional) – If False, the mixed noncumulant contributions, “DM1(MF) * [DM1(corr)DM1(MF)]”, will be projected symmetrically between both factors. This will return a 2DM will evaluates to the DMETenergy 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 2DM will be approximated and contain the noncumulant 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 densitymatrix at the end of the calculation. Default: True.
 Returns:
dm2 – Twoparticle 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 pDMET.
 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:
array
 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 (LowdinAO) 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 meanfield object.
 write_population(pop, filename=None, filemode='a', orbital_resolved=False)
vayesta.ewf.fragment
 vayesta.ewf.fragment.get_fragment_mpi_rank(*args)
 class vayesta.ewf.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, t_as_lambda: bool = None, bsse_correction: bool = None, bsse_rmax: float = None, sc_mode: int = None, nelectron_target: float = None, nelectron_target_atol: float = 1e06, nelectron_target_rtol: float = 1e06, calc_e_wf_corr: bool = None, calc_e_dm_corr: bool = None, store_wf_type: str = None, wf_factor: Union[int, NoneType] = None, c_cas_occ: numpy.ndarray = None, c_cas_vir: numpy.ndarray = None, tcc_fci_opts: dict = <factory>)[source]
Bases:
Options
 t_as_lambda: bool = None
 bsse_correction: bool = None
 bsse_rmax: float = None
 sc_mode: int = None
 nelectron_target: float = None
 nelectron_target_atol: float = 1e06
 nelectron_target_rtol: float = 1e06
 calc_e_wf_corr: bool = None
 calc_e_dm_corr: bool = None
 store_wf_type: str = None
 wf_factor: int  None = None
 c_cas_occ: ndarray = None
 c_cas_vir: ndarray = None
 tcc_fci_opts: dict
 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)
Dictionarylike 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 vayesta.ewf.fragment.Fragment(*args, **kwargs)[source]
Bases:
Fragment
 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, t_as_lambda: bool = None, bsse_correction: bool = None, bsse_rmax: float = None, sc_mode: int = None, nelectron_target: float = None, nelectron_target_atol: float = 1e06, nelectron_target_rtol: float = 1e06, calc_e_wf_corr: bool = None, calc_e_dm_corr: bool = None, store_wf_type: str = None, wf_factor: Union[int, NoneType] = None, c_cas_occ: numpy.ndarray = None, c_cas_vir: numpy.ndarray = None, tcc_fci_opts: dict = <factory>)
Bases:
Options
 asdict(deepcopy=False)
 auxiliary: bool = False
 bath_options: dict = None
 bosonic_bath_options: dict = None
 bsse_correction: bool = None
 bsse_rmax: float = None
 c_cas_occ: ndarray = None
 c_cas_vir: ndarray = None
 calc_e_dm_corr: bool = None
 calc_e_wf_corr: bool = None
 classmethod change_dict_defaults(field, **kwargs)
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = None
 get(attr, default=None)
Dictionarylike 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
 nelectron_target: float = None
 nelectron_target_atol: float = 1e06
 nelectron_target_rtol: float = 1e06
 replace(**kwargs)
 sc_mode: int = None
 screening: str  None = None
 solver_options: dict = None
 store_eris: bool = None
 store_wf_type: str = None
 sym_factor: float = 1.0
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 wf_factor: int  None = None
 tcc_fci_opts: dict
 coupled_fragments: list
 class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: Union[int, NoneType] = None, external_corrections: Union[List[Any], NoneType] = <factory>, test_extcorr: bool = False)[source]
Bases:
Flags
 external_corrections: List[Any]  None
 test_extcorr: bool = False
 bath_parent_fragment_id: int  None = None
 is_envelop: bool = True
 is_secfrag: bool = False
 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, e_corr_dm2cumulant: float = None, n_active: int = None, ip_energy: numpy.ndarray = None, ea_energy: numpy.ndarray = None)[source]
Bases:
Results
 e_corr_dm2cumulant: float = None
 n_active: int = None
 ip_energy: ndarray = None
 ea_energy: ndarray = None
 moms: tuple = None
 property dm1
Cluster 1DM
 property dm2
Cluster 2DM
 converged: bool = None
 e_corr: float = None
 e_corr_rpa: float = None
 fid: int = None
 pwf: WaveFunction = None
 wf: WaveFunction = None
 set_cas(iaos=None, c_occ=None, c_vir=None, minao='auto', dmet_threshold=None)[source]
Set complete active space for tailored CCSD and activespace CC methods.
 add_external_corrections(fragments, correction_type='tailor', projectors=1, test_extcorr=False, low_level_coul=True)[source]
Add tailoring or external correction from other fragment solutions to CCSD solver.
 Parameters:
fragments (list) – List of solved or auxiliary fragments, used for the correction.
correction_type (str, optional) –
 Type of correction:
’tailor’: replace CCSD T1 and T2 amplitudes with FCI amplitudes. ‘deltatailor’: Add the difference of FCI and CCSD T1 and T2 amplitudes ‘external’: externally correct CCSD T1 and T2 amplitudes from FCI T3 and T4 amplitudes.
Default: ‘tailor’.
projectors (int, optional) – Maximum number of projections applied to the occupied dimensions of the amplitude corrections. Default: 1.
test_extcorr (bool, optional) – Whether to perform additional checks on the external corrections.
low_level_coul (bool, optional) – This is an option specific to the ‘external’ correction. If True, then the T3V term is contracted with integrals spanning the ‘lowlevel’ (i.e. CCSD) solver, i.e. the cluster being constrained. If False, then the T3V term is contracted with the integrals in the ‘highlevel’ (i.e. FCI) solver, i.e. the cluster providing the constraints. In general, there should be a slight speed increase, and slight loss of accuracy for the low_level_coul=False option, but in practice, we find only minor differences. Default: True
 clear_external_corrections()[source]
Remove all tailoring or external correction which were added via add_external_corrections.
 get_fragment_energy(c1, c2, hamil=None, fock=None, c2ba_order='ba', axis1='fragment')[source]
Calculate fragment correlation energy contribution from projected C1, C2.
 Parameters:
c1 ((n(occCO), n(virCO)) array) – Fragment projected C1amplitudes.
c2 ((n(occCO), n(occCO), n(virCO), n(virCO)) array) – Fragment projected C2amplitudes.
hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.
fock ((n(AO), n(AO)) array, optional) – Fock matrix in AO representation. If None, self.base.get_fock_for_energy() is used. Default: None.
 Returns:
e_singles (float) – Fragment correlation energy contribution from single excitations.
e_doubles (float) – Fragment correlation energy contribution from double excitations.
e_corr (float) – Total fragment correlation energy contribution.
 make_fragment_dm1(t_as_lambda=False, sym_t2=True)[source]
Currently CCSD only.
Without meanfield contribution!
 make_fragment_dm2cumulant(t_as_lambda=False, sym_t2=True, sym_dm2=True, full_shape=True, approx_cumulant=True)[source]
Currently MP2/CCSD only
 make_fragment_dm2cumulant_energy(hamil=None, t_as_lambda=False, sym_t2=True, approx_cumulant=True)[source]
 add_tsymmetric_fragments(tvecs, symtol=1e06)[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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry 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)[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.
 property cluster
 property contributes
True if fragment contributes to expectation values, else False.
 copy(fid=None, name=None, **kwargs)[source]
Create copy of fragment, without adding it to the fragments list.
 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) – Meanfield 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= 1e4.
 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_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 nuclearnuclear repulsion must be added to get the total energy!
 Parameters:
dm1 (array, optional) – Cluster oneelectron reduced densitymatrix in cluster basis. If None, self.results.dm1 is used. Default: None.
dm2 (array, optional) – Cluster twoelectron reduced densitymatrix 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 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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()[source]
Calculate the part of the meanfield energy associated with the fragment.
Does not include nuclearnuclear 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_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 1p instead. Default: False.
 Returns:
p – Projection matrix.
 Return type:
(n, n) array
 get_fragments_with_overlap(tol=1e08, **kwargs)[source]
Get list of fragments which overlap both in occupied and virtual space.
 get_mo_occupation(*mo_coeff, dm1=None)[source]
Get meanfield occupation numbers (diagonal of 1RDM) 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)[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(‘clustermo’) >>> s = self.get_overlap(‘clusterfrag’) >>> s = self.get_overlap(‘mo[occ]cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]cluster[vir]’)
 get_symmetry_tree(maxgen=None, **filters)[source]
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)[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.
 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_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 ghostatoms 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 meanfield electrons.
 plot3d(filename, gridsize=(100, 100, 100), **kwargs)[source]
Write cube density data of fragment orbitals to file.
 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.
 property results
 property symmetry_factor
Includes children of children, etc.
vayesta.ewf.helper
 vayesta.ewf.helper.orthogonalize_mo(c, s, tol=1e06)[source]
Orthogonalize MOs, such that C^T S C = I (identity matrix).
 Parameters:
c (ndarray) – MO orbital coefficients.
s (ndarray) – AO overlap matrix.
tol (float, optional) – Tolerance.
 Returns:
c_out – Orthogonalized MO coefficients.
 Return type:
ndarray
vayesta.ewf.uewf
 class vayesta.ewf.uewf.UEWF(mf, solver='CCSD', log=None, **kwargs)[source]
Bases:
EWF
,UEmbedding
 class Fragment(*args, **kwargs)

 class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: Union[int, NoneType] = None, external_corrections: Union[List[Any], NoneType] = <factory>, test_extcorr: bool = False)
Bases:
Flags
 bath_parent_fragment_id: int  None = None
 is_envelop: bool = True
 is_secfrag: bool = False
 test_extcorr: bool = False
 external_corrections: List[Any]  None
 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, t_as_lambda: bool = None, bsse_correction: bool = None, bsse_rmax: float = None, sc_mode: int = None, nelectron_target: float = None, nelectron_target_atol: float = 1e06, nelectron_target_rtol: float = 1e06, calc_e_wf_corr: bool = None, calc_e_dm_corr: bool = None, store_wf_type: str = None, wf_factor: Union[int, NoneType] = None, c_cas_occ: numpy.ndarray = None, c_cas_vir: numpy.ndarray = None, tcc_fci_opts: dict = <factory>)
Bases:
Options
 asdict(deepcopy=False)
 auxiliary: bool = False
 bath_options: dict = None
 bosonic_bath_options: dict = None
 bsse_correction: bool = None
 bsse_rmax: float = None
 c_cas_occ: ndarray = None
 c_cas_vir: ndarray = None
 calc_e_dm_corr: bool = None
 calc_e_wf_corr: bool = None
 classmethod change_dict_defaults(field, **kwargs)
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = None
 get(attr, default=None)
Dictionarylike 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
 nelectron_target: float = None
 nelectron_target_atol: float = 1e06
 nelectron_target_rtol: float = 1e06
 replace(**kwargs)
 sc_mode: int = None
 screening: str  None = None
 solver_options: dict = None
 store_eris: bool = None
 store_wf_type: str = None
 sym_factor: float = 1.0
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 wf_factor: int  None = None
 tcc_fci_opts: dict
 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, e_corr_dm2cumulant: float = None, n_active: int = None, ip_energy: numpy.ndarray = None, ea_energy: numpy.ndarray = None)
Bases:
Results
 converged: bool = None
 property dm1
Cluster 1DM
 property dm2
Cluster 2DM
 e_corr: float = None
 e_corr_dm2cumulant: float = None
 e_corr_rpa: float = None
 ea_energy: ndarray = None
 fid: int = None
 ip_energy: ndarray = None
 moms: tuple = None
 n_active: int = None
 pwf: WaveFunction = None
 wf: WaveFunction = None
 add_external_corrections(fragments, correction_type='tailor', projectors=1, test_extcorr=False, low_level_coul=True)
Add tailoring or external correction from other fragment solutions to CCSD solver.
 Parameters:
fragments (list) – List of solved or auxiliary fragments, used for the correction.
correction_type (str, optional) –
 Type of correction:
’tailor’: replace CCSD T1 and T2 amplitudes with FCI amplitudes. ‘deltatailor’: Add the difference of FCI and CCSD T1 and T2 amplitudes ‘external’: externally correct CCSD T1 and T2 amplitudes from FCI T3 and T4 amplitudes.
Default: ‘tailor’.
projectors (int, optional) – Maximum number of projections applied to the occupied dimensions of the amplitude corrections. Default: 1.
test_extcorr (bool, optional) – Whether to perform additional checks on the external corrections.
low_level_coul (bool, optional) – This is an option specific to the ‘external’ correction. If True, then the T3V term is contracted with integrals spanning the ‘lowlevel’ (i.e. CCSD) solver, i.e. the cluster being constrained. If False, then the T3V term is contracted with the integrals in the ‘highlevel’ (i.e. FCI) solver, i.e. the cluster providing the constraints. In general, there should be a slight speed increase, and slight loss of accuracy for the low_level_coul=False option, but in practice, we find only minor differences. Default: True
 add_tsymmetric_fragments(tvecs, symtol=1e06)
 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry 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, **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_solver(solver)
 clear_external_corrections()
Remove all tailoring or external correction which were added via add_external_corrections.
 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.
 counterpoise_calculation(rmax, dm0=None, nimages=5, unit='A')
 couple_to_fragment(frag)
 couple_to_fragments(frags)
 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= 1e4.
 Returns:
c_cluster_occ (ndarray) – Occupied cluster orbitals.
c_cluster_vir (ndarray) – Virtual cluster orbitals.
 get_coeff_env()
 get_frag_hamil()
 get_fragment_bsse(rmax=None, nimages=5, unit='A')
 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 nuclearnuclear repulsion must be added to get the total energy!
 Parameters:
dm1 (array, optional) – Cluster oneelectron reduced densitymatrix in cluster basis. If None, self.results.dm1 is used. Default: None.
dm2 (array, optional) – Cluster twoelectron reduced densitymatrix 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 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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_energy(c1, c2, hamil=None, fock=None, axis1='fragment', c2ba_order='ba')
Calculate fragment correlation energy contribution from projected C1, C2.
 Parameters:
c1 ((n(occCO), n(virCO)) array) – Fragment projected C1amplitudes.
c2 ((n(occCO), n(occCO), n(virCO), n(virCO)) array) – Fragment projected C2amplitudes.
hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.
fock ((n(AO), n(AO)) array, optional) – Fock matrix in AO representation. If None, self.base.get_fock_for_energy() is used. Default: None.
 Returns:
e_singles (float) – Fragment correlation energy contribution from single excitations.
e_doubles (float) – Fragment correlation energy contribution from double excitations.
e_corr (float) – Total fragment correlation energy contribution.
 get_fragment_mf_energy()
Calculate the part of the meanfield energy associated with the fragment.
Does not include nuclearnuclear 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 1p instead. Default: False.
 Returns:
p – Projection matrix.
 Return type:
(n, n) array
 get_fragments_with_overlap(tol=1e08, **kwargs)
Get list of fragments which overlap both in occupied and virtual space.
 get_init_guess(init_guess, solver, cluster)
 get_local_rpa_correction(hamil=None)
 get_mo_occupation(*mo_coeff, dm1=None, **kwargs)
Get meanfield occupation numbers (diagonal of 1RDM) of orbitals.
 Parameters:
mo_coeff (ndarray, shape(N, M)) – Orbital coefficients.
 Returns:
occ – 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(‘clustermo’) >>> s = self.get_overlap(‘clusterfrag’) >>> s = self.get_overlap(‘mo[occ]cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]cluster[vir]’)
 get_solver(solver=None)
 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]), …]
 property hamil
 property id_name
Use this whenever a unique name is needed (for example to open a separate file for each fragment).
 kernel(solver=None, init_guess=None)
 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 ghostatoms 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_fragment_dm1(t_as_lambda=False, sym_t2=True)
Currently CCSD only.
Without meanfield contribution!
 make_fragment_dm2cumulant(t_as_lambda=None, sym_t2=True, approx_cumulant=True, full_shape=True)
Currently MP2/CCSD only
 make_fragment_dm2cumulant_energy(hamil=None, t_as_lambda=None, sym_t2=True, approx_cumulant=True)
 property mf
 property mol
 property n_frag
Number of fragment orbitals.
 property n_symmetry_children
Includes children of children, etc.
 property nelectron
Number of meanfield 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
 set_cas(iaos=None, c_occ=None, c_vir=None, minao='auto', dmet_threshold=None)
Set complete active space for tailored CCSD and activespace CC methods.
 property symmetry_factor
Includes children of children, etc.
 trimmed_name(length=10, add_dots=True)
Fragment name trimmed to a given maximum length.
 get_global_t1(get_lambda=False, mpi_target=None, ao_basis=False)
Get global CCSD T1 from fragment calculations.
 Parameters:
get_lambda (bool, optional) – If True, return L1 amplitudes. Default: False.
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:
t1 – Global T1 amplitudes.
 Return type:
tuple(2) of (n(occ), n(vir)) array
 get_global_t2(get_lambda=False, symmetrize=True, mpi_target=None, ao_basis=False)
Get global CCSD T2 amplitudes from fragment calculations.
 Parameters:
get_lambda (bool, optional) – If True, return L1 amplitudes. Default: False.
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:
t2 – Global T2 amplitudes.
 Return type:
tuple(3) of (n(occ), n(occ), n(vir), n(vir)) array
 class Options(store_eris: bool = True, global_frag_chempot: float  None = None, dm_with_frozen: bool = False, bath_options: dict = <factory>, bosonic_bath_options: dict = <factory>, solver_options: dict = <factory>, symmetry_tol: float = 1e06, symmetry_mf_tol: float = 1e05, screening: str  None = None, ext_rpa_correction: str  None = None, match_cluster_fock: bool = False, iao_minao: str = 'auto', project_eris: bool = False, project_init_guess: bool = True, energy_functional: str = 'wf', calc_e_wf_corr: bool = True, calc_e_dm_corr: bool = False, t_as_lambda: bool  None = None, store_wf_type: str  None = None, bsse_correction: bool = True, bsse_rmax: float = 5.0, nelectron_target: int  None = None, sc_mode: int = 0, coupled_iterations: bool = False, _debug_wf: str  None = None)
Bases:
Options
Options for EWF calculations.
 asdict(deepcopy=False)
 bsse_correction: bool = True
 bsse_rmax: float = 5.0
 calc_e_dm_corr: bool = False
 calc_e_wf_corr: bool = True
 classmethod change_dict_defaults(field, **kwargs)
 coupled_iterations: bool = False
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = False
 energy_functional: str = 'wf'
 ext_rpa_correction: str  None = None
 get(attr, default=None)
Dictionarylike 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()
 match_cluster_fock: bool = False
 nelectron_target: int = None
 project_eris: bool = False
 project_init_guess: bool = True
 replace(**kwargs)
 sc_mode: int = 0
 screening: str  None = None
 store_eris: bool = True
 store_wf_type: str = None
 symmetry_mf_tol: float = 1e05
 symmetry_tol: float = 1e06
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 bath_options: dict
 bosonic_bath_options: dict
 solver_options: dict
 brueckner_scmf(*args, **kwargs)
Decorator for BruecknerDMET.
 build_bosonic_bath()
 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.) – Choleskydecomposed ERIs in the particlehole 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 spindependent screened (ovov), 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.
 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_fragment_symmetry(dm1, charge_tol=1e06, spin_tol=1e06)
Check that the meanfield obeys the symmetry between fragments.
 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of inversionsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of mirrorsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of rotationallysymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: self.opts.symmetry_mf_tol.
 Returns:
fragments – List of Tsymmetry 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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry related fragments. These will have the attributes sym_parent and sym_op set.
 Return type:
list
 property df
 property e_mf
Total meanfield 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
Nuclearrepulsion energy per unit cell (not folded supercell).
 property e_tot
Total energy.
 fragmentation(*args, **kwargs)
 get_atomic_charges(pop)
 get_average_cluster_size(average='mean')
 get_ccsd_corr_energy(full_wf=False)
Get projected correlation energy from partitioned CCSD WF.
This is the projected (T1, T2) energy expression, instead of the projected (C1, C2) expression used in PRX (the differences are very small).
For testing only, UHF and MPI not implemented
 get_ccsd_energy(full_wf=False)
 get_cderi(mo_coeff, compact=False, blksize=None)
 get_cderi_exspace(ex_coeff, compact=False, blksize=None)
 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 spinspin 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', orbital_filter=None)
dm1 in MO basis
 get_dm_corr_energy(dm1='globalwf', dm2='projectedlambda', t_as_lambda=None, with_exxdiv=None)
 get_dm_corr_energy_e1(dm1='globalwf', t_as_lambda=None, with_exxdiv=None)
 get_dm_corr_energy_e2(dm2='projectedlambda', t_as_lambda=None)
Correlation energy due to cumulant
 get_dm_energy(*args, **kwargs)
 get_dmet_elec_energy(part_cumulant=True, approx_cumulant=True)
Calculate electronic DMET energy via democratically partitioned densitymatrices.
 Parameters:
part_cumulant (bool, optional) – If True, the 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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 densitymatrices.
 Parameters:
part_cumulant (bool, optional) – If True, the 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)squared terms, is partitioned, instead of the true cumulant, if part_cumulant=True. Default: True.
with_nuc (bool, optional) – Include nuclearrepulsion energy. Default: True.
with_exxdiv (bool, optional) – Include divergent exactexchange correction. Default: True.
 Returns:
e_dmet – DMET energy.
 Return type:
float
 get_e_corr(functional=None, **kwargs)
 get_eris_array(mo_coeff, compact=False)
Get electronrepulsion integrals in MO basis as a NumPy array.
 Parameters:
mo_coeff ([list(4) of] (n(AO), n(MO)) array) – MO coefficients.
 Returns:
eris – Electronrepulsion 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 electronrepulsion integrals in MO basis as a NumPy array.
 Parameters:
mo_coeff (tuple(2) of (n(AO), n(MO)) array) – MO coefficients.
 Returns:
Electronrepulsion integrals in MO basis.
 Return type:
eris
 get_eris_object(postscf, fock=None)
Get ERIs for postSCF methods.
For folded PBC calculations, this folds the MO back into kspace and contracts with the kspace threecenter integrals..
 Parameters:
postscf (one of the following postSCF methods: MP2, CCSD, RCCSD, DFCCSD) – PostSCF method with attribute mo_coeff set.
 Returns:
eris – ERIs which can be used for the respective postSCF method.
 Return type:
_ChemistsERIs
 get_exxdiv()
Get divergent exactexchange (exxdiv) energy correction and potential.
 Returns:
e_exxdiv (float) – Divergent exactexchange energy correction per unit cell.
v_exxdiv (array) – Divergent exactexchange potential correction in AO basis.
 get_fbc_energy(occupied=True, virtual=True)
Get finitebath correction (FBC) energy.
This correction consists of two independent contributions, one due to the finite occupied, and one due to the finite virtual space.
The virtual correction for a given fragment x is calculated as “E(MP2)[occ=D,vir=F]  E(MP2)[occ=D,vir=C]”, where D is the DMET cluster space, F is the full space, and C is the full cluster space. For the occupied correction, occ and vir spaces are swapped. Fragments which do not have a BNO bath are skipped.
 Parameters:
occupied (bool, optional) – If True, the FBC energy from the occupied space is included. Default: True.
virtual (bool, optional) – If True, the FBC energy from the virtual space is included. Default: True.
 Returns:
e_fbc – Finite bath correction (FBC) energy.
 Return type:
float
 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_global_l1(*args, t_as_lambda=None, **kwargs)
 get_global_l2(*args, t_as_lambda=None, **kwargs)
 get_hcore()
Core Hamiltonian (kinetic energy plus nuclearelectron 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()
AOoverlap matrix.
 get_ovlp_power(power)
get power of AO overlap matrix.
For folded calculations, this uses the kpoint 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)
HartreeFock Coulomb and exchange potential in AO basis.
 get_veff_for_energy(dm1=None, with_exxdiv=True)
HartreeFock potential used for energy evaluation.
 get_wf_corr_energy()
 get_wf_energy(*args, **kwargs)
 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 exactexchange 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 = False
 is_uhf = True
 kernel()
Run EWF.
 loop()
Loop over fragments.
 make_rdm1(*args, **kwargs)
 make_rdm1_demo(*args, **kwargs)
Make democratically partitioned oneparticle reduced densitymatrix from fragment calculations.
Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg, LowdinAO or IAO+PAO fragmentation).
 Parameters:
ao_basis (bool, optional) – Return the densitymatrix in the AO basis. Default: False.
with_mf (bool, optional) – Add the meanfield contribution to the densitymatrix (double counting is accounted for). Is only used if partition = ‘dm’. Default: False.
symmetrize (bool, optional) – Symmetrize the densitymatrix at the end of the calculation. Default: True.
 Returns:
dm1 – Alpha and beta oneparticle 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_rdm2_demo(*args, **kwargs)
Make democratically partitioned twoparticle reduced densitymatrix from fragment calculations.
Warning: A democratically partitioned DM is only expected to yield reasonable results for full fragmentations (eg. LowdinAO (SAO) or IAO+PAO fragmentation).
Energies can be evaluated as follows from the 1DM and 2DM:
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 densitymatrix in the AO basis. Default: False.
with_dm1 (bool, optional) – If True, the noncumulant part of the 2DM will be added. See also approx_cumulant. Default: False.
part_cumulant (bool, optional) – If False, the mixed noncumulant contributions, “DM1(MF) * [DM1(corr)DM1(MF)]”, will be projected symmetrically between both factors. This will return a 2DM will evaluates to the DMETenergy 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 2DM will be approximated and contain the noncumulant 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 densitymatrix at the end of the calculation. Default: True.
 Returns:
dm2 – Twoparticle 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 pDMET.
 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:
array
 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 (LowdinAO) 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 = 'unrestricted'
 tailor_all_fragments()
 update_mf(mo_coeff, mo_energy=None, veff=None)
Update underlying meanfield object.
 write_population(pop, filename=None, filemode='a', orbital_resolved=False)
vayesta.ewf.ufragment
 class vayesta.ewf.ufragment.Fragment(*args, **kwargs)[source]

 set_cas(iaos=None, c_occ=None, c_vir=None, minao='auto', dmet_threshold=None)[source]
Set complete active space for tailored CCSD and activespace CC methods.
 get_fragment_energy(c1, c2, hamil=None, fock=None, axis1='fragment', c2ba_order='ba')[source]
Calculate fragment correlation energy contribution from projected C1, C2.
 Parameters:
c1 ((n(occCO), n(virCO)) array) – Fragment projected C1amplitudes.
c2 ((n(occCO), n(occCO), n(virCO), n(virCO)) array) – Fragment projected C2amplitudes.
hamil (ClusterHamiltonian object.) – Object representing cluster hamiltonian, possibly including cached ERIs.
fock ((n(AO), n(AO)) array, optional) – Fock matrix in AO representation. If None, self.base.get_fock_for_energy() is used. Default: None.
 Returns:
e_singles (float) – Fragment correlation energy contribution from single excitations.
e_doubles (float) – Fragment correlation energy contribution from double excitations.
e_corr (float) – Total fragment correlation energy contribution.
 make_fragment_dm2cumulant(t_as_lambda=None, sym_t2=True, approx_cumulant=True, full_shape=True)[source]
Currently MP2/CCSD only
 make_fragment_dm2cumulant_energy(hamil=None, t_as_lambda=None, sym_t2=True, approx_cumulant=True)[source]
 class Flags(is_envelop: bool = True, is_secfrag: bool = False, bath_parent_fragment_id: Union[int, NoneType] = None, external_corrections: Union[List[Any], NoneType] = <factory>, test_extcorr: bool = False)[source]
Bases:
Flags
 external_corrections: List[Any]  None
 test_extcorr: bool = False
 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, t_as_lambda: bool = None, bsse_correction: bool = None, bsse_rmax: float = None, sc_mode: int = None, nelectron_target: float = None, nelectron_target_atol: float = 1e06, nelectron_target_rtol: float = 1e06, calc_e_wf_corr: bool = None, calc_e_dm_corr: bool = None, store_wf_type: str = None, wf_factor: Union[int, NoneType] = None, c_cas_occ: numpy.ndarray = None, c_cas_vir: numpy.ndarray = None, tcc_fci_opts: dict = <factory>)
Bases:
Options
 asdict(deepcopy=False)
 auxiliary: bool = False
 bath_options: dict = None
 bosonic_bath_options: dict = None
 bsse_correction: bool = None
 bsse_rmax: float = None
 c_cas_occ: ndarray = None
 c_cas_vir: ndarray = None
 calc_e_dm_corr: bool = None
 calc_e_wf_corr: bool = None
 classmethod change_dict_defaults(field, **kwargs)
 static dict_with_defaults(**kwargs)
 dm_with_frozen: bool = None
 get(attr, default=None)
Dictionarylike 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
 nelectron_target: float = None
 nelectron_target_atol: float = 1e06
 nelectron_target_rtol: float = 1e06
 replace(**kwargs)
 sc_mode: int = None
 screening: str  None = None
 solver_options: dict = None
 store_eris: bool = None
 store_wf_type: str = None
 sym_factor: float = 1.0
 t_as_lambda: bool = None
 update(**kwargs)
 values()
 wf_factor: int  None = None
 tcc_fci_opts: dict
 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, e_corr_dm2cumulant: float = None, n_active: int = None, ip_energy: numpy.ndarray = None, ea_energy: numpy.ndarray = None)[source]
Bases:
Results
 e_corr_dm2cumulant: float = None
 n_active: int = None
 ip_energy: ndarray = None
 ea_energy: ndarray = None
 moms: tuple = None
 property dm1
Cluster 1DM
 property dm2
Cluster 2DM
 converged: bool = None
 e_corr: float = None
 e_corr_rpa: float = None
 fid: int = None
 pwf: WaveFunction = None
 wf: WaveFunction = None
 add_external_corrections(fragments, correction_type='tailor', projectors=1, test_extcorr=False, low_level_coul=True)[source]
Add tailoring or external correction from other fragment solutions to CCSD solver.
 Parameters:
fragments (list) – List of solved or auxiliary fragments, used for the correction.
correction_type (str, optional) –
 Type of correction:
’tailor’: replace CCSD T1 and T2 amplitudes with FCI amplitudes. ‘deltatailor’: Add the difference of FCI and CCSD T1 and T2 amplitudes ‘external’: externally correct CCSD T1 and T2 amplitudes from FCI T3 and T4 amplitudes.
Default: ‘tailor’.
projectors (int, optional) – Maximum number of projections applied to the occupied dimensions of the amplitude corrections. Default: 1.
test_extcorr (bool, optional) – Whether to perform additional checks on the external corrections.
low_level_coul (bool, optional) – This is an option specific to the ‘external’ correction. If True, then the T3V term is contracted with integrals spanning the ‘lowlevel’ (i.e. CCSD) solver, i.e. the cluster being constrained. If False, then the T3V term is contracted with the integrals in the ‘highlevel’ (i.e. FCI) solver, i.e. the cluster providing the constraints. In general, there should be a slight speed increase, and slight loss of accuracy for the low_level_coul=False option, but in practice, we find only minor differences. Default: True
 add_tsymmetric_fragments(tvecs, symtol=1e06)[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 meanfield density matrix between symmetry related fragments. If the largest absolute difference in the densitymatrix is above this value, and exception will be raised. Default: 1e6.
 Returns:
fragments – List of Tsymmetry 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, **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.
 clear_external_corrections()[source]
Remove all tailoring or external correction which were added via add_external_corrections.
 property cluster
 property contributes
True if fragment contributes to expectation values, else False.
 copy(fid=None, name=None, **kwargs)[source]
Create copy of fragment, without adding it to the fragments list.
 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= 1e4.
 Returns:
c_cluster_occ (ndarray) – Occupied cluster orbitals.
c_cluster_vir (ndarray) – Virtual cluster orbitals.
 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 nuclearnuclear repulsion must be added to get the total energy!
 Parameters:
dm1 (array, optional) – Cluster oneelectron reduced densitymatrix in cluster basis. If None, self.results.dm1 is used. Default: None.
dm2 (array, optional) – Cluster twoelectron reduced densitymatrix 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 2DM cumulant will be partitioned to calculate the energy. If False, the full 2DM 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 1DM)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 meanfield energy associated with the fragment.
Does not include nuclearnuclear 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 1p instead. Default: False.
 Returns:
p – Projection matrix.
 Return type:
(n, n) array
 get_fragments_with_overlap(tol=1e08, **kwargs)[source]
Get list of fragments which overlap both in occupied and virtual space.
 get_mo_occupation(*mo_coeff, dm1=None, **kwargs)
Get meanfield occupation numbers (diagonal of 1RDM) of orbitals.
 Parameters:
mo_coeff (ndarray, shape(N, M)) – Orbital coefficients.
 Returns:
occ – Occupation numbers of orbitals.
 Return type:
ndarray, shape(M)
 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(‘clustermo’) >>> s = self.get_overlap(‘clusterfrag’) >>> s = self.get_overlap(‘mo[occ]cluster[occ]’) >>> s = self.get_overlap(‘mo[vir]cluster[vir]’)
 get_symmetry_error(frag, dm1=None)
Get translational symmetry error between two fragments.
 get_symmetry_tree(maxgen=None, **filters)[source]
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)[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.
 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_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 ghostatoms 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_fragment_dm1(t_as_lambda=False, sym_t2=True)[source]
Currently CCSD only.
Without meanfield contribution!
 property mf
 property mol
 property n_frag
Number of fragment orbitals.
 property n_symmetry_children
Includes children of children, etc.
 property nelectron
Number of meanfield electrons.
 plot3d(filename, gridsize=(100, 100, 100), **kwargs)[source]
Write cube density data of fragment orbitals to file.
 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.
 property results
 property symmetry_factor
Includes children of children, etc.
Module contents
Embedded wave function (EWF) method Author: Max Nusspickel email: max.nusspickel@gmail.com