# Spinors with CASTEP

Note that c2x 2.41 or later is required for this example.

The system Mn_{3}Sn has a small unit cell, and
it has frustrated anti-ferromagnetic spin states. But despite the
small unit cell of just eight atoms, the calculations are still much
larger than the other examples on this site. This example was run on
21 cores, and still took almost three hours. Switching to EDFT
secured convergence where density mixing failed. Being metallic lots
of k-points are needed, and Castep's in-built pseudopotentals for Mn
and Sn are accurate, but have many valence electrons (15 for Mn, 14
for Sn), leading to many bands and a high cut-off.

An article in Nature Communications has a figure showing the expected spin structure (fig 1b).

## Input Files

Note the use of "SOC19" pseudopotentials.

## Visualisation

### Regular Grid

One can use XCrysDen and a regular grid of dummy atoms with "force" vectors. This technique is recommended, but could, perhaps, be simpler.

This example needs c2x version 2.41 or later.

$ c2x -sv --xsf -i=6,6,4 Mn3Sn.castep_bin Mn3Sn.xsf Castep version 23.100 Spins=2 nbands=142 nkpts=63 [...] Found 3D data for Vector spin Data contain 3 components. Per component analysis: min=-2.51651 max=4.19771 sum=164.742 int=0.128258 int|s|=12.9432 min=-3.79732 max=3.59936 sum=-130.111 int=-0.101296 int|s|=11.7991 min=-1.06501 max=0.682232 sum=100.884 int=0.0785418 int|s|=1.95981 (integral is e per cell for charge and spin densities)

Which produces Mn3Sn.xsf.

C2x recalculates the spin integrals which are also given by Castep in the Mn3Sn.castep output file. These can be very useful. Note that the components have integrals close to zero, but the integrals of their absolute values are far from zero, particularly in the xy plane. This suggests an anti-ferromagnetic state in the xy plane, with a weaker variation in z.

$ xcrysden --xsf Mn3Sn.xsf

Above is the inital image after setting the background to white (to left coloured button) and zooming slightly (mouse wheel). XCrysDen shows the dummy atoms as small green spheres which do not bond.

Choose "Modify | Force Settings" and set the length factor to one, and the threshold to 0.5. Then after choosing "Display | Forces" and "Modify | Atomic Radius | Atom: X|Display Radius: 0" one can produce

Note that toggling "Display | Forces" might not do anything until after the next display update (i.e. modifying the atomic radius). Also that in the Force Settings dialog box one must press "Update" before "Close", and in the Atomic Radius box one must press "Update Radius" before "OK".

Now frustrated antiferromagnetic vector spins are clearly seen on the Mn atoms. A little rotation might make the figure clearer.

The spins are not perfectly planar, but quite close. A higher degree of convergence might make them more planar.

In this image, "Modify | Ball/Stick Ratio" has been reduced to 0.3 to make the bonds thinner. If one wishes to display the co-ordinate axes via "Display | Coordinate System" note that it defaults to white, which is not useful if the background is set to white too. "Modify | Coordinate System Color" solves this.

The 6x6x4 grid was carefully chosen to place a grid point near each atom. One might prefer a denser uniform grid.

$ c2x -sv --xsf -i=12,12,9 Mn3Sn.castep_bin Mn3Sn.xsf

The above has Modify|Ball Factor set to 0.1, Modify|Force Settings|Length Factor to 0.5, and Modify|Atomic Radius|X|Display Radius to 0. It looks much clearer when one can rotate it. It might seem clearer if the threshold for showing "force" (spin) vectors is set to 0.1, as it is below.

### Spin On or Near Atoms

Rather than adding a regular grid of atoms, c2x can also add the
field as "force" vectors to existing atoms. If one simply wants the
point value at the nucleus, the option is
simply `--vec2force`

.

For vector spins it is more useful to average over a sphere centred on each atom, or even to integrate over a sphere centred on each atom. This is not ideal -- one really ought to perform some form of projection of the wavefunctions onto localised atomic states -- but for a qualitative picture averaging over spheres is often quite adequate.

The syntax is

--vecforce=xx.yy[B][i]

for a sphere of radius xx.yy, defaulting to Angstroms but Bohr if B
is given, and if a final i is suffixed then the result is integrated
by multiplying by (4/3)πr^{3}. This will turn a spin
density into a total spin.

If one is concerned about the numerical accuracy of the averaging or integration, add a final suffix (after the "i" if present) of one or two f's (for fine).

Finally one can specify that such "force" vectors should be added to certain species only. For this the syntax is

--vecforce=[AtSym1[,AtSym2[,...]]:]xx.yy[B][i]

E.g.

$ c2x -sv --vec2force=Mn:1.35i Mn3Sn.castep_bin Mn3Sn.xsf

This will report the integrated spin on each Mn atom.

Found 3D data for Vector spin Data contain 3 components. Per component analysis: min=-2.51651 max=4.19771 sum=164.742 int=0.128258 int|s|=12.9432 min=-3.79732 max=3.59936 sum=-130.111 int=-0.101296 int|s|=11.7991 min=-1.06501 max=0.682232 sum=100.884 int=0.0785418 int|s|=1.95981 (integral is e per cell for charge and spin densities) Sampling of vector data integrating over 1.350000A using 30 points radially Mn at (0.8227,0.6613,0.2500) vector ( 3.1515, 0.1252, 0.1677) modulus 3.1584 Mn at (0.3387,0.6613,0.2500) vector (-1.4382,-2.7875, 0.3852) modulus 3.1602 Mn at (0.3387,0.1773,0.2500) vector (-1.6464, 2.6055,-0.7090) modulus 3.1626 Mn at (0.6613,0.8227,0.7500) vector (-1.6692, 2.6538, 0.4121) modulus 3.1620 Mn at (0.6613,0.3387,0.7500) vector (-1.4241,-2.8160,-0.1776) modulus 3.1606 Mn at (0.1773,0.3387,0.7500) vector ( 3.1567, 0.1142, 0.0009) modulus 3.1588

This assignment of spins to atoms is not perfect. The integrals of |s| throughout the cell show an x component of 12.94 and a y component of 11.80. Summing the above atoms gives an x component of 12.49 and a y component of 11.10. Such checks give an estimate of how well this basic analysis is performing for a given system.

For the above image the force length factor was reduced to 0.6.

## Tricks

The vector spin varies rapidly in space, and one sees sensible results only when averaging over a largish volume. In the system given, all atoms had a and b fractional co-ordinates which were approximately multiples of one sixth, and c fractional co-ordinates which were multiples of one quarter, so plotting the vector spin on a 6x6x4 grid puts a point (almost) on every atom, has a reasonable density of points elsewhere, and the point "on" each atom is averaged over a large enough volume to give a sensible result.

Suppose one wanted a higher resolution picture of the spins. One
could try specifying `-i=12,12,9`

(the FFT grid was
60x60x45, so this is a factor of five reduction in each direction).

If one does not reduce the resolution at all, there will be 60x60x45=162,000 dummy atoms in the XSF file. This causes XCrysDen to crash.

## A Quicker "Toy" Calculation

If all we wish to to is see an example of a frustrated spin state,
we might be prepared to compromise on how precisely we model real
Mn_{3}Sn. The biggest gain will be from using different
pseudopotentials. Moving from Mn^{+15} and Sn^{+14} to
Mn^{+7} and Sn^{+4} not only reduces the number of
bands needed considerably, but the new potentials should work with a
much lower cutoff than the old. Energies scale linearly with charge,
so one can argue for a factor of three lower.

Castep has a built-in pseudopotential generator, and we can instruct it do use different parameters when creating its pseudopotential. A new pseudpotential needs rigorous testing to ensure that it does behave like the atom it is meant to simulate, and also testing to determine the correct cut-offs to use. But actually all we care about is whether it produces a spin state which is visually similar to the one we want.

After also reducing the k-point mesh and
setting `basis_precision`

to medium, I produced the
following input files.

The original calculation took around two hours and forty minutes running on 21 cores, and I assume it would have taken over ten hours on a four-core workstation. This revised calculation ran in twenty-five minutes on a 3GHz four core Kaby Lake desktop.

The magnetic moments are seen to be weaker than in the more accurate calculation, something which could be disguised by adjusting the force length factor. But the directions of the spins are very similar to the calculation that was over twenty times as expensive.