pcask1d.src package

Submodules

pcask1d.src.density module

The module defines a particle density (probability distribution) and its various features/uses.

class pcask1d.src.density.Density(params, **kwargs)

Bases: object

The class representing a particle density

coefficients
static initial_guess(params)

Initial guess for the density as overlapping Gaussians of charge

norm()

The L1 norm of the density:

\[\int_{\Sigma} \rho(x) dx = N\]

pcask1d.src.hamiltonian module

This module contains the Hamiltonian. Each Hamiltonian is defined for a given k-point and density, with methods to extract various quantities such as total energy, wavefunctions, and so on.

class pcask1d.src.hamiltonian.Hamiltonian(density, **kwargs)

Bases: object

Class that implements the Hamiltonian object

eigendecomposition(params, num_states='all')

Calculate the num_states lowest lying eigenvectors and eigenvalues of the Hamiltonian

Parameters:
  • params (Parameters): input model for the system.
  • num_states (int): number of eigenvectors/eigenvalues to calculate.
Output:
  • wavefunctions (Wavefunction): a container of type Wavefunction with the lowest num_states eigenvectors, band indices, etc..
kinetic(params)

Kinetic operator in Fourier space: \(\hat{T} = \frac{1}{2} |G+k|^2\)

Parameters:
  • params (Parameters): input model for the system
representation(params)

Construct the representation (coefficients) of the Hamiltonian in the plane-wave basis: \(\langle G | H[\rho] | G' \rangle\)

Parameters:
  • params (Parameters): input model for the system
Output:
  • hamiltonian_representation (ndarray): the Hamiltonian matrix in plane-wave basis
total_energy(wavefunctions=None)

Total energy of a Hamiltonian: \(E = \langle \Psi | H | \Psi \rangle\)

v_ext(params)

The non-local external potential operator: \(v_{ext}(G-G')\) from \(\mathcal{F}(v_{ext}(x))\)

Parameters:
  • params (Parameters): input model for the system
v_h(params)

The Hartree potential in 1D

Parameters:
  • params (Parameters): input model for the system
v_xc(params)

Exchange-correlation potential

Parameters:
  • params (Parameters): input model for the system

pcask1d.src.main module

pcask1d.src.main.main()

pcask1d.src.params module

This module implements the parameters class, which carries the input model for the computation. An object of type Parameters is designed to be immutable and lead to a unique output.

class pcask1d.src.params.Parameters(**kwargs)

Bases: object

The use of this class is to generate a unique input for a DFT calculation. This includes parameters set by the user (e.g. scf_tol), and any derived quantities (e.g. num_planewaves).

big_planewave_grid

Plane-wave frequences up to 2*G_max

big_realspace_grid

Real space grid with double the sampling

cell

Size of the periodic unit cell, a, such that \(\Sigma \in [-a, a]\)

coulomb(charge: int, position: float) → numpy.ndarray

The external potential of an ion with a given charge (int) and position (float) regularised about the core with a softening parameter

element_charges
k_points

MP k-point grid within the first BZ: \(k \in [\frac{-\pi}{a}, \frac{\pi}{a}]\)

num_electrons

Number of electrons such that charge neutrality is enforced

num_planewaves

Number of plane-waves \(\{ | G \rangle \}\) in the basis set expansion

planewave_grid

Plane-wave frequences for plane-waves that fit in the unit cell: \(G = \frac{2 \pi n}{R}\)

positions
realspace_grid

Grid points in the delta function (real-space) basis set

scf_history_length

Number of iterations to include in the iterative SCF history of densities if using a quasi-Newton method for SCF convergence

scf_step_length

Damping parameter \(\alpha \in [0,1)\) applied to SCF steps

scf_tol

Convergence tolerance for fluctuations in the residual norm \(||R||\)

smearing_scheme(energy)

Ansatz for smearing the occupancies to prevent occupancy-induced instability in SCF iterations

soft

Defines the parameter c for the softened Coulomb potential \(\frac{1}{|x-x'| + c}\)

species
v_ext

External potential: either an atomic potential (Coulomb) or a given functional form

pcask1d.src.scf module

Module designed to keep and update the relevant state of a calculation en route toward self-consistency

class pcask1d.src.scf.SCF(params)

Bases: object

An instance of this class is initialised with a params, and an initial guess density, and creates an iterable object that can be iterated toward self-consistency.

static kohn_sham_map(params, density_in)
pulay_update()

pcask1d.src.wavefunction module

Module that defines a single-particle wavefunction and its various properties

class pcask1d.src.wavefunction.Wavefunction(params, **kwargs)

Bases: object

This class represents a single-particle wavefunction \(\phi_{ik}^\sigma (G)\)
with associated single-particle energy :math:`
arepsilon` and occupancy \(f_i\).
Each wavefunction has a spin \(\sigma\), k-point \(k\), and band index \(i\)
band_index
energy
get_density()

Obtain the (occupancy weighted) single-particle density corresponding to a single-particle wavefunction

k_point
occupancy
pw_coefficients

The plane-wave coefficients of the wavefunction

Module contents