Skip to content

Importing Magnetic Structures

Tobias Weber (Institut Laue-Langevin) edited this page Oct 13, 2024 · 12 revisions

Back to Contents.

If you have already created a magnetic model in another magnon calculation tool, you can alternatively try importing it using the table importer (select "Structure" -> "Import From Table..." in the menu):

  1. Paste the list of magnetic sites in the "Magnetic Sites Table" field and select the indices of the columns using the spin boxes above.
  2. Paste the list of magnetic couplings in the "Magnetic Couplings Table" field and also select the correct column indices.
  3. Click "Import Sites" and "Import Couplings" and verify that it has been correctly recognised.

Importing From SpinW

In SpinW these two lists can be generated using the following commands (where sw_obj names the SpinW object).

The magnetic sites list can be generated using either

sw_obj.table("atom")

or

sw_obj.table("mag")

where the latter also contains the spin directions and the full magnetic unit cell in case incommensurate structures are calculated using extended commensurate structures.

The magnetic couplings list is generated using

sw_obj.table("bond", [], true)

for the exchange interaction, and

sw_obj.table("ion", [], true)

for the list of single-ion anisotropy matrices.

In newer versions of Takin the column indices for importing SpinW site and coupling tables can be set using the "Set Indices" buttons, otherwise you can also enter them manually:

  • Sites using the "atom" table: name=0, x=3, y=4, z=5, Sx=-1, Sy=-1, Sz=-1, |S|=2.
  • Sites using the "mag" table: name=1, x=7, y=8, z=9, Sx=4, Sy=5, Sz=6, |S|=3.
  • Couplings using the "bond" table: name=-1, site1=10, site2=12, Δx=2, Δy=3, Δz=4, J=16, DMIx=25, DMIy=26, DMIz=27, Jgen=-1.
  • Single-ion anisotropy using the "ion" table: name=-1, site1=1, site2=1, Δx=-1, Δy=-1, Δz=-1, J=-1, DMIx=-1, DMIy=-1, DMIz=-1, Jgen=4.
  • Options: 1-Based Indices: ☑, Unite Tokens: ☑, Ignore Symmetric: ☐, Clear Existing: ☑ or ☐.

Importing From Sunny

In Sunny these two lists can be generated using this script (where magsys names the System object):

using Printf
import LinearAlgebra.norm2

site_idx = 1
@printf("# %6s %10s %10s %10s %10s %10s %10s %10s\n",
    "name", "x", "y", "z", "Sx", "Sy", "Sz", "|S|")
for (r, s) in zip(magsys.crystal.positions, magsys.dipoles)
    @printf(stderr, "%8d %10.4g %10.4g %10.4g %10.4g %10.4g %10.4g %10.4g\n",
        site_idx, r[1], r[2], r[3], s[1], s[2], s[3], norm2(s))
    global site_idx += 1
end

term_idx = 1
@printf("\n# %6s %8s %8s %8s %8s %8s %10s %10s %10s %10s\n",
    "name", "site1", "site2", "dx", "dy", "dz", "J", "DMIx", "DMIy", "DMIz")
for interaction in magsys.interactions_union
    for p in interaction.pair
        local J = 0.
        local dmi = [ 0., 0., 0. ]

        if length(p.bilin) == 1
            J = p.bilin[1]
        elseif length(p.bilin) == 9
            J = p.bilin[1, 1]
            dmi[1] =  p.bilin[2, 3]
            dmi[2] = -p.bilin[1, 3]
            dmi[3] =  p.bilin[1, 2]
        end

        @printf(stderr, "%8d %8d %8d %8d %8d %8d %10.4g %10.4g %10.4g %10.4g\n",
            term_idx, p.bond.i, p.bond.j, p.bond.n[1], p.bond.n[2], p.bond.n[3],
            J, dmi[1], dmi[2], dmi[3])

        global term_idx += 1
    end
end

In newer versions of Takin the column indices for importing Sunny site and coupling tables can be set using the "Set Indices" buttons, otherwise you can also enter them manually:

  • Sites: name=0, x=1, y=2, z=3, Sx=4, Sy=5, Sz=6, |S|=7.
  • Couplings: name=0, site1=1, site2=2, Δx=3, Δy=4, Δz=5, J=6, DMIx=7, DMIy=8, DMIz=9, Jgen=-1.
  • Options: 1-Based Indices: ☑, Unite Tokens: ☐, Ignore Symmetric: ☑, Clear Existing: ☑.