1. Definition and normalization
The Fourier components of a configuration and its static (equal-time) structure factor are
With respect to the spin axis \(\hat z\), the longitudinal and transverse parts are \(s_\parallel=s^{zz}\) and \(s_\perp=s^{xx}+s^{yy}\). The usual definition is \(S^{\alpha\beta}(\mathbf q)=\frac1N\sum_{ij}\langle S^\alpha_iS^\beta_j\rangle e^{i\mathbf q\cdot(\mathbf r_i-\mathbf r_j)}=N\,s^{\alpha\beta}(\mathbf q)\). We use \(1/N^2\) because then the height of a Bragg peak is directly the square of the ordered moment at that wave vector and does not depend on \(N\), while the diffuse contribution from disorder stays \(O(1/N)\).
Sum rule. Parseval's identity gives
Whatever the configuration, the total weight is fixed; the structure factor only tells how this weight is distributed over \(\mathbf q\) space and between the components. Σs∥ and Σs⊥ in the readout row check this rule at every step.
Correlation function. \(C^{\alpha\alpha}(\mathbf r)=\frac1N\sum_j\langle S^\alpha_jS^\alpha_{j+\mathbf r}\rangle=\sum_{\mathbf q}s^{\alpha\alpha}(\mathbf q)\,e^{i\mathbf q\cdot\mathbf r}\) (Wiener–Khinchin). A sharp peak corresponds to long-range correlations, a broadened peak to decaying correlations (Figure 4).
Reality and chirality. Since spins are real, \(\mathbf S_{-\mathbf q}=\mathbf S_{\mathbf q}^{*}\) and \(s(\mathbf q)=s(-\mathbf q)\): peaks always come in ±q pairs. The sense of rotation of a spiral does not appear in \(s\); it appears only in the antisymmetric part:
For a spiral rotating counterclockwise in the xy plane, \(\chi_z(\pm\mathbf Q)=\pm\tfrac12\). Experimentally this term is measured with polarized neutrons.
2. Ordered structures: Bragg peaks
A general single-wave-vector (single-Q) structure has the form \(\mathbf S_j=\mathbf m_0+\mathrm{Re}\big[\mathbf m_{\mathbf Q}\,e^{i\mathbf Q\cdot\mathbf r_j}\big]\), where \(\mathbf m_{\mathbf Q}\) is a complex vector. Directly,
The component split encodes the geometry of the structure:
- Spiral in the xy plane, \(\mathbf m_{\mathbf Q}=\hat x-i\hat y\): transverse only, \(s_\perp(\pm\mathbf Q)=\tfrac12\).
- Spiral in a plane containing ẑ (Bloch or Néel type): the weight splits equally, \(s_\parallel(\pm\mathbf Q)=s_\perp(\pm\mathbf Q)=\tfrac14\).
- Conical spiral with out-of-plane tilt \(\alpha\): \(s_\parallel(0)=\sin^2\alpha\), \(s_\perp(\pm\mathbf Q)=\tfrac12\cos^2\alpha\). Ferromagnetic and spiral order appear together, in different components.
- Néel and stripe order: Q lies on the zone boundary, \(\mathbf Q\equiv-\mathbf Q\); all the weight collects at a single point, \(s_\parallel(\mathbf Q)=1\).
- 120° order on the triangular lattice: \(\mathbf Q=\mathrm K\); \(s_\perp=\tfrac12\) at K and at K′ = −K.
3. Modulation: amplitude, phase and harmonics
A product of two functions in real space is a convolution of their Fourier components in \(\mathbf q\) space. All the “modulation” behaviour on this page follows from this single principle.
Amplitude modulation (SDW) and squaring-up
For \(S^z_j=A\cos(\mathbf Q\cdot\mathbf r_j+\psi_0)\), \(s_\parallel(\pm\mathbf Q)=A^2/4\) and \(\sum_{\mathbf q}s_\parallel=A^2/2\). For \(A=1\) the total is ½: a sinusoidal SDW is incompatible with the constraint \(|\mathbf S|=1\). In a classical model such a structure appears only as a thermal average (for example just below \(T_N\)) or in itinerant electron systems. As the temperature drops the structure “squares up”; here this is modelled by \(f(u)=\tanh(\beta\cos u)/\tanh\beta\). In the limit \(\beta\to\infty\)
On the lattice the harmonics fold back to \(n\mathbf Q-\mathbf G\). In the ↑↑↓↓ structure (\(Q=\pi/2\)) the 3rd harmonic lands at \(3\pi/2\equiv-\pi/2\) and coincides with the fundamental peak. This is why ↑↑↓↓ shows only two peaks even though it is a square wave.
Phase modulation: the fan structure
\(\mathbf S=(\sin\phi,0,\cos\phi)\), \(\phi=\phi_m\sin u\). The Jacobi–Anger expansion \(e^{i\phi_m\sin u}=\sum_n J_n(\phi_m)e^{inu}\) gives directly
even harmonics in the longitudinal component, odd harmonics in the transverse one. Phase modulation in one component transfers weight to the harmonics of the other.
The fixed-length constraint
Multi-Q structures are built as \(\mathbf m=m_0\hat z+\sum_i[\hat z\cos(\mathbf Q_i\cdot\mathbf r)+\hat e_i\sin(\mathbf Q_i\cdot\mathbf r)]\) and then normalized to \(|\mathbf m|=1\). Normalization is a nonlinear operation and produces combination harmonics such as \(\mathbf Q_1+\mathbf Q_2\) and \(2\mathbf Q_1\). When the “|S| = 1 normalization” box is unchecked these peaks disappear and the spin length becomes non-uniform. With the box unchecked the operation is linear: m₀ changes only the q = 0 peak and the fundamental peaks stay in place.
4. Superposition: how the peaks build the configuration
The inverse transform \(\mathbf S_j=\frac1N\sum_{\mathbf q}\mathbf S_{\mathbf q}e^{i\mathbf q\cdot\mathbf r_j}\) turns a ±q pair into a single real plane wave:
Every peak is a wave. Its amplitude is read from the square root of the peak height; its phase is absent from the structure factor altogether. Figure 3 shows each selected wave and their sum. By Parseval, the error of the synthesis is
that is, the total unselected weight. It appears in the readout row as “captured weight”.
The phase problem
The “Scramble phases” button gives a random phase to every component of every selected ±q pair; each press draws a new set of phases, and “True phases” returns to the original. \(|S_{\mathbf q}|\), and therefore the structure factor, does not change, while the real-space pattern changes completely. The structure factor alone does not determine the configuration. This is the central difficulty in solving magnetic structures from diffraction experiments.
Multi-Q or multi-domain?
On the square lattice, a double-Q skyrmion lattice made of two perpendicular spirals and a mixture of single-Q domains oriented along Q₁ and Q₂ give the same picture in the fundamental peaks: ±Q₁ and ±Q₂. To tell them apart one looks at (i) the \(\mathbf Q_1\pm\mathbf Q_2\) harmonics, present only in a genuine multi-Q structure (they are weak and in experiments can be confused with multiple scattering), (ii) selection of a single domain type by field or strain, (iii) real-space imaging. The topological charge is also a real-space quantity; the readout row gives it as the Berg–Lüscher sum:
In the double-Q structure with \(m_0\neq0\), \(Q_\text{top}=\mp1\) per magnetic unit cell; the sign follows m₀. At \(m_0=0\) the field to be normalized vanishes exactly at some sites: there the spin direction and \(Q_\text{top}\) are undefined. This is not an accident: in a continuous texture the topological charge can change only by passing through such a singularity, where \(|\mathbf m|\) vanishes somewhere. The same happens in the triple-Q structure: as m₀ increases, the charge per cell takes the values \(+1\) (\(m_0<1\)), \(-2\) (\(1
Meron–antimeron lattice. On the square lattice \(\mathbf m\propto(\sin Qx,\ \sin Qy,\ 0.5\cos Qx)\) contains two vortices and two antivortices per period; half of the cores point along \(+\hat z\), half along \(-\hat z\). Each core carries roughly \(\pm\tfrac12\) charge (±0.42 on this lattice; it approaches ½ as the cores narrow), and the total charge is zero. The fundamental peaks are again at \(\pm\mathbf Q_1\), \(\pm\mathbf Q_2\): the same peak positions can correspond to three different topologies (skyrmion, meron–antimeron, domain mixture).
5. Disorder and peak shape
Uncorrelated fluctuations. For \(\mathbf S_j=\langle\mathbf S_j\rangle+\delta\mathbf S_j\) with \(\delta\mathbf S\) uncorrelated between sites,
The peak does not broaden: the Bragg weight decreases (Debye–Waller-like) and the lost weight spreads over \(\mathbf q\) space as a flat background. Direction noise η and vacancy fraction p show this. For vacancies the Bragg weight is \((1-p)^2\) and the total is \(1-p\).
Phase disorder (1D). A long-wavelength random field is added to the phase of the modulation: \(\langle\Delta\phi^2(r)\rangle=2r/\xi\). For a Gaussian field \(\langle\cos\Delta\phi\rangle=e^{-r/\xi}\), hence \(C(r)\propto\cos(\mathbf Q\cdot\mathbf r)\,e^{-r/\xi}\). In 1D this corresponds to a Lorentzian peak:
The ξ in the readout row is obtained from the half width at half maximum of the peak, assuming a Lorentzian, and agrees with the input ξ to within 10–20%. Compare with direction noise η: η lowers the peak but does not broaden it; ξ broadens it. This is the difference between long- and short-range order. The setting exists only in 1D: in 2D the transform of an exponential correlation is not Lorentzian, and on a finite torus the phase difference saturates, leaving a misleading residual Bragg peak. In 2D, peak broadening is shown by antiphase and orientation domains.
Domains. Domains of average size ℓ broaden peaks by \(\sim2\pi/\ell\) (Laue function). With antiphase domains Q does not shift; only the width increases. With ±M domains the spins inside the walls acquire a transverse component, so \(s_\perp\) rises at small \(q\).
Labyrinth: a ring-shaped structure factor. When all waves on the shell |q| ≈ Q are added with random phases, stripes form with a fixed local wavelength and random orientation. The structure factor is then no longer a set of discrete peaks but a ring of radius Q. A ring means “wavelength known, direction not”; it has the same meaning as the rings seen in powder averages and in SANS. The |S| = 1 normalization couples the waves and moves part of the weight off the ring (into harmonics). As the net moment m₀ grows the stripes break up; in the chiral labyrinth a mixture of isolated skyrmions and worms appears, and the ring remains with a q = 0 peak added. On small lattices the shell contains few points, so the ring looks speckled.
Single sample and ensemble. The snapshot \(s(\mathbf q)\) of a random configuration is noisy (a speckle pattern): the value at each \(\mathbf q\) is exponentially distributed and fluctuates as much as its mean. A smooth Lorentzian or a flat background appears only after ensemble averaging. The synthesis, in contrast, uses the complex amplitudes of a single snapshot, because the averaged \(|S_{\mathbf q}|^2\) has no phase.
6. Critical notes
- Equal-time versus elastic. What is computed here is \(S(\mathbf q)=\int S(\mathbf q,\omega)\,\mathrm d\omega/2\pi\). Bragg peaks are the elastic (\(\omega=0\)) part, while part of the diffuse scattering is inelastic. A diffraction measurement without energy analysis equals the equal-time correlation only in the quasi-static approximation (incident energy much larger than the magnetic energies).
- The projection measured in experiment. The magnetic neutron cross-section is \(\propto|F(\mathbf q)|^2\sum_{\alpha\beta}(\delta_{\alpha\beta}-\hat q_\alpha\hat q_\beta)S^{\alpha\beta}(\mathbf q)\). Only components perpendicular to \(\mathbf q\) are seen, and the form factor suppresses the signal at large \(q\). The ∥/⊥ split used here is a theoretical split with respect to the spin axis (ẑ); it is not the same as the neutron “longitudinal/transverse”.
- Classical versus quantum. For quantum spins the sum rule becomes \(S(S+1)\) and the Bragg weight is \(m^2\le S^2\). Zero-point fluctuations move weight from the Bragg peak to the diffuse background. For the 2D S = ½ Heisenberg antiferromagnet \(m\approx0.307\), so only \(m^2/S(S+1)\approx13\%\) of the total weight is in the Bragg peak.
- Finite periodic lattice. Q always lies on the \(2\pi m/L\) grid; there is no true incommensurability. Harmonics fold into the zone, and the peak width cannot be smaller than \(2\pi/L\).
- Recipes, not minimization. The configurations are analytic recipes. They are not claimed to be ground states or thermal equilibria of any Hamiltonian. The sinusoidal SDW and the unnormalized multi-Q structures deliberately violate \(|\mathbf S|=1\).
- Limits of the component split. The sum \(s_\perp=s^{xx}+s^{yy}\) is invariant under rotations about \(\hat z\). In-plane orientation additionally requires \(s^{xx}\), \(s^{yy}\) and \(\chi_z\).
7. Table of configurations
| Configuration | Peaks | s∥ | s⊥ | What it teaches |
|---|---|---|---|---|
| FM, tilted by θ | q = 0 | cos²θ | sin²θ | Single peak; the component split gives the orientation |
| Néel / stripe | Q = (π,π) / (π,0) | 1 | 0 | Q ≡ −Q on the zone boundary |
| Spiral (xy) | ±Q | 0 | ½ + ½ | Chirality only in χz |
| Spiral (Bloch/Néel) | ±Q | ¼ + ¼ | ¼ + ¼ | Rotation plane in the ∥/⊥ ratio |
| Conical, α | 0, ±Q | sin²α | ½cos²α + ½cos²α | FM and spiral in different components |
| SDW (sinusoidal) | ±Q | ¼ + ¼ | 0 | Σ = ½: fixed length violated |
| Squared-up SDW | ±nQ, n odd | 4/(π²n²) | 0 | Harmonics, folding |
| Fan, φₘ | 0, ±nQ | J²₀, J²₂, … | J²₁, J²₃, … | Phase modulation, Bessel weights |
| Double-/triple-Q skyrmion | ±Qᵢ, Qᵢ ± Qⱼ, 0 | depends on normalization | Combination harmonics, Qtop | |
| Meron–antimeron (square) | ±Q₁, ±Q₂ | similar to the skyrmion lattice | Same peaks, Q_top = 0, ≈ ±½ per core | |
| Labyrinth (collinear / chiral) | ring at |q| ≈ Q | ring; ∥ and ⊥ equal when chiral | Fixed wavelength, random direction | |
| Orientation domains | ±Qᵢ (broadened) | same fundamental peaks as double-Q | Multi-Q / multi-domain ambiguity | |
| Short-range spiral (1D) | ±Q (Lorentzian) | 0 | HWHM ≈ 1/ξ | Peak width ↔ correlation length |
| Paramagnet | none | ≈ 1/(3N) | ≈ 2/(3N) | Flat background, speckle noise |
8. Numerical checks
The core code was compared with analytic results (single sample, no disorder).
| Case | Quantity | Analytic | Computed |
|---|---|---|---|
| Spiral xy, N = 96, Q = π/6 | s⊥(±Q), χz(±Q) | 0.5, ±0.5 | 0.50000, ±0.50000 |
| Conical, α = 35° | s∥(0) / s⊥(Q) | 0.32899 / 0.33551 | 0.32899 / 0.33551 |
| Square-wave SDW, N = 240, period 48 | s∥(nQ), n = 1, 3, 5 | 0.4053, 0.0450, 0.0162 | 0.4059, 0.0456, 0.0168 |
| ↑↑↓↓ | s∥(±π/2) | 0.5 | 0.50000 |
| Fan, φₘ = 90° | J²₀, J²₁, J²₂, J²₃ | 0.2228, 0.3213, 0.0624, 0.0048 | 0.2228, 0.3213, 0.0624, 0.0048 |
| 120° (triangular, L = 36) | s⊥(K), s⊥(K′) | 0.5, 0.5 | 0.50000, 0.50000 |
| Double-Q skyrmion, L = 32, 16 cells | Qtop (m₀ = ±0.5) | ∓16 | ∓16.000 |
| Triple-Q skyrmion, L = 36, 9 cells | Qtop (m₀ = 0.5) | 9 | 9.000 |
| Meron–antimeron, L = 32 | Qtop, core charges, min |m| before normalization | 0, ±½ (ideal), > 0 | 0.000, ±0.42, 0.50 |
| Triple-Q, L = 36, m₀ = 1.2 / 2 | Qtop per cell | −2 / 0 | −2.000 / 0.000 |
| Phase disorder 1D, N = 240, 64 samples | ξ (from HWHM) | 4, 8, 16 | 4.8, 9.2, 16.8 |
The small deviation for the square-wave SDW is the difference between the continuous square wave and the square wave sampled on the lattice. The deviation in ξ comes from the phase difference growing as \(r(N-r)/N\) on a periodic ring, and from finite-sample noise.
9. Technical note
- One file, no installation. The page is a single HTML file: HTML, CSS and plain JavaScript. No build step, plug-in or extra program is needed. It opens in any current browser (Chrome, Firefox, Safari, Edge) and also works on phones and tablets.
- Computation in the browser. Generation of the configurations, the discrete Fourier transform, the structure factor, the correlation function, the Berg–Lüscher topological charge and the Fourier synthesis are all done by the JavaScript code inside the page. The Fourier transform is a separable direct DFT (\(O(L^3)\) in 2D); no external numerical library is used. There is no server side, and no data is sent anywhere.
- Graphics. All figures are drawn with HTML5 Canvas 2D, without a charting library. Colours follow the operating system's light/dark theme preference.
- Loaded from the internet. Only two things: MathJax 3.2.2 (cdnjs) to typeset the formulas, and the fonts (Google Fonts: Spectral, IBM Plex Sans, JetBrains Mono). Without a connection the simulation works fully; the fonts fall back to system fonts and the formulas appear as raw TeX.
- Reproducibility. Random numbers come from a seeded generator (mulberry32). The same settings and the same sample number give the same configuration on every computer.
- Publishing. Copying the file to any static web server is enough. The Turkish and English versions should sit in the same folder; the language link at the top of the page points from one to the other. To open the lab directly in full-page mode, append
#labto the address. - Source code. The complete code is inside the file and can be read with “view source” in the browser.