Source code

PyEwald source files.

Supercell

Construct the supercell.

class src.supercell.Supercell(n1, n2, n3, lattice)[source]
Args:

n1,n2,n3 are the number of repeated unitcells along the three directions of the ‘lattice’.

lattice specifies the Bravais lattice of a unit cell.

Note

This version is not compitable with previous ones as

  • All the index starts from 0.
  • Arrays (e.g. lattice and reci lattice) are row majored.

The reason is to use Pybind11 that binds to C++ instead of Fortran.

rec_lat()[source]

Calculates reciprocal lattice vectors.

The convention follows “Solid state physics” by Lu Dong, Jiang Ping … Eq. (2.2.2)

set_supercell()[source]

Multiply the n1,n2,n3 to the unitcell vectors to form the superlattice.

volcell()[source]

Volume of the supercell.

Charge_charge

Generate charge_charge interaction matrix.

class src.charge_charge.Charge_charge(n1, n2, nz, lattice)[source]

Charge_charge inherits the Supercell class, it first initializes the supercell it works on.

Parameters:
  • n1 – Number of unit cells along the first Bravais vector of ‘lattice’.
  • n2 – Number of unit cells along the second Bravais vector of ‘lattice’.
  • nz – Number of unit cells along the third Bravais vector of “lattice’.
  • lattice – The lattice of the unit cell, not the supercell.

utility

src.utility.calc_madelung_cc(mat, alloy_fn)[source]
Args:
  • ‘mat’ is the charge-charge interaction matrix.
  • ‘alloy_fn’ specifies the distribution of charges.

Calculate the Madelung constant due to the charge-charge interaction.

src.utility.calc_madelung_cd(mat, alloy_fn, alloy_hn, alloy)[source]
Args:
  • ‘mat’ is the charge-dipole interaction matrix.
  • ‘alloy_fn’ is the charge configuration.
  • ‘alloy_hn’ is the dipole configuration.
  • ‘alloy’ file contains the information to map index between 3D and 1D for easy use in this funciton.
src.utility.calc_madelung_dd(mat, alloy_fn)[source]
Args:
  • ‘mat’ is the dipole-dipole interaction matrix.
  • ‘alloy_fn’ specifies the dipole configuration.

Calculate the “Madelung constant” due to the dipole-dipole interaction.