ddx 0.6.0
Libary for domain-decomposition methods for polarizable continuum models
ddx_solvers Module Reference

Core routines and parameters of ddX software. More...

Data Types

interface  matvec_interface
 
interface  matvec_interface_external
 
interface  norm_interface
 

Functions/Subroutines

subroutine jacobi_diis (params, constants, workspace, tol, rhs, x, niter, x_rel_diff, matvec, dm1vec, norm_func, ddx_error)
 Jacobi iterative solver. More...
 
subroutine diis (n, nmat, ndiis, x, e, b, xnew)
 DIIS helper routine. More...
 
subroutine makeb (n, nmat, ndiis, e, b)
 DIIS helper routine. More...
 
subroutine jacobi_diis_external (params, constants, workspace, n, tol, rhs, x, n_iter, x_rel_diff, matvec, dm1vec, norm_func, ddx_error)
 jacobi_diis_solver_external WARNING: code duplication is bad, but here it makes a very specific sense. in ddLPB, we are solving a linear system with Jacobi DIIS also to apply the preconditioner. As calling a solver recursively is a terrible idea, we create a copy of jacobi_diis that: More...
 

Detailed Description

Core routines and parameters of ddX software.

Function/Subroutine Documentation

◆ jacobi_diis()

subroutine ddx_solvers::jacobi_diis ( type(ddx_params_type), intent(in)  params,
type(ddx_constants_type), intent(in)  constants,
type(ddx_workspace_type), intent(inout)  workspace,
real(dp), intent(in)  tol,
real(dp), dimension(constants % n), intent(in)  rhs,
real(dp), dimension(constants % n), intent(inout)  x,
integer, intent(inout)  niter,
real(dp), dimension(niter), intent(out)  x_rel_diff,
procedure(matvec_interface matvec,
procedure(matvec_interface dm1vec,
procedure(norm_interface norm_func,
type(ddx_error_type), intent(inout)  ddx_error 
)

Jacobi iterative solver.

Parameters
[in]paramsUser input parameters for the ddX.
[in]constantsPrecomputed constants for the ddX.
[in,out]workspaceTemporary workspace for the ddX.
[in]tolRelative error threshold to stop iterations.
[in]rhsRight hand side.
[in,out]xOn input, containts an initial guess to a solution. On exit, returns
[in,out]niterMaximal number of iterations on input. On exit, contains a number of actually performed matrix-vector products.
[out]x_rel_diffRelative difference between old and new values of the solution on each iteration.
[in]matvecRoutine that performs
[in]dm1vec
[in]norm_func
[in,out]ddx_errorddX error

Definition at line 84 of file ddx_solvers.f90.

◆ diis()

subroutine ddx_solvers::diis ( integer, intent(in)  n,
integer, intent(inout)  nmat,
integer, intent(in)  ndiis,
real(dp), dimension(n,ndiis), intent(inout)  x,
real(dp), dimension(n,ndiis), intent(inout)  e,
real(dp), dimension(ndiis+1,ndiis+1), intent(inout)  b,
real(dp), dimension(n), intent(inout)  xnew 
)

DIIS helper routine.

Definition at line 162 of file ddx_solvers.f90.

◆ makeb()

subroutine ddx_solvers::makeb ( integer, intent(in)  n,
integer, intent(in)  nmat,
integer, intent(in)  ndiis,
real(dp), dimension(n,ndiis), intent(in)  e,
real(dp), dimension(ndiis+1,ndiis+1), intent(inout)  b 
)

DIIS helper routine.

Definition at line 214 of file ddx_solvers.f90.

◆ jacobi_diis_external()

subroutine ddx_solvers::jacobi_diis_external ( type(ddx_params_type), intent(in)  params,
type(ddx_constants_type), intent(inout)  constants,
type(ddx_workspace_type), intent(inout)  workspace,
integer, intent(in)  n,
real(dp), intent(in)  tol,
real(dp), dimension(n), intent(in)  rhs,
real(dp), dimension(n), intent(inout)  x,
integer, intent(inout)  n_iter,
real(dp), dimension(n_iter), intent(out)  x_rel_diff,
external  matvec,
external  dm1vec,
procedure(norm_interface norm_func,
type(ddx_error_type), intent(inout)  ddx_error 
)

jacobi_diis_solver_external WARNING: code duplication is bad, but here it makes a very specific sense. in ddLPB, we are solving a linear system with Jacobi DIIS also to apply the preconditioner. As calling a solver recursively is a terrible idea, we create a copy of jacobi_diis that:

  • takes as an input the size of the system to be solved (no hardcoded dependence on nsph)
  • uses copies of the norm subroutine, so that it can also be called with a user-given size for arrays

Definition at line 263 of file ddx_solvers.f90.