项目作者: NLESC-JCER

项目描述 :
Davidson eigensolver implemented in Fortran
高级语言: Fortran
项目地址: git://github.com/NLESC-JCER/Fortran_Davidson.git
创建时间: 2019-01-09T17:24:33Z
项目社区:https://github.com/NLESC-JCER/Fortran_Davidson

开源协议:Apache License 2.0

下载


Build Status Pipeline DOI

Davidson Eigensolver

This package contains a Modern Fortran implementation of the Davidson diagonalization algorithms.
Different schemas are available to compute the correction.

Available correction methods are:

  • DPR: Diagonal-Preconditioned-Residue
  • GJD: Generalized Jacobi Davidson

Note:

The Davidson method is suitable for diagonal-dominant symmetric matrices, that are quite common
in certain scientific problems like electronic structure. The Davidson method could be not practical
for other kinds of symmetric matrices.

Usage

The following program call the eigensolver subroutine from the davidson module and computes
the lowest 3 eigenvalues and corresponding eigenvectors, using the GJD method with a tolerance
of 1e-8 and 100 maximum iteration.

  1. program main
  2. use numeric_kinds, only: dp
  3. use davidson, only: generalized_eigensolver, generate_diagonal_dominant
  4. implicit none
  5. integer, parameter :: dim = 50
  6. integer, parameter :: lowest = 3
  7. real(dp), dimension(dim, dim) :: matrix, second_matrix
  8. real(dp), dimension(lowest) :: eigenvalues
  9. real(dp), dimension(dim, lowest) :: eigenvectors
  10. real(dp) :: tolerance
  11. integer:: max_dim_subspace, max_iterations, lowest
  12. matrix = generate_diagonal_dominant(dim, 1d-4)
  13. second_matrix = generate_diagonal_dominant(dim, 1d-4, 1.0_dp)
  14. max_iterations = 1000
  15. max_dim_subspace = 20
  16. tolerance = 1d-8
  17. call generalized_eigensolver(matrix, eigenvalues, eigenvectors, lowest, "GJD", max_iterations, &
  18. tolerance, final_iterations, max_dim_subspace, second_matrix)
  19. print *, eigenvalues
  20. print *, eigenvectors
  21. end program main

The helper generate_diagonal_dominant function generates a diagonal dominant
matrix with entries to the diagonal close to row number (i=1, number_of_rows)
and random number of the order 1e-4 on the off-diagonal entries.

Variables:

  • matrix (in) matrix to diagonalize
  • eigenvalues (out) resulting eigenvalues
  • eigenvectors (out) resulting eigenvectors
  • lowest(in) number of eigenvalues to compute
  • method(in) Either “DPR” or “GJD”
  • max_iterations(in) maximum number of iterations
  • tolerance(in) Numerical tolerance for convergence
  • final_iterations(output) returns the number of iterations that were needed to converge
  • max_dim_subspace(in, optional) Dimension of the subspace of search
  • second_matrix(in, optional) Optional matrix to compute the generalized eigenvalue problem

References:

Installation and Testing

To compile execute:

  1. cmake -H. -Bbuild && cmake --build build

To use another compiler (e.g. ifort):

  1. cmake -H. -Bbuild -DCMAKE_Fortran_COMPILER=ifort && cmake --build build

To run the test:

  1. cmake -H. -Bbuild -DENABLE_TEST=ON && cmake --build build
  2. cd build && ctest -V

To Debug compile as:

  1. cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug && cmake --build build

Dependencies

This packages assumes that you have installed the following packages:

Optionally, If an MKL library is available the package will try to find it.