"""Utility functions for magnetic properties."""
import numpy as np
[docs]
def is_magnetic():
import numpy as np
from ase.io import read
atoms = read('structure.json')
magmom_a = atoms.get_initial_magnetic_moments()
maxmom = np.max(np.abs(magmom_a))
if maxmom > 1e-3:
return True
else:
return False
mag_elements = {'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn',
'Y', 'Zr', 'Nb', 'Mo', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In',
'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl'}
[docs]
def magnetic_atoms(atoms):
return np.array([symbol in mag_elements
for symbol in atoms.get_chemical_symbols()],
dtype=bool)