magnopy.multiprocess_over_k#

magnopy.multiprocess_over_k(kpoints, function, relative=False, units='meV', number_processors=None)[source]#

Parallelizes calculation over the kpoints using multiprocessing module.

Parameters:
kpoints(N, 3) array-like

List of the kpoints.

functioncallable

Function that process one kpoint and is called as

result = function(kpoints[i], relative, units)
relativebool, default False

If relative=True, then k is interpreted as given relative to the reciprocal unit cell. Otherwise it is interpreted as given in absolute coordinates.

unitsstr, default "meV"

Added in version 0.3.0.

Units of energy. See SpinHamiltonian.units for the list of supported units.

number_processorsint, optional

By default Magnopy uses all available processes. Pass number_processors=1 to run in serial.

Returns:
results(N, ) list

List of objects that are returned by the function.

Notes

When using this function of Magnopy in your Python scripts make sure to safeguard your script with the

import magnopy

# Import more stuff
# or
# Define your functions, classes

if __name__ == "__main__":

    # Write your executable code here

For more information refer to the "Safe importing of main module" section in multiprocessing docs.