nitrogen.scf¶
General self-consistent field methods.
- nitrogen.scf.Heff_aci_mp2(Hcfg, target_cfgs, mp2_max, tol=0.1, excitation_fun=None, max_iter=20, target_char_tol=0.2, skip_final_diag=False, return_final_cfg_space=False)¶
Iterative-adaptive CI effective Hamiltonian with second-order corrections.
- Parameters
Hcfg (ConfigurationOperator) – Hamiltonian in the SCF modal configuration representation.
target_cfgs (array_like) – The target configurations.
mp2_max (scalar) – The maximum excitation of the perturbative corrections.
tol (float, optional) – The first-order mixing coefficient threshold for inclusion in the iterative variational block. The default is 1e-1.
excitation_fun (function, optional) – The configuration excitation function. If None, then the sum of configuration indices is used. See
config_table().max_iter (int, optional) – The maximum number of iterations. The default is 20.
target_char_tol (float, optional) – The minimum required target state character to be used for iterative expansion stage. The default is 0.20.
skip_final_diag (bool, optional) – If True, then the final diagonalization step of the effective Hamiltonian is skipped. The default is False.
return_final_cfg_space (bool, optional) – If True, the list of the final variational configuration states is also returned.
- Returns
Heff – The effective Hamiltonian
- Return type
ndarray
- nitrogen.scf.Heff_ci_mp2(Hcfg, ci_max, mp2_max=None, neff=None, excitation_fun=None, printlevel=1)¶
Calculate hybrid VCI + VMP2 effective Hamiltonian
- Parameters
Hcfg (ConfigurationOperator) – The configuration representation Hamiltonian.
ci_max (scalar) – The maximum excitation of the variational block.
mp2_max (scalar, optional) – The maximum excitation of the perturbative block. If None (default), no perturbative corrections will be made.
neff (int, optional) – The size of the effective Hamiltonian. If None (default), then the entire variational space will be used.
excitation_fun (function, optional) – The configuration excitation function. If None, then the sum of configuration indices is used. See
config_table().printlevel (int, optional) – Printed output level. The default is 1.
- Returns
Heff – The effective Hamiltonian
- Return type
ndarray
- class nitrogen.scf.NonLinearTO(bases, cs, pes, masses)¶
Bases:
nitrogen.tensor.TensorOperatorA simple, full-dimensional quadrature Hamiltonian tensor operator for non-linear molecules
- H¶
The wrapped Hamlitonian tensor operator
- Type
- Crot¶
The TensorOperator coefficients of the pure rotational kinetic energy operator
- Type
(3,3) nested list
- Crv¶
The TensorOperator coefficients of the rotation-vibration kinetic energy operator
- Type
(3,) list
- Parameters
- asConfigurationOperator(config_funs, labels=None)¶
return a ConfigurationOperator object wrapping this TensorOperator using the supplied basis functions
- nitrogen.scf.calcRho(w, u, beta)¶
- Calculate the normalized thermal density operator,
\(\rho = \exp[-\beta H]\)
- Parameters
w ((n,) ndarray) – The energy eigenvalues of \(H\).
u ((...,n) ndarrays) – The orthonormal eigenvectors of \(H\).
beta (scalar) – The value of \(\beta = 1/kT\). If beta is equal to
np.inf, then only the lowest energy eigenvectors is used. Behavior is undefined for exactly degenerate ground state.
- Returns
rho ((…,…) ndarray) – The thermal density operator, \(\rho\), normalized to unit trace, \(\mathrm{Tr}[\rho] = 1\).
F (scalar) – The Helmholtz free energy.
- nitrogen.scf.calcSCF(H, labels=None, init_wfs=None, target=None, sorting='energy', tol=1e-10, maxiter=100, printlevel=0)¶
Calculate the generalized self-consistent field solution for a TensorOperator H.
- Parameters
H (TensorOperator) – The Hamiltonian as a tensor operator in the primitive basis representation.
labels (list of lists, optional) – Each element of list is a list of labels one factor of the product wavefunction. The labels 0, 1, 2, … correspond to the axes of H. The default is [[0], [1], [2], …]
init_wfs (list of ndarrays, optional) – The initial wavefunction factors. If None, default values will be used.
target (array_like, optional) – The SCF target configuration. The default [0, 0, …]
sorting ({'energy'}) – The SCF factor sorting mode. This defines the meaning of the target index values. The default is ‘energy’.
tol (float, optional) – The SCF energy convergence tolerance. The default is 1e-10.
maxiter (int, optional) – The maximum number of SCF iterations. The default is 100.
printlevel (int, optional) – Output print level. The default is 0.
- Returns
e_scf (float) – The final SCF energy
wfs (list of ndarrays) – The final SCF wavefunctions
ve (list of ndarrays) – ve[i] are the 1-mode SCF energies for factor i.
vwfs (list of ndarrays) – vwfs[i] is the array of virtual SCF wavefunctions for factor i
- nitrogen.scf.calc_h4_energies(hrv, Jmax)¶
Calculate the energies for a quartic effective Hamiltonian.
- Parameters
hrv (list of ndarray) – The rotational operator coefficients
Jmax (integer) – The maxmimum value of \(J\).
- Returns
eJ – The energies for each value of \(J\)
- Return type
list of ndarray
- nitrogen.scf.calc_h4_energies_J(hrv, J)¶
Calculate the energies for a quartic effective Hamiltonian for a given value of \(J\).
- Parameters
hrv (list of ndarray) – The rotational operator coefficients
Jmax (integer) – The value of \(J\).
- Returns
e – The energies for this value of \(J\).
- Return type
list of ndarray
- nitrogen.scf.config_table(maxf, n, sort=True, fun=None, index_range=None, minf=None)¶
Tabulate a list of configurations in n indices with fun(config) <= maxf.
- Parameters
maxf (scalar) – The maximum excitation.
n (int) – The number of indices.
sort (boolean) – If True (default), the configuration table is sorted by the excitation function.
fun (function, optional) – The excitation function. If None (default), the sum of indices is used.
index_range (array_like) – The dimension of each index. The default is infinite.
minf (scalar) – The minimum excitation. The default is negative infinity. Allowed configurations are strictly greater than minf.
- Returns
- Return type
ndarray
Notes
Custom exciations functions fun take an argument ‘’configs’’ with is a (…, n) array_like containing an array of configuration index vectors. It must return a (…)-shaped array with the excitation value. The excitation value must be monotonically increasing with an increment of one or more configuration indices.
- nitrogen.scf.doublesConfigs(config, ij, ninj, exclude=False)¶
Calculate doubly excited configurations.
- Parameters
config (1-d array_like) – The reference configuration.
ij (tuple) – A tuple (i,j) with the two indices to excite.
ninj (tuple) – A tuple (ni,nj) with the dimensions of the two indices to excite.
exclude (boolean, optional) – Exclude the reference and singly excited configurations from the doubly excited list. The default is False.
- Returns
The doubly excited configurations.
- Return type
ndarray
- nitrogen.scf.rovib_MP2(Hvib, Crot, Crv, mp2_max, target=None, excitation_fun=None, printlevel=1)¶
Single-state second-order rotational effective Hamiltonian.
- Parameters
Hvib (ConfigurationOperator) – The configuration representation pure vibrational Hamiltonian.
Crot (nested list of ConfigurationOperator) – The coefficients of \([iJ_a/\hbar, iJ_b/\hbar]_+\).
Crv (list of ConfigurationOperator) – The coefficients of \([iJ_a/\hbar]\).
mp2_max (scalar) – The maximum excitation of the perturbative block.
target (array_like, optional) – The target configuration. The default is [0, 0, …]
excitation_fun (function, optional) – The configuration excitation function. If None, then the sum of configuration indices is used. See
config_table().printlevel (int, optional) – Printed output level. The default is 1.
- Returns
Evib (float) – The MP2 vibrational energy
sigma (ndarray) – The quadratic coefficients
tau (ndarray) – The quartic coefficients
Notes
Crot is assumed to be a symmetric tensor,
Crot[a][b] = Crot[b][a]. The matrix elements of Crv are assumed to be real and anti-symmetric within the vibrational basis.The rotational arrays are defined by
\[H_\text{rot} = \frac{1}{2} \sigma_{\alpha \beta} J_\alpha J_\beta + \frac{1}{4} \tau_{\alpha \beta \gamma \delta} J_\alpha J_\beta J_\gamma J_\delta\]
- nitrogen.scf.rovib_MP2_multi(Hvib, Crot, Crv, mp2_max, targets, excitation_fun=None, printlevel=1, first_order_only=False, return_partitioned_heff=False)¶
Multi-state second-order rotational effective Hamiltonian.
- Parameters
Hvib (ConfigurationOperator) – The configuration representation pure vibrational Hamiltonian.
Crot (nested list of ConfigurationOperator) – The coefficients of \([iJ_a/\hbar, iJ_b/\hbar]_+\).
Crv (list of ConfigurationOperator) – The coefficients of \([iJ_a/\hbar]\).
mp2_max (scalar) – The maximum excitation of the perturbative block.
targets ((nt, nmodes) array_like, optional) – The target configurations.
excitation_fun (function, optional) – The configuration excitation function. If None, then the sum of configuration indices is used. See
config_table().first_order_only (bool, optional) – Only include contributions up to first order. The default is False.
return_partitioned_h2 (bool, optional) – If True, return individual vib/rv/rot contributions to the effective h2 operators. The default is False.
- Returns
h0 ((nt,nt) ndarray) – The MP2 pure vibrational Hamiltonian
h1 ((nt,nt,3) ndarray) – The MP2 linear rotational coefficients.
h2 ((nt,nt,3,3) ndarray) – The MP2 quadratic rotational coefficients.
h3 ((nt,nt,3,3,3) ndarray) – The MP2 cubic rotational coefficients.
h4 ((nt,nt,3,3,3,3) ndarray) – The MP2 quartic rotational coefficients.
(If `returned_partitioned_h2` == True (*)*)
h2rot ((nt,nt,3,3) ndarray) – The first-order rotational contributions to h2.
h2vibrot ((nt,nt,3,3) ndarray) – The second-order pure vib – pure rot contributions to h2.
h2rvrv ((nt,nt,3,3) ndarray) – The second-order Coriolis contributions to h2.
Notes
Crot is assumed to be a symmetric tensor,
Crot[a][b] = Crot[b][a]. The matrix elements of Crv are assumed to be real and anti-symmetric within the vibrational basis.The effective Hamiltonian is defined by the ``h``n arrays as
\[ \begin{align}\begin{aligned}H_\mathrm{eff} &= h^0_{v_1,v_2} \vert v_1 \rangle \langle v_2 \vert\\ &+ h^1_{v_1,v_2,\alpha} \vert v_1 \rangle \langle v_2 \vert (i J_\alpha)\\ &+ h^2_{v_1,v_2,\alpha,\beta} \vert v_1 \rangle \langle v_2 \vert (i J_\alpha) (i J_\beta)\\ &+ h^3_{v_1,v_2,\alpha,\beta,\gamma} \vert v_1 \rangle \langle v_2 \vert (i J_\alpha) (i J_\beta )(i J_\gamma)\\ &+ h^4_{v_1,v_2,\alpha,\beta,\gamma,\delta} \vert v_1 \rangle \langle v_2 \vert (i J_\alpha) (i J_\beta )(i J_\gamma)(i J_\delta)\end{aligned}\end{align} \]
- nitrogen.scf.scfStability(Hcfg, target_cfg=None)¶
Calculate the stability of a mean field solution using the configuration representation Hamiltonian.
- Parameters
Hcfg (ConfigurationOperator) – Hamiltonian in the SCF modal configuration representation
target_cfg (array_like) – The target configuration. If None, this is assumed to be [0, 0, …]
- Returns
w (ndarray) – The eigenvalues of the SCF stability matrix
u (ndarray) – The eigenvectors of the SCF stability matrix
- nitrogen.scf.simple_MP2(Hcfg, mp2_max, target=None, excitation_fun=None, printlevel=1)¶
Simple single-state second-order perturbation theory
- Parameters
Hcfg (ConfigurationOperator) – The configuration representation Hamiltonian.
mp2_max (scalar) – The maximum excitation of the perturbative block.
target (array_like, optional) – The target configuration. The default is [0, 0, …]
excitation_fun (function, optional) – The configuration excitation function. If None, then the sum of configuration indices is used. See
config_table().printlevel (int, optional) – Printed output level. The default is 1.
- Returns
e2 – The MP2 energy
- Return type
float
Notes
The zeroth order Hamiltonian is by default the diagonal of Hcfg.
- nitrogen.scf.singlesConfigs(config, i, ni, exclude=False)¶
Calculate singly excited configurations.
- Parameters
config (1-d array_like) – The reference configuration.
i (int) – The index to excite.
ni (int) – The dimension of index i.
exclude (boolean, optional) – Exclude the reference configuration config from the singly excited list. The default is False.
- Returns
The singly excited configurations for index i.
- Return type
ndarray
- nitrogen.scf.thermalSCF(H, beta, labels=None, init_density=None, tol=1e-10, maxiter=100, printlevel=0)¶
Calculate the thermal self-consistent field via the Bogolyubov free energy variational principle for the Hamiltonian TensorOperator H.
- Parameters
H (TensorOperator) – The Hamiltonian as a tensor operator in the primitive basis representation.
beta (scalar) – The value of \(\beta = 1/kT\).
labels (list of lists, optional) – Each element of list is a list of labels one factor of the product wavefunction. The labels 0, 1, 2, … correspond to the axes of H. The default is [[0], [1], [2], …]
init_density (list of ndarrays, optional) – The initial thermal density operator for each factor.
tol (float, optional) – The SCF free energy convergence tolerance. The default is 1e-10.
maxiter (int, optional) – The maximum number of SCF iterations. The default is 100.
printlevel (int, optional) – Output print level. The default is 0.
- Returns
F_scf (float) – The thermal SCF free energy.
rhos (list of ndarrays) – The thermal SCF density operators.
ve (list of ndarrays) – ve[i] are the 1-mode SCF energies for factor i.
vwfs (list of ndarrays) – vwfs[i] is the array of virtual SCF wavefunctions for factor i