SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
86 stars 19 forks source link

Ornl additions #32

Closed ddahlbom closed 2 years ago

ddahlbom commented 2 years ago

This PR contains some functionality that will be useful to have for the ORNL workshop. In particular:

  1. Sakib's form factor function is tied into the structure factor framework. Keywords ff_elem=nothing and lande=false have been added to dynamic_structure_factor. If a valid element is given to ff_elem, the form factor will be applied to the result. Additionally, there is a public function apply_form_factor which can be used on an already existing structure factor.
  2. Added a simple function to create a new larger system from an existing smaller system. The spin configuration of the smaller system is simply extended periodically.
  3. Added a function for generating slices from a structure factor by specifying a sequence of points in momentum space. It doesn't interpolate by default, but it can do so. This adds Interpolations.jl as a dependency, which is quite lightweight.

Additionally,

  1. The memory layout of the omega axis has been changed. It now goes from $-\omega{\textrm{max}}$ to $\omega{\textrm{max}}$. 0 energy corresponds to index 0.
  2. Some bugs have been fixed. (Indexing problem in structure factor calculation when both reduce_basis and dipole_factor are set to false. Missing brackets in brav_lattice function.)
ddahlbom commented 2 years ago

Also, I made some minor revisions to the tests, in particular I added an explicit RNG with seed to tests where this matters.

I briefly looked into speeding up the tests. This will take more investigation. Consider the Langevin tests: If I pull out the individual tests and run them as regular scripts, each of the three tests takes significantly less than a second. However, when I call Pkg.test("Sunny", test_args=["test_langevin"]), the tests takes 30 seconds. If I run the entire test suite, the Langevin tests take about 7 seconds, presumably because some relevant compilation has already occurred. Perhaps this comes down to the use of StaticArrays for SU(N) when N<6, but I suspect something else may be going on.