spirit-code / spirit

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

Core: sparse Hessian and dynamical matrices when no dipole-dipole #454

Open GPMueller opened 5 years ago

GPMueller commented 5 years ago

The ratio of filled to empty 3x3 blocks in the Hessian is (N_pairs+1)/N_spins (where N_pairs = max(N_pairs(Exchange), N_pairs(DMI)) if no dipole-dipole interaction is used. When this ratio is small enough (what is small enough?), sparse matrices should be used to save computational work and especially memory. The dynamical matrix should have the same ratio, but I am not 100% sure there.

For the case of dipole-dipole interaction, dense matrices should always be used.

The question is how this should be done - I believe Eigen and Spectra do not have a base class for sparse and dense matrices, i.e. functions would have to accept either a dense or a sparse matrix... See

GPMueller commented 5 years ago

A critical issue with this idea is that the eigenvectors will still be dense. If all eigenvectors and/or eigenvalues are needed, the benefits are quite small over the significant effort needed to implement this.

Unfortunately, dense vs. sparse cannot simply be abstracted away using the Eigen interfaces.