vayesta.solver
Subpackages
- vayesta.solver.eb_fci
- Submodules
- vayesta.solver.eb_fci.ebfci
- vayesta.solver.eb_fci.ebfci_slow
contract_all()
make_shape()
contract_1e()
contract_2e()
contract_ep()
contract_pp()
apply_bos_annihilation()
apply_bos_creation()
contract_pp_for_future()
slices_for()
slices_for_cre()
slices_for_des()
slices_for_occ_reduction()
make_hdiag()
kernel()
kernel_multiroot()
make_rdm1()
make_rdm12()
make_rdm12s()
make_eb_rdm()
calc_dd_resp_mom()
run()
run_hub_test()
run_ep_hubbard()
- vayesta.solver.eb_fci.uebfci_slow
contract_all()
make_shape()
contract_1e()
contract_2e()
contract_ep()
contract_pp()
apply_bos_annihilation()
apply_bos_creation()
contract_pp_for_future()
slices_for()
slices_for_cre()
slices_for_des()
slices_for_occ_reduction()
make_hdiag()
kernel()
kernel_multiroot()
make_rdm1()
make_rdm12()
make_rdm12s()
make_eb_rdm()
calc_dd_resp_mom()
run()
run_hub_test()
run_ep_hubbard()
- Module contents
Submodules
vayesta.solver.callback
- class vayesta.solver.callback.CallbackSolver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(callback: int = None)[source]
Bases:
Options
- callback: int = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel(*args, **kwargs)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.ccsd
- class vayesta.solver.ccsd.RCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None)[source]
Bases:
Options
- max_cycle: int = 100
- conv_tol: float = None
- conv_tol_normt: float = None
- diis_space: int = None
- diis_start_cycle: int = None
- iterative_damping: float = None
- level_shift: float = None
- init_guess: str = 'MP2'
- solve_lambda: bool = True
- n_moments: tuple = None
- sc_mode: int = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.ccsd.UCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
UClusterSolver
,RCCSD_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None)[source]
Bases:
Options
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- diis_space: int = None
- diis_start_cycle: int = None
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'MP2'
- items()
- iterative_damping: float = None
- keys()
- level_shift: float = None
- max_cycle: int = 100
- n_moments: tuple = None
- replace(**kwargs)
- sc_mode: int = None
- solve_lambda: bool = True
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- generate_init_guess(eris=None)
- get_callback()
- get_init_guess()
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- print_extra_info(mycc)
- property v_ext
- class vayesta.solver.ccsd.UCCSD(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]
Bases:
UCCSD
- ao2mo(mo_coeff=None)
- EOMEA(*args, **kwargs)
- EOMEE(*args, **kwargs)
- EOMEESpinFlip(*args, **kwargs)
- EOMEESpinKeep(*args, **kwargs)
- EOMIP(*args, **kwargs)
- apply(fn, *args, **kwargs)
Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- as_scanner()
Generating a scanner/solver for CCSD PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CCSD energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters assigned in the CCSD and the underlying SCF objects (conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, cc >>> mol = gto.M(atom='H 0 0 0; F 0 0 1') >>> cc_scanner = cc.CCSD(scf.RHF(mol)).as_scanner() >>> e_tot = cc_scanner(gto.M(atom='H 0 0 0; F 0 0 1.1')) >>> e_tot = cc_scanner(gto.M(atom='H 0 0 0; F 0 0 1.5'))
- async_io = True
- callback = None
- cc2 = False
- ccsd(t1=None, t2=None, eris=None, mbpt2=False)[source]
Ground-state unrestricted (U)CCSD.
- Kwargs:
- mbpt2bool
Use one-shot MBPT2 approximation to CCSD.
- check_sanity()
Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- conv_tol = 1e-07
- conv_tol_normt = 1e-06
- copy()
Returns a shallow copy
- density_fit(auxbasis=None, with_df=None)
- diis = True
- diis_file = None
- diis_space = 6
- diis_start_cycle = 0
- diis_start_energy_diff = 1000000000.0
- direct = False
- dump_chk(t1_t2=None, frozen=None, mo_coeff=None, mo_occ=None)
- dump_flags(verbose=None)
- property e_tot
- property ecc
- energy(t1=None, t2=None, eris=None)
UCCSD correlation energy
- eomee_ccsd_singlet(nroots=1, koopmans=False, guess=None, eris=None)
- eomee_ccsd_triplet(nroots=1, koopmans=False, guess=None, eris=None)
- get_e_hf(mo_coeff=None)
- get_frozen_mask()
Get boolean mask for the unrestricted reference orbitals.
In the returned boolean (mask) array of frozen orbital indices, the element is False if it corresponds to the frozen orbital.
- get_init_guess(eris=None)
- get_nmo()
- get_nocc()
- incore_complete = False
- iterative_damping = 1.0
- kernel(t1=None, t2=None, eris=None, mbpt2=False)[source]
Kernel function is the main driver of a method. Every method should define the kernel function as the entry of the calculation. Note the return value of kernel function is not strictly defined. It can be anything related to the method (such as the energy, the wave-function, the DFT mesh grids etc.).
- make_rdm1(t1=None, t2=None, l1=None, l2=None, ao_repr=False, with_frozen=True, with_mf=True)[source]
Un-relaxed 1-particle density matrix in MO space
- Returns:
dm1a, dm1b
- make_rdm2(t1=None, t2=None, l1=None, l2=None, ao_repr=False, with_frozen=True, with_dm1=True)[source]
2-particle density matrix in spin-orbital basis.
- max_cycle = 50
- property nmo
- property nocc
- post_kernel(envs)
A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.
- pre_kernel(envs)
A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.
- reset(mol=None)
- restore_from_diis_(diis_file, inplace=True)
Reuse an existed DIIS object in the CCSD calculation.
The CCSD amplitudes will be restored from the DIIS object to generate t1 and t2 amplitudes. The t1/t2 amplitudes of the CCSD object will be overwritten by the generated t1 and t2 amplitudes. The amplitudes vector and error vector will be reused in the CCSD calculation.
- run(*args, **kwargs)
Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.
- run_diis(t1, t2, istep, normt, de, adiis)
- set(*args, **kwargs)
Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- set_frozen(method='auto', window=(-1000.0, 1000.0))
- stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
- to_gpu(out=None)
Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.
- uccsd_t(t1=None, t2=None, eris=None)
- update_amps(t1, t2, eris)
- verbose = 0
- view(cls)
New view of object with the same attributes.
vayesta.solver.ccsdtq
vayesta.solver.cisd
- class vayesta.solver.cisd.RCISD_Solver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(conv_tol: float = None)[source]
Bases:
Options
- conv_tol: float = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel(*args, **kwargs)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.cisd.UCISD_Solver(hamil, log=None, **kwargs)[source]
Bases:
UClusterSolver
,RCISD_Solver
- class Options(conv_tol: float = None)[source]
Bases:
Options
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- kernel(*args, **kwargs)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.cisd.UCISD(mf, frozen=None, mo_coeff=None, mo_occ=None)[source]
Bases:
UCISD
- ao2mo(mo_coeff=None)
- apply(fn, *args, **kwargs)
Apply the fn to rest arguments: return fn(*args, **kwargs). The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- as_scanner()
Generating a scanner/solver for CISD PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CISD energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters assigned in the CISD and the underlying SCF objects (conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, ci >>> mol = gto.M(atom='H 0 0 0; F 0 0 1') >>> ci_scanner = ci.CISD(scf.RHF(mol)).as_scanner() >>> e_tot = ci_scanner(gto.M(atom='H 0 0 0; F 0 0 1.1')) >>> e_tot = ci_scanner(gto.M(atom='H 0 0 0; F 0 0 1.5'))
- async_io = True
- check_sanity()
Check input of class/object attributes, check whether a class method is overwritten. It does not check the attributes which are prefixed with “_”. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- cisd(ci0=None, eris=None)
- contract(civec, eris)
Application of CISD hamiltonian onto civec.
- Parameters:
myci – CISD (inheriting) object
civec – numpy array, same length as a CI vector.
eris – ccsd._ChemistsERIs (inheriting) object (poss diff for df) Contains the various (pq|rs) integrals needed.
- Returns:
numpy array, same length as a CI vector.
- conv_tol = 1e-09
- copy()
Returns a shallow copy
- density_fit()
- direct = False
- dump_chk(ci=None, frozen=None, mo_coeff=None, mo_occ=None)
- dump_flags(verbose=None)
- property e_tot
- get_e_hf(mo_coeff=None)
- get_frozen_mask()
Get boolean mask for the unrestricted reference orbitals.
In the returned boolean (mask) array of frozen orbital indices, the element is False if it corresponds to the frozen orbital.
- get_init_guess(eris=None, nroots=1, diag=None)[source]
MP2 energy and MP2 initial guess(es) for CISD coefficients.
- Kwargs:
- erisccsd._ChemistsERIs (inheriting) object (poss diff for df)
Contains the various (pq|rs) integrals needed.
- nrootsinteger
Number of CISD solutions to be found.
- diagnumpy array (1D)
e.g. CISD Hamiltonian diagonal in Slater determinant space with HF energy subtracted.
- Returns:
Tuple of float and numpy array or tuple of float and list of numpy arrays (if nroots > 1) MP2 energy and initial guess(es) for CISD coefficients.
- get_nmo()
- get_nocc()
- kernel(ci0=None, eris=None)
Kernel function is the main driver of a method. Every method should define the kernel function as the entry of the calculation. Note the return value of kernel function is not strictly defined. It can be anything related to the method (such as the energy, the wave-function, the DFT mesh grids etc.).
- level_shift = 0.001
- lindep = 1e-14
- make_diagonal(eris)
Return diagonal of CISD hamiltonian in Slater determinant basis.
Note that a constant has been substracted of all elements. The first element is the HF energy (minus the constant), the next elements are the diagonal elements with singly excited determinants (<D_i^a|H|D_i^a> within the constant), then doubly excited determinants (<D_ij^ab|H|D_ij^ab> within the constant).
- Parameters:
myci – CISD (inheriting) object
eris – ccsd._ChemistsERIs (inheriting) object (poss diff for df) Contains the various (pq|rs) integrals needed.
- Returns:
- (1, 1 + #single excitations from HF det
#double excitations from HF det))
Diagonal elements of hamiltonian matrix within a constant, see above.
- Return type:
numpy array (size
- make_rdm1(civec=None, nmo=None, nocc=None, ao_repr=False)
One-particle spin density matrices dm1a, dm1b in MO basis (the occupied-virtual blocks due to the orbital response contribution are not included).
dm1a[p,q] = <q_alpha^dagger p_alpha> dm1b[p,q] = <q_beta^dagger p_beta>
The convention of 1-pdm is based on McWeeney’s book, Eq (5.4.20).
- make_rdm2(civec=None, nmo=None, nocc=None, ao_repr=False)
Two-particle spin density matrices dm2aa, dm2ab, dm2bb in MO basis
dm2aa[p,q,r,s] = <q_alpha^dagger s_alpha^dagger r_alpha p_alpha> dm2ab[p,q,r,s] = <q_alpha^dagger s_beta^dagger r_beta p_alpha> dm2bb[p,q,r,s] = <q_beta^dagger s_beta^dagger r_beta p_beta>
(p,q correspond to one particle and r,s correspond to another particle) Two-particle density matrix should be contracted to integrals with the pattern below to compute energy
E = numpy.einsum(‘pqrs,pqrs’, eri_aa, dm2_aa) E+= numpy.einsum(‘pqrs,pqrs’, eri_ab, dm2_ab) E+= numpy.einsum(‘pqrs,rspq’, eri_ba, dm2_ab) E+= numpy.einsum(‘pqrs,pqrs’, eri_bb, dm2_bb)
where eri_aa[p,q,r,s] = (p_alpha q_alpha | r_alpha s_alpha ) eri_ab[p,q,r,s] = ( p_alpha q_alpha | r_beta s_beta ) eri_ba[p,q,r,s] = ( p_beta q_beta | r_alpha s_alpha ) eri_bb[p,q,r,s] = ( p_beta q_beta | r_beta s_beta )
- max_cycle = 50
- max_space = 12
- property nmo
- property nocc
- property nstates
- post_kernel(envs)
A hook to be run after the main body of the kernel function. Internal variables are exposed to post_kernel through the “envs” dictionary. Return value of post_kernel function is not required.
- pre_kernel(envs)
A hook to be run before the main body of kernel function is executed. Internal variables are exposed to pre_kernel through the “envs” dictionary. Return value of pre_kernel function is not required.
- reset(mol=None)
- run(*args, **kwargs)
Call the kernel function of current object. args will be passed to kernel function. kwargs will be used to update the attributes of current object. The return value of method run is the object itself. This allows a series of functions/methods to be executed in pipe.
- set(*args, **kwargs)
Update the attributes of the current object. The return value of method set is the object itself. This allows a series of functions/methods to be executed in pipe.
- stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
- to_gpu(out=None)
Convert a method to its corresponding GPU variant, and recursively converts all attributes of a method to cupy objects or gpu4pyscf objects.
- trans_rdm1(cibra, ciket, nmo=None, nocc=None)
One-particle spin density matrices dm1a, dm1b in MO basis (the occupied-virtual blocks due to the orbital response contribution are not included).
dm1a[p,q] = <q_alpha^dagger p_alpha> dm1b[p,q] = <q_beta^dagger p_beta>
The convention of 1-pdm is based on McWeeney’s book, Eq (5.4.20).
- vector_size()[source]
The size of the vector which was returned from
amplitudes_to_cisdvec()
- verbose = 0
- view(cls)
New view of object with the same attributes.
vayesta.solver.coupled_ccsd
- class vayesta.solver.coupled_ccsd.coupledRCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
RCCSD_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None, fragments: List | NoneType = None)[source]
Bases:
Options
- fragments: List | None = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- diis_space: int = None
- diis_start_cycle: int = None
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'MP2'
- items()
- iterative_damping: float = None
- keys()
- level_shift: float = None
- max_cycle: int = 100
- n_moments: tuple = None
- replace(**kwargs)
- sc_mode: int = None
- solve_lambda: bool = True
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- generate_init_guess(eris=None)
- get_init_guess()
- get_solver_class(mf)
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- print_extra_info(mycc)
- t_diagnostic(solver)
- property v_ext
vayesta.solver.coupling
- vayesta.solver.coupling.transform_amplitude(t, u_occ, u_vir, u_occ2=None, u_vir2=None, inverse=False)[source]
u: (old basis|new basis)
- vayesta.solver.coupling.tailor_with_fragments(solver, fragments, project=False, tailor_t1=True, tailor_t2=True, ovlp_tol=1e-06)[source]
Tailor current CCSD calculation with amplitudes of other fragments.
This assumes orthogonal fragment spaces.
- Parameters:
project (int, optional) –
Level of external correction of T2 amplitudes: 1: Both occupied indices are projected to each other fragment X. 2: Both occupied indices are projected to each other fragment X
and combinations of other fragments X,Y.
3: Only the first occupied indices is projected to each other fragment X.
coupled_fragments (list, optional) – List of fragments, which are used for the external correction. Each fragment x must have the following attributes defined: c_active_occ : Active occupied MO orbitals of fragment x c_active_vir : Active virtual MO orbitals of fragment x results.t1 : T1 amplitudes of fragment x results.t2 : T2 amplitudes of fragment x
- Returns:
tailor_func – Tailoring function for CCSD.
- Return type:
function(cc, t1, t2) -> t1, t2
- vayesta.solver.coupling.externally_correct(solver, external_corrections, hamil=None)[source]
Build callback function for CCSD, to add external correction from other fragments.
TODO: combine with tailor_with_fragments?
- Parameters:
solver (CCSD_Solver) – Vayesta CCSD solver.
external_corrections (list of tuple of (int, str, int, bool)) – List of external corrections. Each tuple contains the fragment ID, type of correction, and number of projectors for the given external correction. Final element is boolean giving the low_level_coul optional argument.
eris (_ChemistsERIs) – ERIs for parent CCSD fragment. Used for MO energies in residual contraction, and for the case of low_level_coul, where the parent Coulomb integral is contracted. If not passed in, MO energy if needed will be constructed from the diagonal of get_fock() of embedding base class, and the eris will be also be obtained from the embedding base class. Optional.
- Returns:
callback – Callback function for PySCF’s CCSD solver.
- Return type:
callable
vayesta.solver.dump
- class vayesta.solver.dump.DumpSolver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(dumpfile: str = None)[source]
Bases:
Options
- dumpfile: str = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel(*args, **kwargs)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.ebcc
- class vayesta.solver.ebcc.REBCC_Solver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(ansatz: str = 'CCSD', solve_lambda: bool = False, max_cycle: int = 200, conv_tol: float = None, conv_tol_normt: float = None, store_as_ccsd: bool = False, c_cas_occ: <built-in function array> = None, c_cas_vir: <built-in function array> = None)[source]
Bases:
Options
- ansatz: str = 'CCSD'
- solve_lambda: bool = False
- max_cycle: int = 200
- conv_tol: float = None
- conv_tol_normt: float = None
- store_as_ccsd: bool = False
- c_cas_occ: array = None
- c_cas_vir: array = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel()[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.ebcc.UEBCC_Solver(hamil, log=None, **kwargs)[source]
Bases:
UClusterSolver
,REBCC_Solver
- class Options(ansatz: str = 'CCSD', solve_lambda: bool = False, max_cycle: int = 200, conv_tol: float = None, conv_tol_normt: float = None, store_as_ccsd: bool = False, c_cas_occ: <built-in function array> = (None, None), c_cas_vir: <built-in function array> = (None, None))[source]
-
- c_cas_occ: array = (None, None)
- c_cas_vir: array = (None, None)
- ansatz: str = 'CCSD'
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- max_cycle: int = 200
- replace(**kwargs)
- solve_lambda: bool = False
- store_as_ccsd: bool = False
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- get_nonnull_solver_opts()
- kernel()
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.ebcc.EB_REBCC_Solver(hamil, log=None, **kwargs)[source]
Bases:
REBCC_Solver
- class Options(ansatz: str = 'CCSD-S-1-1', solve_lambda: bool = False, max_cycle: int = 200, conv_tol: float = None, conv_tol_normt: float = None, store_as_ccsd: bool = False, c_cas_occ: <built-in function array> = None, c_cas_vir: <built-in function array> = None)[source]
Bases:
Options
- ansatz: str = 'CCSD-S-1-1'
- store_as_ccsd: bool = False
- asdict(deepcopy=False)
- c_cas_occ: array = None
- c_cas_vir: array = None
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- max_cycle: int = 200
- replace(**kwargs)
- solve_lambda: bool = False
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- get_space(mo_coeff, mo_occ, frozen=None)
- kernel()
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.ebcc.EB_UEBCC_Solver(hamil, log=None, **kwargs)[source]
Bases:
EB_REBCC_Solver
,UEBCC_Solver
- class Options(ansatz: str = 'CCSD', solve_lambda: bool = False, max_cycle: int = 200, conv_tol: float = None, conv_tol_normt: float = None, store_as_ccsd: bool = False, c_cas_occ: <built-in function array> = (None, None), c_cas_vir: <built-in function array> = (None, None))[source]
-
- ansatz: str = 'CCSD-S-1-1'
- asdict(deepcopy=False)
- c_cas_occ: array = (None, None)
- c_cas_vir: array = (None, None)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- max_cycle: int = 200
- replace(**kwargs)
- solve_lambda: bool = False
- store_as_ccsd: bool = False
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- get_nonnull_solver_opts()
- get_space(mo_coeff, mo_occ, frozen=None)
- kernel()
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- vayesta.solver.ebcc.gen_space(c_occ, c_vir, co_active=None, cv_active=None, frozen_orbs=None)[source]
Given the occupied and virtual orbital coefficients in the local cluster basis, which orbitals are frozen, and any active space orbitals in this space generate appropriate coefficients and ebcc.Space inputs for a calculation. Inputs:
c_occ: occupied orbital coefficients in local cluster basis. c_vir: virtual orbital coefficients in local cluster basis. co_active: occupied active space orbitals in local cluster basis. cv_active: virtual active space orbitals in local cluster basis. frozen_orbs: indices of orbitals to freeze in local cluster basis.
- Outputs:
c: coefficients for the active space orbitals in the local cluster basis. space: ebcc.Space object defining the resulting active space behaviours.
vayesta.solver.ebfci
- class vayesta.solver.ebfci.EB_EBFCI_Solver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(max_cycle: int = 100, conv_tol: float = None, max_boson_occ: int = 2)[source]
Bases:
Options
- max_cycle: int = 100
- conv_tol: float = None
- max_boson_occ: int = 2
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel()[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.ebfci.EB_UEBFCI_Solver(hamil, log=None, **kwargs)[source]
Bases:
UClusterSolver
,EB_EBFCI_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, max_boson_occ: int = 2)
Bases:
Options
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- max_boson_occ: int = 2
- max_cycle: int = 100
- replace(**kwargs)
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- kernel()
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.ext_ccsd
- class vayesta.solver.ext_ccsd.extRCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
RCCSD_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None, external_corrections: Union[List[Any], NoneType] = <factory>)[source]
Bases:
Options
- external_corrections: List[Any] | None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- diis_space: int = None
- diis_start_cycle: int = None
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'MP2'
- items()
- iterative_damping: float = None
- keys()
- level_shift: float = None
- max_cycle: int = 100
- n_moments: tuple = None
- replace(**kwargs)
- sc_mode: int = None
- solve_lambda: bool = True
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- generate_init_guess(eris=None)
- get_init_guess()
- get_solver_class(mf)
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- print_extra_info(mycc)
- t_diagnostic(solver)
- property v_ext
- class vayesta.solver.ext_ccsd.extUCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
UCCSD_Solver
,extRCCSD_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None, external_corrections: Union[List[Any], NoneType] = <factory>)[source]
-
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- diis_space: int = None
- diis_start_cycle: int = None
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'MP2'
- items()
- iterative_damping: float = None
- keys()
- level_shift: float = None
- max_cycle: int = 100
- n_moments: tuple = None
- replace(**kwargs)
- sc_mode: int = None
- solve_lambda: bool = True
- update(**kwargs)
- values()
- external_corrections: List[Any] | None
- calc_v_ext(v_ext_0, cpt)
- generate_init_guess(eris=None)
- get_callback()
- get_init_guess()
- get_solver_class(mf)
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- print_extra_info(mycc)
- t_diagnostic(solver)
T diagnostic not implemented for UCCSD in PySCF.
- property v_ext
vayesta.solver.fci
- class vayesta.solver.fci.FCI_Solver(*args, **kwargs)[source]
Bases:
ClusterSolver
- class Options(threads: int = 1, max_cycle: int = 300, lindep: float = None, conv_tol: float = 1e-12, solver_spin: bool = True, fix_spin: float = 0.0, fix_spin_penalty: float = 1.0, davidson_only: bool = True, init_guess: str = 'default', init_guess_noise: float = 1e-05, n_moments: tuple = None)[source]
Bases:
Options
- threads: int = 1
- max_cycle: int = 300
- lindep: float = None
- conv_tol: float = 1e-12
- solver_spin: bool = True
- fix_spin: float = 0.0
- fix_spin_penalty: float = 1.0
- davidson_only: bool = True
- init_guess: str = 'default'
- init_guess_noise: float = 1e-05
- n_moments: tuple = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- cisd_solver
alias of
RCISD_Solver
- kernel(ci=None)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.fci.UFCI_Solver(*args, **kwargs)[source]
Bases:
UClusterSolver
,FCI_Solver
- class Options(threads: int = 1, max_cycle: int = 300, lindep: float = None, conv_tol: float = 1e-12, solver_spin: bool = True, fix_spin: float = None, fix_spin_penalty: float = 1.0, davidson_only: bool = True, init_guess: str = 'default', init_guess_noise: float = 1e-05, n_moments: tuple = None)[source]
Bases:
Options
- fix_spin: float = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = 1e-12
- davidson_only: bool = True
- static dict_with_defaults(**kwargs)
- fix_spin_penalty: float = 1.0
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'default'
- init_guess_noise: float = 1e-05
- items()
- keys()
- lindep: float = None
- max_cycle: int = 300
- n_moments: tuple = None
- replace(**kwargs)
- solver_spin: bool = True
- threads: int = 1
- update(**kwargs)
- values()
- cisd_solver
alias of
UCISD_Solver
- kernel(ci=None)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.hamiltonian
- class vayesta.solver.hamiltonian.RClusterHamiltonian(fragment, mf, log=None, cluster=None, **kwargs)[source]
Bases:
object
- class Options(screening: str | NoneType = None, cache_eris: bool = True, match_fock: bool = True)[source]
Bases:
OptionsBase
- screening: str | None = None
- cache_eris: bool = True
- match_fock: bool = True
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- property cluster
- property mo
- property mbos
- property nelec
- property ncas
- property has_screening
- to_pyscf_mf(allow_dummy_orbs=False, force_bare_eris=False, overwrite_fock=False, allow_df=False)[source]
Generate pyscf.scf object representing this active space Hamiltonian. This should be able to be passed into a standard post-hf pyscf solver without modification.
- Parameters:
allow_dummy_orbs (bool, optional) – Whether the introduction of dummy orbitals into the mean-field, which are then frozen, is permitted. Default is False
force_bare_eris (bool, optional) – Forces resultant mean-field object to use unscreened eris. Default is False
overwrite_fock (bool, optional) – Whether mf.get_fock should be set to self.get_fock. Mainly for use in UHF. Default is False
allow_df (bool, optional) – Whether the resultant mean-field object should include a .with_df object containing the projection of the CDERIs into the cluster space. Default is False
- Returns:
clusmf (pyscf.scf.SCF) – Representation of cluster as pyscf mean-field.
orbs_to_freeze (list of lists) – Which orbitals to freeze, split by spin channel if UHF.
- add_screening(seris_intermed=None)[source]
- Adds appropriate screening according to the value of self.opts.screening.
-None: gives bare interactions, but this function shouldn’t be called in that case. -‘mrpa’: moment-conserving interactions. -‘crpa’: gives cRPA interactions. Including ‘ov’ after ‘crpa’ will only apply cRPA screening in the o-v channel.
Including ‘pcoupling’ similarly will account for the polarisability in non-canonical cluster spaces.
seris_intermed is only required for mRPA interactions.
- class vayesta.solver.hamiltonian.UClusterHamiltonian(fragment, mf, log=None, cluster=None, **kwargs)[source]
Bases:
RClusterHamiltonian
- property ncas
- property nelec
- to_pyscf_mf(allow_dummy_orbs=True, force_bare_eris=False, overwrite_fock=True, allow_df=False)[source]
Generate pyscf.scf object representing this active space Hamiltonian. This should be able to be passed into a standard post-hf pyscf solver without modification.
- Parameters:
allow_dummy_orbs (bool, optional) – Whether the introduction of dummy orbitals into the mean-field, which are then frozen, is permitted. Default is False
force_bare_eris (bool, optional) – Forces resultant mean-field object to use unscreened eris. Default is False
overwrite_fock (bool, optional) – Whether mf.get_fock should be set to self.get_fock. Mainly for use in UHF. Default is False
allow_df (bool, optional) – Whether the resultant mean-field object should include a .with_df object containing the projection of the CDERIs into the cluster space. Default is False
- Returns:
clusmf (pyscf.scf.SCF) – Representation of cluster as pyscf mean-field.
orbs_to_freeze (list of lists) – Which orbitals to freeze, split by spin channel if UHF.
- class Options(screening: str | NoneType = None, cache_eris: bool = True, match_fock: bool = True)
Bases:
OptionsBase
- asdict(deepcopy=False)
- cache_eris: bool = True
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- match_fock: bool = True
- replace(**kwargs)
- screening: str | None = None
- update(**kwargs)
- values()
- assert_equal_spin_channels(message='')
- calc_loc_erpa(m0, amb, only_cumulant=False)
- property cluster
- get_eris_screened(block=None)
- get_integrals(bare_eris=None, with_vext=True)
- property has_screening
- property mbos
- property mo
- target_space_projector(c=None)
Projector to the target fragment space within our cluster.
- with_new_cluster(cluster)
- class vayesta.solver.hamiltonian.EB_RClusterHamiltonian(*args, **kwargs)[source]
Bases:
RClusterHamiltonian
- class Options(screening: str | NoneType = None, cache_eris: bool = True, match_fock: bool = True, polaritonic_shift: bool = True)[source]
Bases:
Options
- polaritonic_shift: bool = True
- asdict(deepcopy=False)
- cache_eris: bool = True
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- match_fock: bool = True
- replace(**kwargs)
- screening: str | None = None
- update(**kwargs)
- values()
- property polaritonic_shift
- property couplings
- property unshifted_couplings
- property bos_freqs
- property mbos
- add_screening(seris_intermed=None)
- Adds appropriate screening according to the value of self.opts.screening.
-None: gives bare interactions, but this function shouldn’t be called in that case. -‘mrpa’: moment-conserving interactions. -‘crpa’: gives cRPA interactions. Including ‘ov’ after ‘crpa’ will only apply cRPA screening in the o-v channel.
Including ‘pcoupling’ similarly will account for the polarisability in non-canonical cluster spaces.
seris_intermed is only required for mRPA interactions.
- assert_equal_spin_channels(message='')
- calc_loc_erpa(m0, amb, only_cumulant=False)
- property cluster
- get_cderi_bare(only_ov=False, compress=False, svd_threshold=1e-12)
- get_clus_mf_info(ao_basis=False, with_vext=True, with_exxdiv=False)
- get_dummy_eri_object(force_bare=False, with_vext=True, with_exxdiv=False)
- get_eris_bare(block=None)
- get_eris_screened(block=None)
- get_fock(with_vext=True, use_seris=None, with_exxdiv=False)
- get_integrals(bare_eris=None, with_vext=True)
- get_mo(mo_coeff=None)
- property has_screening
- property mo
- property ncas
- property nelec
- target_space_projector(c=None)
Projector to the target fragment space within our cluster.
- to_pyscf_mf(allow_dummy_orbs=False, force_bare_eris=False, overwrite_fock=False, allow_df=False)
Generate pyscf.scf object representing this active space Hamiltonian. This should be able to be passed into a standard post-hf pyscf solver without modification.
- Parameters:
allow_dummy_orbs (bool, optional) – Whether the introduction of dummy orbitals into the mean-field, which are then frozen, is permitted. Default is False
force_bare_eris (bool, optional) – Forces resultant mean-field object to use unscreened eris. Default is False
overwrite_fock (bool, optional) – Whether mf.get_fock should be set to self.get_fock. Mainly for use in UHF. Default is False
allow_df (bool, optional) – Whether the resultant mean-field object should include a .with_df object containing the projection of the CDERIs into the cluster space. Default is False
- Returns:
clusmf (pyscf.scf.SCF) – Representation of cluster as pyscf mean-field.
orbs_to_freeze (list of lists) – Which orbitals to freeze, split by spin channel if UHF.
- with_new_cluster(cluster)
- class vayesta.solver.hamiltonian.EB_UClusterHamiltonian(*args, **kwargs)[source]
Bases:
UClusterHamiltonian
,EB_RClusterHamiltonian
- class Options(screening: str | NoneType = None, cache_eris: bool = True, match_fock: bool = True, polaritonic_shift: bool = True)[source]
Bases:
Options
- polaritonic_shift: bool = True
- asdict(deepcopy=False)
- cache_eris: bool = True
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- match_fock: bool = True
- replace(**kwargs)
- screening: str | None = None
- update(**kwargs)
- values()
- property couplings
- add_screening(seris_intermed=None)
Add screened interactions into the Hamiltonian.
- assert_equal_spin_channels(message='')
- property bos_freqs
- property cluster
- generate_bosonic_interactions()
- get_cderi_bare(only_ov=False, compress=False, svd_threshold=1e-12)
- get_clus_mf_info(ao_basis=False, with_vext=True, with_exxdiv=False)
- get_dummy_eri_object(force_bare=False, with_vext=True, with_exxdiv=False)
- get_eris_bare(block=None)
- get_eris_screened(block=None)
- get_fock(with_vext=True, use_seris=True, with_exxdiv=False)
- get_integrals(bare_eris=None, with_vext=True)
- get_mo(mo_coeff=None)
- get_polaritonic_fock_shift(couplings)
- property has_screening
- initialise_bosons(bos_freqs, bos_couplings, rotation=None, boson_nonconserving=None)
- property mbos
- property mo
- property ncas
- property nelec
- property polaritonic_shift
- set_polaritonic_shift(freqs, couplings)
- target_space_projector(c=None)
Projector to the target fragment space within our cluster.
- to_pyscf_mf(allow_dummy_orbs=True, force_bare_eris=False, overwrite_fock=True, allow_df=False)
Generate pyscf.scf object representing this active space Hamiltonian. This should be able to be passed into a standard post-hf pyscf solver without modification.
- Parameters:
allow_dummy_orbs (bool, optional) – Whether the introduction of dummy orbitals into the mean-field, which are then frozen, is permitted. Default is False
force_bare_eris (bool, optional) – Forces resultant mean-field object to use unscreened eris. Default is False
overwrite_fock (bool, optional) – Whether mf.get_fock should be set to self.get_fock. Mainly for use in UHF. Default is False
allow_df (bool, optional) – Whether the resultant mean-field object should include a .with_df object containing the projection of the CDERIs into the cluster space. Default is False
- Returns:
clusmf (pyscf.scf.SCF) – Representation of cluster as pyscf mean-field.
orbs_to_freeze (list of lists) – Which orbitals to freeze, split by spin channel if UHF.
- property unshifted_couplings
- with_new_cluster(cluster)
vayesta.solver.mp2
- class vayesta.solver.mp2.RMP2_Solver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options(compress_cderi: bool = False)[source]
Bases:
Options
- compress_cderi: bool = False
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- kernel(*args, **kwargs)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
- class vayesta.solver.mp2.UMP2_Solver(hamil, log=None, **kwargs)[source]
Bases:
UClusterSolver
,RMP2_Solver
- make_t2(mo_energy, eris=None, cderi=None, cderi_neg=None, blksize=None, workmem=1000000000)[source]
Make T2 amplitudes
- class Options(compress_cderi: bool = False)
Bases:
Options
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- compress_cderi: bool = False
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- get_init_guess()
- kernel(*args, **kwargs)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.solver
- class vayesta.solver.solver.ClusterSolver(hamil, log=None, **kwargs)[source]
Bases:
object
Base class for cluster solver
- class Options[source]
Bases:
OptionsBase
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- property v_ext
- kernel(*args, **kwargs)[source]
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)[source]
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- class vayesta.solver.solver.UClusterSolver(hamil, log=None, **kwargs)[source]
Bases:
ClusterSolver
- class Options
Bases:
OptionsBase
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- static dict_with_defaults(**kwargs)
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- items()
- keys()
- replace(**kwargs)
- update(**kwargs)
- values()
- get_init_guess()
- kernel(*args, **kwargs)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- property v_ext
vayesta.solver.tccsd
- class vayesta.solver.tccsd.TRCCSD_Solver(hamil, log=None, **kwargs)[source]
Bases:
RCCSD_Solver
- class Options(max_cycle: int = 100, conv_tol: float = None, conv_tol_normt: float = None, diis_space: int = None, diis_start_cycle: int = None, iterative_damping: float = None, level_shift: float = None, init_guess: str = 'MP2', solve_lambda: bool = True, n_moments: tuple = None, sc_mode: int = None, fci_opts: dict = <factory>, c_cas_occ: <built-in function array> = None, c_cas_vir: <built-in function array> = None)[source]
Bases:
Options
- fci_opts: dict
- c_cas_occ: array = None
- c_cas_vir: array = None
- asdict(deepcopy=False)
- classmethod change_dict_defaults(field, **kwargs)
- conv_tol: float = None
- conv_tol_normt: float = None
- static dict_with_defaults(**kwargs)
- diis_space: int = None
- diis_start_cycle: int = None
- get(attr, default=None)
Dictionary-like access to attributes. Allows the definition of a default value, of the attribute is not present.
- classmethod get_default(field)
- classmethod get_default_factory(field)
- init_guess: str = 'MP2'
- items()
- iterative_damping: float = None
- keys()
- level_shift: float = None
- max_cycle: int = 100
- n_moments: tuple = None
- replace(**kwargs)
- sc_mode: int = None
- solve_lambda: bool = True
- update(**kwargs)
- values()
- calc_v_ext(v_ext_0, cpt)
- generate_init_guess(eris=None)
- get_init_guess()
- get_solver_class(mf)
- kernel(t1=None, t2=None, l1=None, l2=None, coupled_fragments=None, t_diagnostic=True)
Set up everything for a calculation on the CAS and pass this to the solver-specific kernel that runs on this information.
- optimize_cpt(nelectron, c_frag, cpt_guess=0, atol=1e-06, rtol=1e-06, cpt_radius=0.5)
Enables chemical potential optimization to match a number of electrons in the fragment space.
- Parameters:
nelectron (float) – Target number of electrons.
c_frag (array) – Fragment orbitals.
cpt_guess (float, optional) – Initial guess for fragment chemical potential. Default: 0.
atol (float, optional) – Absolute electron number tolerance. Default: 1e-6.
rtol (float, optional) – Relative electron number tolerance. Default: 1e-6
cpt_radius (float, optional) – Search radius for chemical potential. Default: 0.5.
- Returns:
Solver results.
- Return type:
results
- t_diagnostic(solver)
- property v_ext