magnopy.io.read_spin_directions#

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

Reads spin directions from the file.

Parameters:
filenamestr

File with the spin directions. See notes for the details of its content.

Returns:
spin_directions(M, ) numpy.ndarray

Array with the spin directions. Each row is a spin direction vector normalized to 1.

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, then the rest of the line 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