PAOFLOW.hamiltonian.do_real_space#

Attributes#

Functions#

do_density(data_controller, nr1, nr2, nr3)

Compute the real-space electron density and write it to an XSF file.

Module Contents#

PAOFLOW.hamiltonian.do_real_space.comm[source]#
PAOFLOW.hamiltonian.do_real_space.rank[source]#
PAOFLOW.hamiltonian.do_real_space.do_density(data_controller, nr1, nr2, nr3)[source]#

Compute the real-space electron density and write it to an XSF file.

Parameters:
  • data_controller (DataController) – Object providing data_arrays and data_attributes. Required arrays: basis, v_k (shape (nkpnts, nawf, bnd, nspin)), E_k (shape (nkpnts, bnd, nspin)). Required attributes: nspin, nkpnts, bnd, omega, outputdir, verbose.

  • nr1 (int) – Number of real-space grid points along the first lattice vector.

  • nr2 (int) – Number of real-space grid points along the second lattice vector.

  • nr3 (int) – Number of real-space grid points along the third lattice vector.

Returns:

For each spin channel ispin, writes an XSF file {outputdir}/density_{ispin}.xsf containing the real-space electron density \(\rho(\mathbf{r})\).

Return type:

None

Notes

The electron density is accumulated as

\[\rho(\mathbf{r}) = \sum_{n\mathbf{k},\, E_{n\mathbf{k}} \leq 0} \frac{2}{N_k \Omega} \left| \sum_\mu c^\mu_{n\mathbf{k}}\, \phi^\mu(\mathbf{r}) \right|^2\]

where \(c^\mu_{n\mathbf{k}}\) are the eigenvector coefficients in the PAO basis, \(\phi^\mu\) are the real-space atomic wavefunctions (evaluated on the (nr1, nr2, nr3) grid), \(N_k\) is the total number of k-points, and \(\Omega\) is the unit-cell volume. The sum runs over all occupied states (eigenvalues \(\leq 0\)).

Work is distributed across MPI ranks via load_balancing(). An MPI reduction collects contributions from all ranks on rank 0 before writing. If verbose is enabled, the total charge is printed.