Skip to content

User-friendly exact diagonalization package written in Haskell. Can treat systems of up to 𝒪(42) spins!

License

Notifications You must be signed in to change notification settings

twesterhout/spin-ed

Repository files navigation

SpinED

GitHub CI GitHub Release BSD-3-Clause license

User-friendly exact diagonalization package for quantum many-body systems.

🔧 Installing

We provide pre-built static executables for Linux. Go to Releases page and download the executable to your location of choice. That's it! 🥳

ℹ️ Note: executables are currently tagged by git commits from which they were built. It is suggested that after downloading the application you create a symbolic link to it:

ln --symbolic SpinED SpinED-8b0138b # the commit hash may differ in your case

📝 Usage

Using SpinED is quite simple. Just feed it your input yaml file. For example:

./SpinED my_system.yaml

where my_system.yaml looks like this:

basis:
  number_spins: 4
  symmetries: []
hamiltonian:
  name: "Heisenberg Hamiltonian"
  terms:
    - matrix: [[1,  0,  0,  0],
               [0, -1,  2,  0],
               [0,  2, -1,  0],
               [0,  0,  0,  1]]
      sites: [[0, 1], [1, 2], [2, 3], [3, 0]]
observables: []

This will create a file exact_diagonalization_result.h5 which will contain the ground state of the Hamiltonian.

$ h5dump -H exact_diagonalization_result.h5
HDF5 "exact_diagonalization_result.h5" {
GROUP "/" {
   GROUP "basis" {
      DATASET "representatives" {
         DATATYPE  H5T_STD_U64LE
         DATASPACE  SIMPLE { ( 16 ) / ( 16 ) }
      }
   }
   GROUP "hamiltonian" {
      DATASET "eigenvalues" {
         DATATYPE  H5T_IEEE_F64LE
         DATASPACE  SIMPLE { ( 1 ) / ( 1 ) }
      }
      DATASET "eigenvectors" {
         DATATYPE  H5T_IEEE_F64LE
         DATASPACE  SIMPLE { ( 16, 1 ) / ( 16, 1 ) }
      }
      DATASET "residuals" {
         DATATYPE  H5T_IEEE_F64LE
         DATASPACE  SIMPLE { ( 1 ) / ( 1 ) }
      }
   }
}
}

And we can check that it computed the correct energy:

$ h5dump -d /hamiltonian/eigenvalues exact_diagonalization_result.h5
HDF5 "exact_diagonalization_result.h5" {
DATASET "/hamiltonian/eigenvalues" {
   DATATYPE  H5T_IEEE_F64LE
   DATASPACE  SIMPLE { ( 1 ) / ( 1 ) }
   DATA {
   (0): -8
   }
}
}

This was a very simple example! Have a look at template.yaml which describes all supported fields. example/ folder also contains various usage examples.

Contributing and support

If you use this package for your research and have questions or suggestions, please, don't hesitate to contact me on Github or email.

Also, if the fact that most code here is written in Haskell doesn't scare you, feel free to create a pull request implementing new features or fixing bugs!