nanotools.io.xyz module
Created on 2020-08-27
@author: Vincent Michaud-Rioux
- nanotools.io.xyz.readxyz_pos(filename)[source]
Reads an xyz file.
The first two lines are the number of atoms and a comment. Then each lines has 4 columns: species, x, y, z.
- Parameters:
filename (str) – Path of the xyz file.
- Returns:
- xyz (array):
2D array of the coordinates.
- Return type:
formula (str)
- nanotools.io.xyz.readxyz_spin(filename)[source]
Reads an xyz file and returns the spin.
The first two lines are the number of atoms and a comment. To parse spin, the function assumes the comment has four tags (usually species, x, y, z) and then sx, sy, sz at some point. The position of sx, sy, sz or sr, st, sp indicates which column has which spin.
- Parameters:
filename (str) – Path of the xyz file.
- Returns:
2D array of the spins in Cartesian format. If no spin is found, then None is returned. If only sz is found then a 1D array of spin-z is returned. If any of sx, sy, sz are found then a 2D array of spins is returned. If any of sr, st, sp are found then a 2D array of spins is returned.
- Return type:
spins (array)