utils module

Useful functions.

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

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
utils.add_mad(system, frame)

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

utils.alpha(zeta)

Alpha Parameter for ueg.

Parameters:zeta (int) –
Returns:alpha
Return type:float
utils.ef(rs, zeta)

Fermi Energy for 3D UEG.

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

ef – Fermi Energy.

Return type:

float

utils.fermi_angle(u, k, q, mu, beta)

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

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

f_kq – Fermi factor.

Return type:

float

utils.fermi_block(ek, mu, beta)

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

utils.fermi_factor(ek, mu, beta)
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

utils.gamma(rs, theta, zeta)

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

utils.get_git_revision_hash()

Return git revision.

Returns:sha1 – git hash with -dirty appended if uncommitted changes.
Return type:string
utils.kinetic_cutoff(ne, theta)

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

utils.kinetic_plane_waves(ne, theta)

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

utils.madelung_approx(system)
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:system (class) – system being studied.
Returns:v_M – Madelung potential (in Hartrees).
Return type:float
utils.magic_numbers(system)
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
utils.plasma_freq(rs)

Plasma frequency for 3D UEG.

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

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

utils.step(a, b)

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

Parameters:
  • b (a,) – Arguments of step function.
  • Returns
  • --------
  • theta(a-b) (float) – Heaviside step function.
utils.step_angle(u, k, q, kf)

Heaviside steb function for k+q.

Parameters:
  • b (a,) – Arguments of step function.
  • Returns
  • --------
  • theta(a-b) (float) – Heaviside step function.
utils.theta_gamma(gamma, rs, zeta)

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

utils.vq(q)

Coulomb interaction.

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

Coulomb interaction.

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