pynegf package

Submodules

pynegf.pynegf module

class pynegf.pynegf.PyNegf(mpicomm=None)[source]

Bases: object

A python wrapper around libnegf (https://github.com/libnegf/libnegf/).

class LNParams[source]

Bases: _ctypes.Structure

This is the wrapper around the main libnegf input data structure and must be kept up-to-date with the corresponding C data structure in lnParams.h.

contact_dos

Structure/Union member

delta

Structure/Union member

dore

Structure/Union member

dos_delta

Structure/Union member

ec

Structure/Union member

emax

Structure/Union member

emin

Structure/Union member

eneconv

Structure/Union member

estep

Structure/Union member

ev

Structure/Union member

fictcont

Structure/Union member

g_spin

Structure/Union member

isSid

Structure/Union member

kbt_dm

Structure/Union member

kbt_t

Structure/Union member

kpoint

Structure/Union member

min_or_max

Structure/Union member

mu

Structure/Union member

mu_n

Structure/Union member

mu_p

Structure/Union member

n_kt

Structure/Union member

n_poles

Structure/Union member

nf

Structure/Union member

ni

Structure/Union member

np_n

Structure/Union member

np_p

Structure/Union member

np_real

Structure/Union member

readolddm_sgfs

Structure/Union member

readoldt_sgfs

Structure/Union member

spin

Structure/Union member

verbose

Structure/Union member

wght

Structure/Union member

currents()[source]

Get a local copy of currents array

Returns

array of currents for each possible lead pair defined in input

Return type

currents (array)

density_matrix()[source]

Get a local copy of CSR sparse density matrix

Returns

density matrix

Return type

dm (scipy sparse)

energies()[source]

Get a local copy of energies array

Returns

real part of points on energy axis. This quantity may change in libnegf in runtime when performing different integrals (contour, real axis) im_en (array): imaginary part (same as above)

Return type

real_en (array)

energy_current()[source]

Get a local copy of the energy-resolved current. This quantity is only calculated if el-ph interactions are used.

Returns

energy resolved current for all possible

lead pairs (2D array). Currents for each lead pair are ordered by row, i.e. trans[0, :] contains the values for the first lead pair.

Return type

curr (ndarray)

get_params()[source]

Get parameters from libnegf instance and update the class member. For debug or to get default values.

hs_from_file(re_fname, im_fname, target)[source]

Read H and S from file.

Parameters
  • re_fname (string) – real part path

  • im_fname (string) – string with imaginary part path

  • target (int) – 0 for hamiltonian, 1 for overlap

init_structure(ncont, contend, surfend, plend=None, cblk=None)[source]

Initialize the geometrical structure.

Parameters
  • ncont (int) – number of contacts

  • contend (numpy.ndarray) – end of contact indexes

  • surfend (numpy.ndarray) – end of surface indexes

  • plend (numpy.ndarray) – end of PL indexes. If None to trigger an automatic partitioning.

  • cblk (numpy.ndarray) – indexes of blocks interacting with contacts. Ignored if plend is None.

ldos()[source]

Get a local copy of dos from libnegf

Returns

local DOS for all given orbital intervals

(2D array). Each row contains the result for an interval (ninterval, values)

Return type

ldos (ndarray)

print_tnegf()[source]

Write all infos on TNegf container, for debug

read_negf_in()[source]

Parse negf.in for file input mode.

set_diagonal_elph_dephasing(coupling, max_scba_iter=10)[source]

Define a diagonal electron-phonon dephasing model.

Parameters
  • coupling (double array) – the coupling strength on each orbital, expressed as energy.

  • max_scba_iter (int) – maximum number of SCBA iterations.

set_hamiltonian(mat)[source]

Set H from a scipy.sparse.csr_matrix NOTE: libnegf is picky about the order of the PL blocks in the sparse matrix as well. There is no automatic reordering, you should have a well-sorted matrix.

Parameters

mat (complex csr_matrix) – input Hamiltonian

set_identity_overlap(nrow)[source]

Set the overlap matrix as identity matrix.

Parameters

nrow (int) – number of rows

set_ldos_intervals(istart, iend)[source]

Define intervals for LDOS calculations

Parameters
  • istart (int array) – starting orbitals

  • iend (int array) – ending orbitals

set_overlap(mat)[source]

Set S from a scipy.sparse.csr_matrix NOTE: libnegf is picky about the order of the PL blocks in the sparse matrix as well. There is no automatic reordering, you should have a well-sorted matrix.

Parameters

mat (complex csr_matrix) – input Overlap

set_params()[source]

Set the parameters from class member to libnegf. This is always called before a “solve” function

solve_density()[source]

Solve the density problem for an all electron problem (dft like)

solve_landauer()[source]

Solve the Landauer problem: calculate tunnelling and (eventually) LDOS

transmission()[source]

Get a local copy of transmission from libnegf. This quantity is not available if el-ph interactions are used.

Returns

transmission for all possible

lead pairs (2D array). Transmission for each lead pair are ordered by row, i.e. trans[0, :] contains the values for the first lead pair.

Return type

trans (ndarray)

write_tun_and_dos()[source]

Write tunnelling and LDOS to file (for debugging)

Module contents

class pynegf.Settings[source]

Bases: dict

A global setting dictionary.

static defaults() → Dict[str, Any][source]

Returns a dictionary of default settings. The available settings are:

negf_path: path of libnegf blas_path: path of libblas lapack_path: path of liblapack

pynegf.cdll_libnegf() → ctypes.CDLL[source]
Returns

The loaded CDLL object

pynegf.load_dependencies() → Dict[str, ctypes.CDLL][source]

Load at module level the ctypes dependencies.

Returns

A dictionary containing the loaded library instances.