uegpy package

Submodules

uegpy.dielectric module

Dielectric / Density response functions.

uegpy.dielectric.im_chi_rpa(omega, q, beta, mu)[source]

Imaginary part of rpa density-density response function.

Parameters:
  • omega (float) – frequency
  • q (float) – (modulus) of wavevector considered.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
Returns:

chi_rpa – Imaginary part of RPA density-density response function.

Return type:

float

uegpy.dielectric.im_chi_rpa0(omega, q, kf, zeta)[source]

Imaginary part of \(T=0\) rpa density-density response function.

Parameters:
  • omega (float) – frequency
  • q (float) – (modulus) of wavevector considered.
  • kf (float) – Fermi wavevector.
  • zeta (int) – Spin polarisation.
Returns:

chi_rpa – Imaginary part of RPA density-density response function.

Return type:

float

uegpy.dielectric.im_chi_tanaka(x, rs, theta, eta, zeta, l)[source]

Imaginary part of RPA dielectric function in dimensionless form.

Taken from Tanaka and Ichimary, Phys. Soc. Jap, 55, 2278 (1986).
Parameters:
  • x (float) – Momentum considered i.e., k/k_F.
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • eta (float) –
    math:eta*mu
  • zeta (int) – Spin polarisation.
  • l (int) – Matsubara frequency.
Returns:

Im(chi) – Imaginary part of dielectric function in the RPA.

Return type:

float

uegpy.dielectric.im_eps(omega, q, beta, mu, zeta)[source]
uegpy.dielectric.im_lind(omega, q, beta, mu)[source]

Imaginary part of free-electron Lindhard density-density response function.

Parameters:
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • q (float) – (modulus) of wavevector considered.
  • omega (float) – frequency
Returns:

im_chi – Imaginary part of thermal Lindard function.

Return type:

float

uegpy.dielectric.im_lind0(omega, q, kf)[source]

Imaginary part of Lindhard Dielectric function at \(T = 0\).

Note this is \(\mathrm{Im}\left[\chi_{0\sigma}(\mathbf{q}, \omega)\right]\)
Parameters:
  • q (float) – (modulus) of wavevector considered.
  • omega (float) – Frequency.
  • kf (float) – Fermi wavevector.
Returns:

im_chi_0 – Real part of Lindhard dielectric function.

Return type:

float

uegpy.dielectric.im_rpa_dielectric0(omega, q, kf, zeta)[source]

Imaginary part of the \(T=0\) RPA dielectric function.

Parameters:
  • omega (float) – frequency
  • q (float) – (modulus) of wavevector considered.
  • kf (float) – Fermi wavevector.
  • zeta (int) – Spin polarisation.
Returns:

re_eps – Real part of rpa dielectric function.

Return type:

float

uegpy.dielectric.lindhard_matsubara(x, rs, theta, eta, zeta, l)[source]

Dimensionless Lindhard function function factor.

Taken from Tanaka and Ichimaru J. Phys. Soc. Jap, 55, 2278 (1986).

For large l or x we use the asyptotic form of

\[\phi(x, l) = \frac{4 x^2}{3(2\pi l \Theta)^2 + x^4} + \mathcal{O}(x^{-4}, l^{-4})\]
Parameters:
  • x (float) – Momentum considered i.e., k/k_F.
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • eta (float) – \(\beta\mu\)
  • zeta (int) – Spin polarisation.
  • l (int) – Matsubara frequency.
Returns:

chi(x, l) – Lindhard function evaluated at frequency l (for imaginary frequencies).

Return type:

float

uegpy.dielectric.re_eps(omega, q, beta, mu, zeta)[source]
uegpy.dielectric.re_lind(omega, q, beta, mu)[source]

Real part of free-electron Lindhard density-density response function.

Parameters:
  • omega (float) – frequency
  • q (float) – (modulus) of wavevector considered.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
Returns:

re_chi – Imaginary part of thermal Lindard function.

Return type:

float

uegpy.dielectric.re_lind0(omega, q, kf)[source]

Real part of Lindhard Dielectric function at \(T = 0\).

Note this is \(\mathrm{Re}\left[\chi_{0\sigma}(\mathbf{q}, \omega)\right]\)
Parameters:
  • omega (float) – Frequency.
  • q (float) – (modulus) of wavevector considered.
  • kf (float) – Fermi wavevector.
Returns:

re_chi_0 – Real part of Lindhard dielectric function.

Return type:

float

uegpy.dielectric.re_rpa_dielectric0(omega, q, kf, zeta)[source]

Real part of the \(T=0\) RPA dielectric function.

Parameters:
  • omega (float) – frequency
  • q (float) – (modulus) of wavevector considered.
  • kf (float) – Fermi wavevector.
  • zeta (int) – Spin polarisation.
Returns:

re_eps – Real part of rpa dielectric function.

Return type:

float

uegpy.finite module

Evaluate properties of system with a finite particle number

uegpy.finite.canonical_partition_function(system, beta)[source]

Calculate canonical partition function from single particle eigenvalues.

Warning: This gets very expensive very fast.
Parameters:system (class) – system class.
Returns:
  • U (float) – Internal energy.
  • Z (float) – Canonical partition function.
uegpy.finite.centre_of_mass_obsv(system, beta)[source]

Calculate centre of mass partition function and total energy.

Parameters:
  • system (class) – System class containing system information.
  • beta (float) – Inverse temperature.
Returns:

  • E_tot (float) – Total energy contribution from centre of mass motion.
  • Z (float) – Centre of mass partition function.

uegpy.finite.check_self_consist(sp_new, sp_old)[source]

Check self consistency for array

Parameters:
  • sp_new (list) – new single particle eigenvalues.
  • sp_old (list) – old single particle eigenvalues.
Returns:

de – cumulative difference between new and old eigenvalues.

Return type:

float

uegpy.finite.chem_pot_sum(system, eigs, beta)[source]

Find the chemical potential for finite system.

Parameters:
  • system (class) – System class containing system information.
  • beta (float) – Inverse temperature.
Returns:

mu – Chemical potential.

Return type:

float

uegpy.finite.energy_sum(beta, mu, spval, pol)[source]

Calculate internal energy for free electron gas.

Parameters:
  • beta (float) – Inverse temperature.
  • mu (float) – chemical potential.
  • spval (list of lists) – Single particle eigenvalues and degeneracies.
  • pol (int) – Polarisation.
Returns:

Nav - ne – Difference between expected and actual number of electrons.

Return type:

float

uegpy.finite.fthf_ex_energy(system, beta)[source]

Evaluate finite temperature Hartree-Fock internal energy.

Todo : notes + grand canonical equivalent.
Parameters:
  • system (class) – System being studied.
  • beta (float) – Inverse Temperature.
Returns:

U_tx – Finite temperature Hartree-Fock internal energy.

Return type:

float

uegpy.finite.fthf_self_consistency(system, beta, mu)[source]
Run self consistency loop to find finite temperature Hartree-Fock

eigenvalues and chemical potential.

Todo: Check this makes sense + document better, integrate with Monte Carlo.

Parameters:
  • system (class) – System being studied.
  • beta (float) – Inverse Temperature.
  • mu (float) – Chemical potential.
Returns:

  • iterations (tuple) – Number of iterations required to find self consistency of mu and single particle eigenvalues.
  • sp_x (list) – Single particle eigenvalues.
  • mu_x (float) – Hartree-Fock chemical potential.

uegpy.finite.gc_part_func(sys, cpot, beta)[source]

Grand canonical partition function for finite system.

\[Z_{GC} = \prod_i (1 + e^{-\beta(e_i-\mu)})\]
Parameters:
  • system (class) – System being studied.
  • beta (float) – Inverse Temperature.
Returns:

Z_GC – Grand canonical partition function.

Return type:

float

uegpy.finite.hf_potential(occ, kvecs, L)[source]

Hartree-Fock exchange energy for given determinant

Parameters:
  • occ (list) – List of occupied single particle orbitals.
  • kvecs (list) – kvectors.
  • L (float) – Box lenght.
Returns:

ex – Exchange energy.

Return type:

float

uegpy.finite.hfx_potential(spvals, kvecs, ki, beta, mu, L)[source]

Finite temperature Hartree-Fock potential.

Parameters:
  • system (class) – System begin studied.
  • ki (list) – kvector associated with potential.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
Returns:

ex – exchange potential.

Return type:

float

uegpy.finite.hfx_sum(system, beta, mu)[source]

Evaluate the HF exchange contribution as a summation.

Parameters:
  • system (class) – system variables.
  • beta (float) – beta value
  • mu (float) – chemical potential at beta
Returns:

hfx – hf exchange energy

Return type:

float

uegpy.finite.nav_deriv(mu, ne, spval, beta, pol)[source]

Calculate average number of electrons.

Parameters:
  • mu (float) – chemical potential.
  • ne (int) – Number of electrons.
  • spval (list of lists) – Single particle eigenvalues and degeneracies.
  • beta (float) – Inverse temperature.
  • pol (int) – Polarisation.
Returns:

N – Number of electrons.

Return type:

float

uegpy.finite.nav_diff(mu, ne, spval, beta, pol)[source]

Calculate difference between expected and average number of electrons.

Parameters:
  • mu (float) – chemical potential.
  • ne (int) – Number of electrons.
  • spval (lists of lists) – Single particle eigenvalues and degeneracies.
  • beta (float) – Inverse temperature.
  • pol (int) – Polarisation.
Returns:

Nav - ne – Difference between expected and actual number of electrons.

Return type:

float

uegpy.finite.nav_sum(mu, ne, spval, beta, pol)[source]

Calculate average number of electrons.

Parameters:
  • mu (float) – chemical potential.
  • ne (int) – Number of electrons.
  • spval (list of lists) – Single particle eigenvalues and degeneracies.
  • beta (float) – Inverse temperature.
  • pol (int) – Polarisation.
Returns:

N – Number of electrons.

Return type:

float

uegpy.fits module

Various approximate fits to the UEG or OCP

uegpy.fits.PDWParams()[source]
uegpy.fits.classical_ocp(system, beta)[source]
Evaluate the classical excess energy using the parametrised fit given by
    1. Hansen PRA 8, 6 1973.
Parameters:
  • system (class) – System being studied.
  • beta (float) – Inverse Temperature.
Returns:

U_xc – Excess internal energy for classical OCP.

Return type:

float

uegpy.fits.ksdt(rs, t, zeta)[source]

Fit to RPIMC data of Brown et al (Phys. Rev. Lett. 110, 146405 (2013)) from Karasiev, Sjostrom, Dufty and Trickey, PRL 112, 076403. Please cite these guys.

The KSDT fit is given as:

\[f_{\mathrm{xc}}^{\zeta}(r_s, t) = -\frac{1}{r_s}\frac{\omega_{\zeta}a(t) + b_{\zeta}(t)r_s^{1/2} + c_{\zeta}(t)r_s}{1+d_{\zeta}(t)r_s^{1/2} + e_{\zeta}(t)r_s}\]
Parameters:
  • rs (float) – Density desired.
  • zeta (int) – Spin polarisation.
  • t (float) – Reduced temperature (\(T/T_F\))
Returns:

f_xc – Exchange-correlation free energy per-particle.

Return type:

float

uegpy.fits.ksdt_uxc(rs, t, zeta, dt=0.0001)[source]

Evaluate u_xc from KSDT fit using finite differences.

\[u_{\mathrm{xc}} = f_{\mathrm{xc}} - \Theta \left(\frac{\partial f_{\mathrm{xc}}}{\partial \Theta}\right)_{r_s}\]
Parameters:
  • rs (float) – Density desired.
  • t (float) – Reduced temperature (\(T/T_F\))
  • zeta (int) – Spin polarisation.
  • dt (float (optional)) – Temperature difference to carry out derivative. Default: 0.0001.
Returns:

u_xc – Exchange-correlation internal energy per-particle.

Return type:

float

uegpy.fits.ksdt_v(rs, t, zeta, dr=0.0001)[source]

Evaluate u_xc from KSDT fit using finite differences.

\[v = f_{\mathrm{xc}} + r_s \left(\frac{\partial f_{\mathrm{xc}}}{\partial r_s}\right)_{\Theta}\]
Parameters:
  • rs (float) – Density desired.
  • t (float) – Reduced temperature (\(T/T_F\))
  • zeta (int) – Spin polarisation.
  • dt (float (optional)) – Temperature difference to carry out derivative. Default: 0.0001.
Returns:

v – Potential energy per-particle.

Return type:

float

uegpy.fits.pdw(rs, t, zeta)[source]
Perrot, Dharma-wardana (Phys. Rev. A 30, 2619 (1984).)fit to RPA
correlation free energy of unpolarised UEG.
Parameters:
  • rs (float) – Density Parameter.
  • zeta (int) – Spin polarisation.
Returns:

f_c – Correlation free energy energy.

Return type:

float

uegpy.fits.pdwfxc00(rs, theta, zeta)[source]

Parametrisation of f_xc from CHNC data for the UEG.

From Perrot, Dharma-wardana, 62, 16536 (2000).

Warning

This does not seem to match with Table. IV from the reference. Something is completely off for unpolarized case.

Parameters:
  • rs (float) – Wigner-Seitz Radius.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation
Returns:

f_xc – Exchange-correlation free energy.

Return type:

float

uegpy.fits.pz81(rs, zeta)[source]

Perdew-Zunger parametrization of the ground state correlation energy of the UEG.

Ref: PRB, 23, 5048 (1981).
Parameters:
  • rs (float) – Wigner-Seitz radius
  • zeta (int) – Spin polarisation.
Returns:

E_c – Correlation energy of 3D UEG parametrised to CA QMC data.

Return type:

float

uegpy.fits.ti_STLS_params(t, zeta)[source]

Fitting parameters for \(T>0\) STLS properties.

Taken from Tanaka & Ichimaru J. Phys. Soc. Jpn. 55, 2278 (1986).
Parameters:
  • t (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

(a, b, c, d, e) – Fitting parameters.

Return type:

floats

uegpy.fits.ti_fxc(rs, t, pol)[source]

Excess free energy (over kT) from STLS.

Taken from Tanaka & Ichimaru J. Phys. Soc. Jpn. 55, 2278 (1986).
Parameters:
  • t (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

(a, b, c, d, e) – Fitting parameters.

Return type:

floats

uegpy.fits.ti_txc(rs, t, pol)[source]

Excess kinetic energy (over kT) from STLS.

Taken from Tanaka & Ichimaru J. Phys. Soc. Jpn. 55, 2278 (1986).
Parameters:
  • t (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

(a, b, c, d, e) – Fitting parameters.

Return type:

floats

uegpy.fits.ti_uxc(rs, t, pol)[source]
Excess internal energy from STLS
Taken from Tanaka & Ichimaru J. Phys. Soc. Jpn. 55, 2278 (1986).
Parameters:
  • t (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

(a, b, c, d, e) – Fitting parameters.

Return type:

floats

uegpy.fits.ti_v(rs, t, pol)[source]

Potential energy from STLS.

Taken from Tanaka & Ichimaru J. Phys. Soc. Jpn. 55, 2278 (1986).
Parameters:
  • t (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

(a, b, c, d, e) – Fitting parameters.

Return type:

floats

uegpy.fits.vwn_rpa(rs, zeta)[source]
Vosko Wilk Nusair fit to RPA correlation energy of UEG. Can. J. Phys.

58, 1200 (1980).

Currently unpolarised only.

Parameters:
  • rs (float) – Density Parameter.
  • zeta (int) – Spin polarisation.
Returns:

ec – Correlation energy.

Return type:

float

uegpy.infinite module

Evaluate properties of electron gas in thermodynamic limit using grand canonical ensemble

uegpy.infinite.chem_pot(rs, beta, ef, zeta)[source]

Find the chemical potential for infinite system.

Parameters:
  • rs (float) – Wigner-Seitz radius.
  • beta (float) – Inverse temperature.
  • ef (float) – Fermi energy.
  • zeta (int) – Spin polarisation.
Returns:

mu – Chemical potential.

Return type:

float

uegpy.infinite.exchange_energy(rs, beta, mu, zeta)[source]

Exchange contribution to internal energy

Turns out to be:

\[u_\mathrm{x} = \frac{3}{2} \mu_\mathrm{x} - f_{\mathrm{x}}\]
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • zeta (int) – Spin polarisation
Returns:

u_x – Exchange energy.

Return type:

float

uegpy.infinite.f_x(rs, beta, mu, zeta)[source]

First-order exchange contribution to free energy:

Uses the convenient form for the exchange integral from: Horovitz and Thieberger, Physica 71, 99 (1974).

\[f_\mathrm{x} = -(2-\zeta) \frac{r_s^3}{3\pi^2\beta^2} \int_{-\infty}^{\eta_0} d\eta I_{-1/2}(\eta)\]
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
Returns:

hfx – Grand potential (Helmholtz Free energy.)

Return type:

float

uegpy.infinite.fermi_integral(nu, eta)[source]

Standard Fermi integral \(I(\eta, \nu)\), where:

\[I(\eta, \nu) = \int_0^{\infty} \frac{x^{\nu}}{(e^{x-\eta}+1)} dx\]
Parameters:
  • eta (float) – \(\beta\mu\).
  • nu (float) – Order of integral.
Returns:

:math:`I(eta, nu)` – Fermi integral.

Return type:

float

uegpy.infinite.fermi_integrand(x, nu, eta)[source]

Integrand of standard Fermi integral I(eta, nu), where:

\[I(\eta, \nu) = \int_0^{\infty} \frac{x^{\nu}}{(e^{x-\eta}+1)} dx\]
Parameters:
  • x (float) – integration variable.
  • nu (float) – Order of integral.
  • eta (float) – \(\beta\mu\).
uegpy.infinite.fermi_integrand_deriv(x, nu, eta)[source]
Derivative of integrand of standard Fermi integral \(I(eta, nu)\)

wrt beta.

TODO : check this.

Parameters:
  • x (float) – integration variable.
  • nu (float) – Order of integral.
  • eta (float) – \(\beta\mu\).
uegpy.infinite.gc_free_energy(beta, mu, rs)[source]

Free energy:

\[U = (2-\zeta) \frac{8\sqrt{2}}{9\pi}r_s^3\beta^{-5/2} I(5/2, \eta)\]
Parameters:
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • rs (float) – Wigner-Seitz radius.
Returns:

Omega – Ideal grand potential.

Return type:

float

uegpy.infinite.hfx_integrand(eta, power)[source]

Integrand of first order exchange contribution to internal energy.

\[I_{-1/2}(\eta_0)^2\]
Parameters:eta (float) – beta * mu, for beta = 1 / T and mu the chemical potential.
Returns:I(-1/2, nu)^2 – Fermi integral.
Return type:float
uegpy.infinite.ideal_kinetic_energy(beta, mu, rs, zeta)[source]

Total energy of ideal gas (Kinetic only):

\[U_0 = (2-\zeta) \frac{2\sqrt{2}}{3\pi}r_s^3\beta^{-5/2} I(3/2, \eta)\]
Parameters:
  • eta (float) – beta * mu, for beta = 1 / T and mu the chemical potential.
  • nu (float) – Order of integral.
Returns:

I(eta, nu) – Fermi integral.

Return type:

float

uegpy.infinite.mu_x(rs, beta, mu, zeta)[source]

First order exchange correction to the chemical potential.

Turns out to be:

\[\mu_\mathrm{x} = -\frac{1}{\sqrt{2}\pi}\beta^{-1/2}I_{-1/2}(\eta_0)\]
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • zeta (int) – Spin polarisation
Returns:

corr – Correction term for inversion process.

Return type:

float

uegpy.infinite.nav(beta, mu, zeta)[source]

Average density i.e. \(N/V\).

Parameters:
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • zeta (int) – Spin polarisation.
Returns:

rho – Average density.

Return type:

float

uegpy.infinite.nav_diff(mu, beta, rs, zeta, method=<function nav>, it=1)[source]

Deviation of average density for given \(\mu\) from true value.

Parameters:
  • mu (float) – Chemical potential.
  • beta (float) – Inverse temperature.
  • rho (float) – True density.
  • zeta (int) – Spin polarisation.
Returns:

dev\(n(\mu) - n\).

Return type:

float

uegpy.infinite.rpa_correlation_free_energy(rs, theta, zeta, lmax, qmax)[source]

RPA correlation free energy.

Calculated as given in Tanaka and Ichimaru, Phys. Soc. Jap, 55, 2278 (1986) as:

\[\frac{\Omega_{\mathrm{c}}}{N} = -\frac{1}{2(2\pi)^3n\beta}\sum_l\int d\mathbf{q} \Big[\log[1-v_{\mathbf{q}}\chi^0(\mathbf{q},z_l)]+ v_{\mathbf{q}}\chi^0(\mathbf{q}, z_l)\Big]\]
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • lmax (int) – Maximum Matsubara frequency to include.
Returns:

f_c – Exchange correlation free energy.

Return type:

float

uegpy.infinite.rpa_v_tanaka(rs, theta, zeta, nmax=10000, qmax=5, correction=True)[source]

Evaluate RPA electron-electron (potential) energy.

Taken from Tanaka & Ichimaru JPSJ 55, 2278 (1986) and benchmarked against this.
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • lmax (int) – Maximum Matsubara frequency to include.
  • qmax (float) – Maximum qvector to integrate up to before using asymptotic form.
Returns:

V – Potential energy.

Return type:

float

uegpy.infinite.rpa_xc_free_energy(rs, theta, zeta, lmax, qmax=6.0)[source]

RPA XC free energy as given in Phys. Soc. Jap, 55, 2278 (1986).

Parameters:
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • lmax (int) – Maximum Matsubara frequency to include.
Returns:

U_xc – Exchange-Correlation energy.

Return type:

float

uegpy.monte_carlo module

Simple Monte Carlo routines for evaluating in the canonical ensemble.

uegpy.monte_carlo.create_orb_list(probs, ne)[source]

Create orbital list with \(N\) electrons

Parameters:
  • probs (list) – Single particle probabilities (fermi factors).
  • ne (int) – Number of electrons.
Returns:

  • gen (boolean) – True if configuration with ne electrons was generated.
  • selected_orbs (list) – Selected orbitals.

uegpy.monte_carlo.gc_correction_free_energy(sys, cpot, beta, delta, delta_error)[source]
Canonical correction to free electron grand canonical partition function.

Assumption, \(Z_{GC}(N) / Z_{GC} = \delta\), so

\[-kT \log\delta = -kT \log Z_{GC}(N) + kT \log Z_{GC}.\]

Therefore,

\[-kT \log Z_N = -kT \log \delta - kT \log Z_{GC} + \mu N,\]

or

\[F^0_N = \Omega + \Delta(N) + \mu N.\]
Parameters:
  • sys (class) – System being studied.
  • mu (float) – Chemical potential.
  • beta (float) – Inverse temperature.
  • delta (float) – naccept/ntotal.
  • delta_error (float) – standard error in delta.
Returns:

F_N – Canonical free electron Helmholtz free energy.

Return type:

float

uegpy.monte_carlo.sample_canonical_energy(system, beta, nmeasure)[source]

Sample canonical energy of a non-interacting system.

Properties of the non-interacting canonical system can be evaluated by simply discarding configurations generated in grand canonical ensemble whose particle number is not equal to the expected number of particles.
Parameters:
  • system (class) – System being studied.
  • beta (float) – Inverse temperature.
  • nmeasure (int) – Number of attempted Monte Carlo moves.
Returns:

frame – Frame containing estimates for properties of system at temperature theta.

Return type:

pandas.DataFrame

uegpy.size_corrections module

Utilities for finite size corrections.

uegpy.size_corrections.bcdc(rs, theta, zeta, N)[source]

Potential energy correction using the BCDC finite size correction for V.

Ref: Ethat W. Brown et al. Phys. Rev. Lett. 110, 146405 (2013).
Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • N (int) – Number of electrons.
Returns:

delta_V – RPA finite size correction.

Return type:

float

uegpy.size_corrections.conv_fac(nmax, alpha)[source]
Convergence factor for Hartree–Fock size corrections from Drummond et al.
Warning: Exceptionally slow.
Parameters:
  • nmax (int) – Maximum kvector to consider.
  • alpha (float) – alpha parameter
Returns:

C_HF – Convergence constant.

Return type:

float

uegpy.size_corrections.f_c_summation(system, theta, eta, lmax, qvals)[source]
uegpy.size_corrections.f_x_integral(rs, beta, mu, zeta, qmax)[source]
uegpy.size_corrections.f_x_summation(rs, beta, mu, zeta, qvals, L)[source]
uegpy.size_corrections.f_xc_summation(system, theta, eta, lmax, qvals)[source]
uegpy.size_corrections.fxc_correction(rs, theta, zeta, N)[source]

Free energy correction using the BCDC finite size correction for V

Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • N (int) – Number of electrons.
Returns:

delta_f_xc(V) – RPA finite size correction.

Return type:

float

uegpy.size_corrections.fxc_correction_quad(rs, dv)[source]

Evalute correction to exchange-correlation free energy.

Parameters:
  • rs (list) – Grid of densities.
  • dv (list) – Corresponding grid of potential energy size corrections.
Returns:

df_xc – Size correction to f_xc.

Return type:

float

uegpy.size_corrections.mad_integral(theta, eta, zeta, kf, kmin, kmax, nmax)[source]

Evaluate integral of uniform distribution of point charges.

Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • kf (float) – Fermi wave vector.
  • kmin (float) – Lower limit.
  • kmax (float) – Upper limit.
  • lmax (int) – Upper limit on Matsubara sum.
Returns:

v_s – Potential energy from static distribution of point charges.

Return type:

float

uegpy.size_corrections.mad_summation(qvals, L)[source]

Evaluate sum of uniform distribution of point charges.

Parameters:
  • qvals (list) – magnitude of kpoints to evaluate structure factor at.
  • L (float) – Box length.
Returns:

v_s – Contribution to potential energy from periodically repeated point charges.

Return type:

float

uegpy.size_corrections.sk_integral(rs, theta, eta, zeta, kf, kmin, kmax, lmax)[source]

Integral over RPA structure factor.

Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • kf (float) – Fermi wave vector.
  • kmin (float) – Lower limit.
  • kmax (float) – Upper limit.
  • lmax (int) – Upper limit on Matsubara sum.
Returns:

intg – Integral over s_q.

Return type:

float

uegpy.size_corrections.v_integral(rs, theta, eta, zeta, kf, kmin, kmax, lmax)[source]

Potential energy evaluated from RPA structure factor.

Useful to evaluate size corrections.
Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • kf (float) – Fermi wave vector.
  • kmin (float) – Lower limit.
  • kmax (float) – Upper limit.
  • lmax (int) – Upper limit on Matsubara sum.
Returns:

V – RPA potential energy.

Return type:

float

uegpy.size_corrections.v_summation(rs, theta, eta, zeta, kf, lmax, qvals, L)[source]

Potential energy evaluated at discrete kpoints.

Parameters:
  • rs (float) – Wigner-Seitz parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
  • kf (float) – Fermi wave vector.
  • lmax (int) – Upper limit on Matsubara sum.
  • qvals (list) – magnitude of kpoints to evaluate structure factor at.
  • L (float) – Box length.
Returns:

V

RPA potential energy evalutes in a finite box (assuming the structure factor

is converged).

Return type:

float

uegpy.structure module

Structure factors at various levels of theory.

uegpy.structure.bcdc(q, rs, theta, zeta)[source]

Structure factor using leading order RPA form.

From Brown, Clark, Du Bois, Ceperley PRL 2013.
Parameters:
  • q (float) – Wavevector
  • rs (float) – Density parameter.
  • theta (float) – Temperature.
  • zeta (int) – Spin polarisation.
Returns:

S(q) – BCDC structure factor.

Return type:

float

uegpy.structure.bijl_feynman(q, kf, zeta)[source]

Bijl-Feynman structure factor.

Parameters:
  • q (float) – Wavevector
  • kf (float) – Fermi wavevector.
Returns:

S(q) – Bijl-Feynman structure factor.

Return type:

float

uegpy.structure.hartree_fock(q, rs, beta, mu, zeta)[source]

Static structure factor at Hartree–Fock level:

\[S(q) = 1 - \frac{r_s^3}{3\pi} \int_0^{\infty} dk k^2 f_k \int_{-1}^{1} du \frac{1}{e^{\beta(\frac{1}{2}(k^2+q^2+2kqu)}+1}\]
Parameters:
  • q (float) – kvalue to calculate structure factor at.
  • rs (float) – Wigner-Seitz radius.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • zeta (int) – Spin polarisation
Returns:

S(q) – Static structure factor.

Return type:

float

uegpy.structure.hartree_fock_finite(q, system, mu, beta)[source]
uegpy.structure.hartree_fock_ground_state(q, kf)[source]

Analytic static structure factor at Hartree–Fock level in the ground state:

\[\begin{split}S(q) = \begin{cases} \frac{1}{2} \Big(\frac{3}{4} \frac{q}{q_F} - \frac{1}{16} \Big(\frac{q}{q_F}\Big)^3\Big) & \text{if} \ q \le 2q_F \\ \frac{1}{2} & \text{if} \ q > 2q_F \end{cases}\end{split}\]
Parameters:
  • q (float) – kvalue to calculate structure factor at.
  • kf (float) – Fermi wavevector.
Returns:

S(q) – Static structure factor.

Return type:

float

uegpy.structure.hartree_fock_ground_state_integral(q, rs, kf)[source]

Static structure factor at Hartree–Fock level in the ground state:

\[S(q) = 1 - \frac{r_s^3}{3\pi} \int_0^{\infty} dk k^2 \theta(k_F-k) \int_{-1}^{1} du \theta(k_F-(k^2+2kqu+q^2))\]
Parameters:
  • q (float) – kvalue to calculate structure factor at.
  • rs (float) – Wigner-Seitz radius.
  • kf (float) – Fermi wavevector.
Returns:

S(q) – Static structure factor.

Return type:

float

uegpy.structure.q0_plasmon(q, rs)[source]

Plasmon structure factor.

\[S(q) = \frac{q^2}{2\omega_p}\]
Parameters:
  • q (float) – Wavevector
  • rs (float) – Density parameter.
Returns:

S(q) – Plasmon structure factor.

Return type:

float

uegpy.structure.rpa(q, beta, mu, rs)[source]

Finite temperature RPA static structure factor evulated as:

\[S(q) = -\frac{1}{\pi} \int_{-\infty}^{\infty} \mathrm{Im}[\chi^{\mathrm{RPA}}(q, \omega)] \coth(\beta\omega/2)\]

Warning

This uses a naive approach which directly evaluates \(\mathrm{Im}[\chi^{\mathrm{RPA}}]\). Better results can be found using rpa_matsubara. In particular this routine will likely miss the plasmon contribution to the structure factor which dominates for some \(q_c(r_s, \Theta)\) .

Parameters:
  • q (float) – (modulus) of wavevector considered.
  • beta (float) – Inverse temperature.
  • mu (float) – Chemical potential.
  • rs (float) – Density parameter.
Returns:

s_q – Static structure factor.

Return type:

float

uegpy.structure.rpa_ground_state(q, kf, rs)[source]

Zero temperature RPA static structure factor.

\[S(q) = -\frac{1}{\pi} \int_{-\infty}^{\infty} d \omega \mathrm{Im}[\chi^{\mathrm{RPA}}(q, \omega)]\]
Parameters:
  • q (float) – (modulus) of wavevector considered.
  • mu (float) – Chemical potential.
Returns:

s_q – Static structure factor.

Return type:

float

uegpy.structure.rpa_matsubara(q, rs, theta, eta, zeta, lmax, qmax=5)[source]

RPA static structure factor evaluated using matsubara frequencies.

\[S(q) = -\frac{1}{\pi} \int_{-\infty}^{\infty} d \omega \mathrm{Im}[\chi^{\mathrm{RPA}}(q, \omega)]\]
Parameters:
  • q/qf (float) – (modulus) of wavevector considered.
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • eta (float) – \(eta\mu\)
  • zeta (int) – Spin polarisation.
  • nmax (int) – Maximum number of matsubara frequencies to include.
Returns:

s_q – Static structure factor.

Return type:

float

uegpy.ueg_sys module

System properties.

class uegpy.ueg_sys.System(rs, ne, ecut, zeta)[source]

System Properties - Everything is measured in Hartree atomic units.

rs

float – Wigner-Seitz radius.

ne

int – Number of electrons.

ecut

float – Plane wave cutoff.

zeta

int – Spin polarisation = 1 for fully polarised case, 0 for unpolarised.

L

float – Box length.

kfac

float – kspace grid spacing.

kf

float – Fermi wavevector.

ef

float – Fermi energy

spval

list – containing single particle eigenvalues, sorted in increasing value of kinetic energy.

kval

list – Plane wave basis vectors, sorted in increasing value of kinetic energy.

deg_e

list of lists – Compressed list of spval containing unique eigenvalues and their degeneracy.

M

int – Number of plane waves in our basis.

compress_spval(spval)[source]
Compress the single particle eigenvalues so that we only consider unique
values which vastly speeds up the k-space summations required.
Parameters:spval (list) – list containing single particle eigenvalues
Returns:def_e – Compressed single-particle eigenvalues.
Return type:list of lists
sp_energies(kfac, ecut)[source]
Calculate the allowed kvectors and resulting single particle eigenvalues
which can fit in the sphere in kspace determined by ecut.
Parameters:
  • kfac (float) – kspace grid spacing.
  • ecut (float) – energy cutoff.
Returns:

  • spval (list) – List containing single particle eigenvalues.
  • kval (list) – List containing basis vectors.

uegpy.utils module

Useful functions.

uegpy.utils.add_frame(f1, f2, val1, op='+', val2=None, label=None, err=False)[source]

Add or subtract two frames and take care of errorbars.

Parameters:f1,f2 (pandas.DataFrame) – Frames to add/subtract.
Returns:f – f1 +/- f2
Return type:pandas.DataFrame
uegpy.utils.add_mad(system, frame)[source]

Add Madelung constant to data.

Parameters:
  • system (class) – system being studied.
  • frame (pandas.DataFrame) – Frame containing total energies.
Returns:

frame – Frame with energies per particle including Madelung constant where appropriate.

Return type:

pandas.DataFrame

uegpy.utils.alpha(zeta)[source]

Alpha Parameter for ueg.

Parameters:zeta (int) –
Returns:alpha
Return type:float
uegpy.utils.calcT(rs, theta, zeta)[source]

Calculate temperature in Hartrees from Theta.

Parameters:
  • rs (float) – Wigner-Seitz radius.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarization.
Returns:

T – Temperature in Hartree atomic units.

Return type:

float

uegpy.utils.calc_density_parameters(Z, rho_m, A)[source]

Cacluate the density parameters of a real free electron system.

Parameters:
  • Z (int) – Valence (number of free electrons) in atom
  • rho_m (float) – Mass density of element.
  • A (float) – Atomic mass of element.
Returns:

  • rs (float) – Density parameter (in bohr).
  • n (float) – Electronic density (in g/cm^3).

uegpy.utils.ef(rs, zeta)[source]

Fermi Energy for 3D UEG.

Parameters:
  • rs (float) – Density parameter.
  • zeta (int) – Spin polarisation.
Returns:

ef – Fermi Energy.

Return type:

float

uegpy.utils.fermi_angle(u, k, q, mu, beta)[source]

Fermi factor for \(k + q\). Used for integration.

Parameters:
  • u (float) – Integration variable = \(\cos heta\).
  • k (float) – Magnitude of wavevectors
  • q (float) – Magnitude of wavevectors
  • mu (float) – Chemical potential.
  • beta (float) – Inverse temperature.
Returns:

f_kq – Fermi factor.

Return type:

float

uegpy.utils.fermi_block(ek, mu, beta)[source]

Usual fermi factor blocking factor, i.e., \(\bar{f}_k = 1-f_k\).

Parameters:
  • ek (float) – Single particle eigenvalue.
  • mu (float) – Chemical potential.
  • beta (float) – Inverse temperature.
Returns:

fb_k – Fermi blocking factor.

Return type:

float

uegpy.utils.fermi_factor(ek, mu, beta)[source]
Usual fermi factor:
\[f_k = \frac{1}{e^{\beta(\varepsilon_k-\mu)}+1}\]
Parameters:
  • ek (float) – Single particle eigenvalue.
  • mu (float) – Chemical potential.
  • beta (float) – Inverse temperature.
Returns:

f_k – Fermi factor.

Return type:

float

uegpy.utils.gamma(rs, theta, zeta)[source]

Classical plasma coupling parameter for 3D UEG

Parameters:
  • rs (float) – Density Parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

gamma – Coupling parameter.

Return type:

float

uegpy.utils.get_git_revision_hash()[source]

Return git revision.

Returns:sha1 – git hash with -dirty appended if uncommitted changes.
Return type:string
uegpy.utils.kf(rs, zeta)[source]

Fermi wavevector for 3D UEG.

Parameters:
  • rs (float) – Density parameter.
  • zeta (int) – Spin polarisation.
Returns:

kf – Fermi wavevector.

Return type:

float

uegpy.utils.kinetic_cutoff(ne, theta)[source]

Determine number of planewaves necessary to converge kinetic energy.

The kinetic energy converges exponentially once

\[\varepsilon_c \approx kT\]

The following extrapolates from a smaller system size to determine the cutoff necessary at any \(\Theta, N\) value as

\[\varepsilon_c(N,\Theta) = \alpha \varepsilon_c(19,8) (\Theta/8) (N/19)^{2/3}\]
Parameters:
  • ne (int) – Number of electrons
  • theta (float) – Reduced temperature.
Returns:

e_c – Cutoff required (units of (2pi/L)^2

Return type:

float

uegpy.utils.kinetic_plane_waves(ne, theta)[source]

Determine number of planewaves necessary to converge kinetic energy.

The kinetic energy converges exponentially once

\[M \approx N \Theta^{3/2}\]

The following extrapolates from a smaller system size to determine the cutoff necessary at any \(\Theta, N\) value as

\[M(N,\Theta) = (\Theta/8)^{3/2} M(19,8) (N/19)\]
Parameters:
  • ne (int) – Number of electrons
  • theta (float) – Reduced temperature.
Returns:

M – Number of planewaves required

Return type:

float

uegpy.utils.madelung_approx(rs, ne)[source]
Use expression in Schoof et al. (PhysRevLett.115.130402) for the
Madelung contribution to the total energy. Please cite these guys and L.M. Fraser et al. Phys. Rev. B 53, 1814 whose functional form they fitted to.
Parameters:
  • rs (float) – Wigner-Seitz radius.
  • ne (int) – Number of electrons.
Returns:

v_M – Madelung potential (in Hartrees).

Return type:

float

uegpy.utils.magic_numbers(system)[source]
Work out possible magic electron numbers (i.e. those that will fit in
a closed shell) below nmax
Parameters:system (class) – System being studied
Returns:pol – Polarised magic numbers. Unpolarised = 2 * pol
Return type:list
uegpy.utils.plasma_freq(rs)[source]

Plasma frequency for 3D UEG.

Parameters:rs (float) – Density parameter.
Returns:omega_p – Plasma frequency.
Return type:float
uegpy.utils.rs_gamma(gamma, theta, zeta)[source]

Find rs give a gamma and theta.

Parameters:
  • rs (float) – Density Parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

gamma – Coupling parameter.

Return type:

float

uegpy.utils.step(a, b)[source]

Heaviside steb function i.e., :math:` heta(a-b)`

Parameters:
  • a (float) – Argument of step function.
  • b (float) – Argument of step function.
Returns:

theta(a-b) – Heaviside step function.

Return type:

float

uegpy.utils.step_angle(u, k, q, kf)[source]

Heaviside steb function for k+q.

Parameters:
  • u (float) – Argument of step function.
  • k (float) – Argument of step function.
  • q (float) – Argument of step function.
  • kf (float) – Fermi Wave vector
Returns:

theta(kf - |a-b|) – Heaviside step function.

Return type:

float

uegpy.utils.theta_gamma(gamma, rs, zeta)[source]

Find theta give a gamma and ts.

Parameters:
  • rs (float) – Density Parameter.
  • theta (float) – Degeneracy temperature.
  • zeta (int) – Spin polarisation.
Returns:

gamma – Coupling parameter.

Return type:

float

uegpy.utils.vq(q)[source]

Coulomb interaction.

Parameters:q (float) – Magnitude of
Returns:vq – Coulomb interaction.
Return type:float
uegpy.utils.vq_vec(q)[source]

Coulomb interaction.

Parameters:q (array_like) – Magnitude of
Returns:vq – Coulomb interaction.
Return type:float

Module contents

uegpy can calculate various thermodynamic properties of the UEG.

The code is organised in various modules which can be combined to calculate useful quantities. Currently the following functionality is available:

  • Internal, potential and free energies for the the 3D-UEG as a function of

temperature at various levels of approximation. Currently we can do ideal, Hartree–Fock and RPA.

  • Dynamic properties such as density-density reposonse at any temperature.
  • Static and dynamic structure factors.

Most of these quantities can be calculated in the thermodynamic limit as well as for a finite number of electrons in the canonical and grand canonical ensemble.