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, thenkis 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.unitsfor the list of supported units.- number_processorsint, optional
By default magnopy uses all available processes. Pass
number_processors=1to 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.