# SparseGreensFunction¶

class SparseGreensFunction(processes_per_contour_point=None, workspace_path=None)

The direct sparse inversion method used to calculate the Green’s function and lesser Green’s function.

The method distributes the evaluation of the (lesser) Green’s function for multiple contour points, i.e., energy- and k-points, over all available processes.

The evaluation of the (lesser) Green’s function in each contour point, can be performed by multiple processes in parallel.

The method’s required virtual memory can be reduced by allocating workspace on disk. Usage of disk workspace has a negative impact on the method’s performance.

Parameters: processes_per_contour_point (int) – The number of processes used to calculate each contour point. Must be positive. The best performance is obtained when set to 1. Increasing the number of processes per contour point reduces the required memory. Default: 1 workspace_path (str) – Path to an existing directory usable as workspace. An empty string disables the disk workspace. The given string must not be longer than 255 characters. Default: Disk workspace disabled.
processesPerContourPoint()
Returns: The processes per contour point int
workspacePath()
Returns: The workspace path str | None

## Usage Examples¶

Setup a device calculation that computes the Green’s function and lesser Green’s function via direct sparse inversion using 2 MPI processes for each contour point.

greens_function_method = SparseGreensFunction(
processes_per_contour_point=2)

device_algorithm_parameters = DeviceAlgorithmParameters(
equilibrium_method=greens_function_method,
non_equilibrium_method=greens_function_method,
)

calculator = DeviceHuckelCalculator(
device_algorithm_parameters=device_algorithm_parameters,
)