$$\mathcal{S}(q,\omega) \sim \sum_t e^{- i \omega t} \langle M(-q,0) M(q,t)\rangle,$$
describes transfer of momentum $q$ and energy $\omega$ to the sample. Sunny seems to be calculating this incorrectly?
Update. Here is a retrospective on what the bugs were, and how they were fixed in Sunny 0.6:
Sunny LSWT code seems correct. The internal conventions flip the sign of $q$ in both of the above equations, such that the physical meaning of $q$ stays intact: it is correctly describing the momentum transfer to the sample. Since Sunny agrees with SpinW, this also indicates that SpinW is using the correct conventions, despite an apparent typo in Eq. (35) of Toth & Lake.
For SampledCorrelations, we now understand that 0.5.x had multiple sign errors, which sometimes cancelled. First, an error in the sign of the Zeeman coupling (#190). Second, an error in the direction of time in the Landau-Lifshitz spin dynamics (now fixed in #247). Third, an error in the conventions for wavevector $q$, relative to the equations above (now fixed in #271).
Note that the new momentum transfer conventions are illustrated in Example 8 of our documentation. This example considers a solvable model (1D chain with DM and Zeeman coupling) where $\pm q$ are inequivalent. The equivalent SpinW calculation differs from Sunny by an overall sign in $q$. The origin of this sign is likely a different sign convention for the Zeeman coupling (see #190, for the corresponding discussion and fix in Sunny).
For magnetic moments that are defined as,
$$M(q) \sim \sum_r e^{+ i q r} M(r)$$
the dynamical structure factor,
$$\mathcal{S}(q,\omega) \sim \sum_t e^{- i \omega t} \langle M(-q,0) M(q,t)\rangle,$$
describes transfer of momentum $q$ and energy $\omega$ to the sample. Sunny seems to be calculating this incorrectly?
Update. Here is a retrospective on what the bugs were, and how they were fixed in Sunny 0.6:
Sunny LSWT code seems correct. The internal conventions flip the sign of $q$ in both of the above equations, such that the physical meaning of $q$ stays intact: it is correctly describing the momentum transfer to the sample. Since Sunny agrees with SpinW, this also indicates that SpinW is using the correct conventions, despite an apparent typo in Eq. (35) of Toth & Lake.
For
SampledCorrelations
, we now understand that 0.5.x had multiple sign errors, which sometimes cancelled. First, an error in the sign of the Zeeman coupling (#190). Second, an error in the direction of time in the Landau-Lifshitz spin dynamics (now fixed in #247). Third, an error in the conventions for wavevector $q$, relative to the equations above (now fixed in #271).Note that the new momentum transfer conventions are illustrated in Example 8 of our documentation. This example considers a solvable model (1D chain with DM and Zeeman coupling) where $\pm q$ are inequivalent. The equivalent SpinW calculation differs from Sunny by an overall sign in $q$. The origin of this sign is likely a different sign convention for the Zeeman coupling (see #190, for the corresponding discussion and fix in Sunny).