magnopy.io.read_spin_directions#

magnopy.io.read_spin_directions(filename: str)[source]#

Read directions of the spins from the file.

Parameters:
filenamestr or (3*M, ) array-like

File with the spin directions. See notes for the specification of the file format.

Returns:
spin_directions(M, ) numpy.ndarray

If spin_directions is an array-like, then first three elements are

Notes

The file is expected to contain three numbers per line, here is an example for two spins

S1_x S1_y S1_z
S2_x S2_y S2_z

Only the direction of the spin vector is recognized, the modulus is ignored. Comments are allowed at any place of the file and preceded by the symbol "#". If the symbol "#" is found, the part of the line after it is ignored. Here are examples of valid use of the comments

# Spin vectors for the material XX
S1_x S1_y S1_z # Atom X1
# This comments is here by some reason
S2_x S2_y S2_z # Atom X2