lumeq.property package

Submodules

lumeq.property.chaos_rmt module

spectral_form_factor(levels, times)[source]

Compute the spectral form factor from unfolded energy levels.

Parameters:
  • levels (2d array (nsnap, nlevels)) – The unfolded energy levels to be analyzed.

  • times (array) – The time points at which to compute K(t) for Fourier transform.

Returns:

The spectral form factor K(t) at the corresponding time points.

Return type:

K (array)

Notes

The spectral form factor is K(t) = <sum_{i,j} exp(-i (E_i - E_j) t)> / D^2. Equivalently, K(t) = <|sum_i exp(-i E_i t)|^2> / D^2.

stat_poisson(s)[source]

Poisson distribution for unfolded level spacing s: P(s) = exp(-s)

stat_wigner(s, itype='goe')[source]

Wigner-Dyson distribution for unfolded level spacing s. P(s) = \frac{\pi}{2} s e^{-\frac{\pi}{4} s^2} for GOE P(s) = \frac{32}{\pi^2} s^2 e^{-\frac{4}{\pi} s^2} for GUE

Parameters:
  • s (array-like) – The unfolded level spacings to be evaluated.

  • itype (str, optional) – The type of random matrix ensemble. Can be ‘goe’ (Gaussian Orthogonal Ensemble), ‘gue’ (Gaussian Unitary Ensemble). Default is ‘goe’.

Returns:

The probability density P(s) for the given unfolded level spacings.

Return type:

P (array)

unfold_level_spacing(levels, deg=5, center_window=False)[source]

Unfold the level spacing s = dN/dE * dE

Parameters:
  • levels (array-like) – The energy levels to be unfolded.

  • deg (int, optional) – The degree of the polynomial fit to the staircase function N(E). Default is 5.

  • center_window (tuple, optional) – Fractional level window used for unfolding. For example, (0.2, 0.8) uses levels between the 20th and 80th percentiles. Default is False, which uses all levels.

Returns:

The unfolded energy levels. s (array): The unfolded level spacings.

Return type:

eps (array)

unfold_parameter(eps, param, ref=None)[source]

Rescale an external parameter using the variance of unfolded level velocities.

Figure 6 of Tao and Galitski, arXiv:2602.21299, uses x = sqrt(C0) * (lambda - lambda0), where C0 = <(d eps / d lambda)^2>.

Parameters:
  • eps (2d array (nparam, nlevels)) – Unfolded energy levels along the parameter grid.

  • param (1d array) – External parameter values, e.g. electric field or time.

  • ref (float, optional) – Reference parameter value lambda0. Default is param[0].

Returns:

Unfolded parameter. c0 (float): Mean squared level velocity. vel (2d array): Level velocities d eps / d lambda.

Return type:

x (1d array)

lumeq.property.energy_density_plot module

class EnergyDensity(atom, functional, basis, ecp=None, charge=0, max_memory=4000, efield=None, debug=False)[source]

Bases: object

ground-state energy density: j_only(), jk(), xc() excited-state energy density: coulomb_only(), coulomb_exchange(), functional()

becke_partition()[source]
cal_density_matrices(ie)[source]
cal_excitation_lambda_factor(estate)[source]
cal_excited_state(nstates)[source]
cal_overlap_detach_attach_density(estate)[source]
check_energy_core(dm)[source]
check_energy_coulomb_exchange(dm, hf_type)[source]
check_energy_functional()[source]
check_energy_jk(dm, hf_type)[source]
check_energy_xc()[source]
check_transtion_density()[source]
creat_mesh_grids(grid_type, nxyz)[source]
decompose_energy_density(directory, nstates=1, estate=0, plotnum=3, grid_type=1, nxyz=0.1, dohirshfeld=True, dobecke=True, withcharge=False, decompose_es=True, cal_another_attraction=False)[source]
decompose_energy_density_es(directory, hf_type, has_xc, ie, grid_type=1, dohirshfeld=True, dobecke=True)[source]
decompose_energy_density_gs(hf_type, has_xc)[source]
density_on_grids(dm, xctype='GGA')[source]
energy_density_core(dm, rho_value)[source]
energy_density_coulomb_exchange(dm1, dm2, dm3, dm4, rho_value1, rho_value2, hf_type)[source]

dm1, dm2: ground-state, difference, transition, transition_symmetric dm rho_value1, rho_value2: difference, transition rho_value

energy_density_coulomb_only(dm1, dm2, rho_value1, rho_value2)[source]

dm1, dm2: ground-state, transition_symmetric dm rho_value1, rho_value2: difference, transition rho_value

energy_density_exchange_rsh(dm1, dm2, dm3, omega, alpha, hyb)[source]

dm1, dm2, dm3: ground-state, difference, transition dm

energy_density_functional()[source]
energy_density_j_only(dm, rho_value)[source]

ground-state dm and rho_value

energy_density_jk(dm, rho_value, hf_type)[source]

ground-state dm and rho_value

energy_density_k_rsh(dm, omega, alpha, hyb)[source]
energy_density_xc()[source]
grab_es_density_on_grids(xctype='GGA')[source]
grab_gs_density_on_grids(xctype='GGA')[source]
group_hirshfeld_partition()[source]

density ratio of fragments on grid points

mayer_bond_order(bondatoms, nstates, estate)[source]
partition_energy_or_charge(ie, dohirshfeld=True, dobecke=True, withcharge=False)[source]
plot_es_energy_density(directory, ie)[source]
plot_gs_energy_density(directory, plotnum)[source]
relaxed_z_kernel(ie, singlet=True, atmlst=None, max_memory=2000)[source]
sum_energy_density_component()[source]
use_auxilary_basis(auxbasis)[source]

lumeq.property.grids module

class Grids(mf, nxyz=None)[source]

Bases: object

ao_on_grids()[source]

Calculate the atomic orbital values and their derivatives on the grids.

Returns:

Atomic-orbital values and their derivatives on the grids.

Return type:

numpy.ndarray

density_on_grids(dm, xctype='GGA')[source]

Calculate the electron density and its derivatives on the grids.

Parameters:
  • dm (numpy.ndarray) – Density matrix.

  • xctype (str) – Exchange-correlation functional type, e.g. 'LDA' or 'GGA'.

Returns:

Electron density and its derivatives on the grids.

Return type:

numpy.ndarray

orbital_on_grids(mo_coeff)[source]

Calculate the molecular orbital values and their derivatives on the grids.

Parameters:

mo_coeff (numpy.ndarray) – Molecular-orbital coefficients.

Returns:

Molecular-orbital values and their derivatives on the grids.

Return type:

numpy.ndarray

plot_grid_values(values, title='density', filename='', nums=None)[source]

Plot the grid values in 3D space. Cubegen

Parameters:
  • values (numpy.ndarray) – Grid values to plot.

  • title (str) – Plot title.

  • filename (str) – Cube-file prefix for saving the plot.

  • nums (int, optional) – Number of datasets to write when values contains multiple grids.

creat_mesh_grids(mf, nxyz=None)[source]

Create mesh grids for numerical integration.

Parameters:
  • mf – PySCF mean-field object.

  • nxyz (list, optional) – Cubic-grid parameters [nx, ny, nz, resolution].

Returns:

(cc, coords, weights, ngrids).

Return type:

tuple

lumeq.property.orbital_property module

cal_orbital_property(mol, mf)[source]
cal_property_from_scratch(infile)[source]

lumeq.property.rdm_analysis module

assemble_amplitudes(xy, nstates=None, rpa=False, itype='r')[source]

reshape the transition amplitudes from pyscf tdscf module

Parameters:
  • xytdscf.xy tuples.

  • nstates (int, optional) – Number of excited states.

  • rpa (bool, optional) – Whether to include the RPA Y amplitudes.

  • itype (str) – One of 'r', 'ro', or 'u'.

Returns:

Reshaped (xs, ys) transition amplitudes.

Return type:

tuple

cal_dipoles(dip_mat, rdm)[source]

calculate dipole moments from dipole integrals and 1-particle density matrices

Parameters:
  • dip_mat (numpy.ndarray) – Dipole integrals in AO basis with shape (3, nao, nao).

  • rdm (numpy.ndarray) – One-particle density matrices with shape (..., nao, nao).

Returns:

Dipole moments with shape (..., 3).

Return type:

numpy.ndarray

cal_rdm1(xy1, coeff1, xy2=None, coeff2=None, scale=2.0, itype='trans')[source]

calculate 1-particle density matrices from xy amplitudes

Parameters:
  • xy1 (list) – XY amplitudes for the first set of states.

  • coeff1 – Molecular orbitals for the first state set.

  • xy2 (list, optional) – XY amplitudes for the second set of states.

  • coeff2 (numpy.ndarray, optional) – Molecular orbitals for the second state set.

  • scale (float) – 2 for restricted and 1 for unrestricted cases.

  • itype (str) – Density-matrix type, e.g. 'trans' or 'diff'.

get_attach_dm(xy1, orbv1, xy2=None, orbv2=None, scale=2.0)[source]

calculate attach part of 1-particle density matrix from xy amplitudes bewteen excited states

get_detach_dm(xy1, orbo1, xy2=None, orbo2=None, scale=2.0)[source]

calculate detach part of 1-particle density matrix from xy amplitudes bewteen excited states

get_difference_dm(xy1, coeff1, xy2=None, coeff2=None, scale=2.0)[source]

calculate difference density matrix bewteen excited states

Parameters:
  • xy1 (list) – [xs, ys] amplitudes for the first state or geometry.

  • xy2 (list, optional) – [xs, ys] amplitudes for the second state or geometry.

  • coeff1 (numpy.ndarray) – Molecular orbitals of the first state or geometry.

  • coeff2 (numpy.ndarray, optional) – Molecular orbitals of the second state, geometry, or spin channel.

Returns:

Difference one-particle density matrix.

Return type:

numpy.ndarray

get_transition_dm(xy, coeff1, coeff2=None, scale=2.0)[source]

calculate transition 1-particle density matrix bewteen ground and excited states from xy amplitudes

Parameters:
  • xy (list) – [xs, ys] amplitudes, where xs and ys are arrays with shape (nstates, nocc, nvir).

  • coeff1 (numpy.ndarray) – Ground-state molecular-orbital coefficients.

  • coeff2 (numpy.ndarray, optional) – Molecular-orbital coefficients for a different spin channel or geometry. Defaults to coeff1.

  • scale (float) – 2 for restricted and 1 for unrestricted cases.

Returns:

Transition one-particle density matrix.

Return type:

numpy.ndarray

lumeq.property.sapt_dispersion module

build_trans_density(mo_coeff, amps, itype='r', has_y=False)[source]
cal_sapt(mols, mo_coeffs, amps, energies, omega=None, itype='r')[source]
cal_sapt_r(mol, mo_coeffs, amps, nstates, omega=None)[source]

mol is the supermolecule

cal_sapt_u(mol, mo_coeffs, amps, nstates, omega=None)[source]

mol is the supermolecule

get_xys_in_ao(mo_coeff, xs, ys, has_y=False, scale=1)[source]
run_tddft(symbols, coords, charge=1, spin=1, functional='hf', basis='sto-3g')[source]

lumeq.property.wf_overlap module

cal_wf_overlap(Xm, Ym, Xn, Yn, Cm, Cn, S, itype='r')[source]

calculate wavefunction overlap between excited states at different nuclear configurations

cal_wf_overlap_r(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]

Calculate wavefunction overlap between excited states at different nuclear configurations for restricted case Ovlp = < Psi_m | Psi_n >

Matrix determinant lemma is used. vec1: S_vo S_oo^-1 in ov (transpose is used) vec2: S_oo^-1 S_ov in ov vec3: (S_vv - S_vo S_oo^-1 S_ov) in vv vec4: S_oo^-1 in oo

Parameters:
  • Xm (numpy.ndarray) – Excitation amplitudes at geometry m with shape (nroots, nocc, nvir).

  • Ym (numpy.ndarray) – De-excitation amplitudes with shape (nroots, nocc, nvir).

  • Xn (numpy.ndarray) – Excitation amplitudes at geometry n with shape (nroots, nocc, nvir).

  • Yn (numpy.ndarray) – De-excitation amplitudes with shape (nroots, nocc, nvir).

  • Cm (numpy.ndarray) – Molecular-orbital coefficients at geometry m with shape (nbasis, nbasis).

  • Cn (numpy.ndarray) – Molecular-orbital coefficients at geometry n with shape (nbasis, nbasis).

  • S (numpy.ndarray) – Overlap matrix between geometries m and n with shape (nbasis, nbasis).

Returns:

Wavefunction overlap matrix.

Return type:

numpy.ndarray

cal_wf_overlap_r0(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]

slow version of wavefunction overlap of restricted case for checking

cal_wf_overlap_sf(Xm, Ym, Xn, Yn, Cm, Cn, S, extype=0)[source]

calculate wavefunction overlap between excited states at different nuclear configurations for ro spin-flip case

cal_wf_overlap_u(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]

calculate wavefunction overlap between excited states at different nuclear configurations for unrestricted case

change_phase(x0, y0, x1, y1, mo0, mo1, ovlp)[source]

change the phase of excited states at geometry 1 to match that at geometry 0

sign_fixing(mat)[source]

fix the sign indeterminacy of wavefunction overlap matrix refer Zhou, Subotnik JCTC 2020, 10.1021/acs.jctc.9b00952

Module contents