Spin constraining in PyIron+Sphinx

Viewed 28

I want to constrain the spin of the bulk atoms while letting the free surface atoms of my supercell relax their magnetic moment. Is it possible in PyIron+SPhinx to constrain the spin of a subset of atoms (not all of them) in the supercell?

1 Answers

Yes in principle it is possible:

from pyiron import Project
import numpy as np

spx = pr.create.job.Sphinx('spx')
spx.structure = pr.create.structure.bulk('Fe', a=2.83, cubic=True)
spx.structure.set_initial_magnetic_moments([2, 2])
spx.fix_spin_constraint = True
spx.structure.spin_constraint = np.array([True, False])
spx.calc_static()
spx.run()

Short explanation: spx.fix_spin_constraint = True initializes the attribute spx.structure.spin_constraint, which contains only True for all atoms at the beginning. For the atoms which should not be constrained, you can set False.

Related