spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
120 stars 53 forks source link

Sublattice magnetization #594

Open bonfus opened 3 years ago

bonfus commented 3 years ago

Hi there, I've been playing with Spirit APIs for a while, but I haven't found a good way to define sublattice magnetization.

My setup looks like this

basis
8
0.0 0.5 0.25
0.5 0.0 0.25
0.0 0.5 0.75
0.5 0.0 0.75
0.0 0.0 0.0
0.5 0.5 0.5
0.0 0.0 0.5
0.5 0.5 0.0

mu_s 0.1 0.1 0.1 0.1 3.5 3.5 3.4 3.4

n_defects 268
4 0 0 0 -1
5 0 0 0 -1
4 0 0 1 -1
5 0 0 1 -1
4 0 0 2 -1
...

I wanted to use system.get_spin_directions but it reports all spin, including those of defects, and they are all different from 0. I also tried to identify the atoms with mu_s, but this also doesn't work.

What is the best way to achieve a definition of sublattice magnetization?

sqml-ust commented 3 years ago

I am also looking for a way to create a ferrimagnetic system, which is related to this question. I hope that someone can address this issue. Thanks.

MSallermann commented 3 years ago

Hi sorry for the late reply. If I understand you correctly, you want to read out the spin directions belonging to a specific basis atom. Is that right? I would suggest to index the spin directions with the corresponding stride and offset. The linear index is computed as idx = i + N_basis * (a + Na * (b + Nb * c)), where i is the index of the basis atom in the cell and N_basis is the number of basis atoms etc...

Using numpy arrays, you can write

spins = np.array(system.get_spin_directions(p_state))
spins_0 = spins[0::8]  #Spins on sublattice 0
spins_1 = spins[1::8]
#...
spins_7 = spins[7::8]
sqml-ust commented 3 years ago

@MSallermann Sorry for bothering you. I would like to clarify my question. My question is whether it is possible to define different mu_s for different atoms or (atomistic) spins. This feature is important for a ferrimagnetic system. I appreciate your attention. Thank you.

MSallermann commented 3 years ago

@sqml-ust It is possible to define a different mu_s for every spin in the basis cell. This is done by the syntax already used in the original issue. You can always enlarge the basis cell (and adjust the interaction pairs accordingly), to accommodate the structure you need. If you need more flexibility, you can also use the defects feature and define mu_s on a per site level: https://spirit-docs.readthedocs.io/en/latest/core/docs/Input.html#disorder-and-defects-a-name-defects-a. I understand that this is not the most user friendly part of spirit. In the not-too-distant future I plan to make these type of "filters" scriptable and much more flexible. If you have further questions, feel free to open another issue.

GPMueller commented 3 years ago

@bonfus to clarify this point you raised

it reports all spin, including those of defects, and they are all different from 0

I see why this is confusing... This is intentional, however, as the spins are represented by normal vectors, irrespective of their magnetization value. Even if mu_s=0 or atom_type<0 (i.e. defect) for a given atom, you will get a normalized vector from system.get_spin_directions.

Note also this bug: https://github.com/spirit-code/spirit/issues/527, i.e. you should calculate the magnetization yourself, using the spin_directions and your mu_s and atom_type values, instead of using quantities.get_magnetization.