Laplace quadrature

ElemCo.LaplaceQuadratureModule
LaplaceQuadrature module

This module provides functions to compute Laplace quadrature points and weights for MP2 calculations using the minimax (Remez) algorithm, as described by Takatsuka et al. in J. Chem. Phys. 129, 044112 (2008) or using the Häser-Almlöf simplex method.

It includes functions for both unweighted and weighted Laplace quadrature, where the latter uses a distribution function to improve accuracy.

source

Exported functions

ElemCo.LaplaceQuadrature.get_laplace_quadratureMethod
get_laplace_quadrature(εo::Vector{Float64}, εv::Vector{Float64}, npoints::Int; use_distribution::Bool=false, algo=:minimax)

Given occupied and virtual orbital energies, compute Laplace quadrature points and weights. When use_distribution=true, uses distribution function weighting for improved accuracy. algo parameter selects the algorithm (:minimax or :simplex).

Returns:

  • Tuple (weights, points): wq and tq for Laplace quadrature
source
ElemCo.LaplaceQuadrature.get_laplace_quadrature_simplexMethod
get_laplace_quadrature_simplex(εo::Vector{Float64}, εv::Vector{Float64}, npoints::Int)

Given occupied and virtual orbital energies, compute Laplace quadrature points and weights. When use_distribution=true, uses distribution function weighting for improved accuracy. Wrapper function for simplex-based Laplace quadrature calculation.

Returns:

  • Tuple (weights, points): wq and tq for Laplace quadrature
source

Internal functions

ElemCo.LaplaceQuadrature.build_distribution_functionMethod
build_distribution_function(εo::Vector{Float64}, εv::Vector{Float64})

Build the distribution function f(x) for energy denominators following Häser-Almlöf. Creates histograms of Δᵢᵃ = εₐ - εᵢ using 600 bins, then combines them into 1200 bins.

Returns:

  • x_grid: Grid points for the distribution (1200 points)
  • f_x: Distribution function values at grid points
  • xmin, xmax: Range of energy denominators
source
ElemCo.LaplaceQuadrature.calc_laplace_pointsMethod
calc_laplace_points(emin, emax, npoints::Int)

Compute Laplace quadrature points and weights for Laplace MP2 using the minimax (Remez) algorithm from Takatsuka et al., J. Chem. Phys. 129, 044112 (2008). Returns (weights, points).

source
ElemCo.LaplaceQuadrature.calc_laplace_points_simplexMethod
calc_laplace_points_simplex(εo::Vector{Float64}, εv::Vector{Float64}, npoints::Int;
                           include_zero::Bool=true, maxiter::Int=1000, tol::Scalar=1e-8)

Calculate Laplace quadrature points and weights using the Häser-Almlöf simplex method.

Parameters:

  • εo: Occupied orbital energies
  • εv: Virtual orbital energies
  • npoints: Total number of quadrature points
  • include_zero: Whether to include and fix t=0 point
  • maxiter: Maximum iterations for simplex optimization
  • tol: Convergence tolerance

Returns:

  • Tuple (weights, points): wq and tq for Laplace quadrature
source
ElemCo.LaplaceQuadrature.calculate_weightsMethod
calculate_weights(t_points::Vector{Scalar}, x_grid::Vector{Scalar}, f_x::Vector{Scalar})

Calculate optimal weights for given t_points by solving the linear least-squares system. The weights minimize ∫ f(x) * (1/x - Σq wq * exp(-x*tq))² dx.

Returns:

  • w: Optimal weights
source
ElemCo.LaplaceQuadrature.find_weighted_extremaMethod
find_weighted_extrema(E::Function, dE::Function, x_grid::Vector{Scalar}, f_x::Vector{Scalar}, 
                     emin::Scalar, emax::Scalar, nroots::Int, tol::Scalar)

Find extrema of the error function weighted by the distribution function.

source
ElemCo.LaplaceQuadrature.get_initial_laplaceMethod
get_initial_laplace(npoints::Int, R::Scalar, filename::String)

Obtain initial guess for Laplace quadrature points from a table file.

  • npoints: number of quadrature points
  • R: emax/emin
  • filename: path to the table file

Returns: Vector of points (t), weights (w) and the tabulated R

source
ElemCo.LaplaceQuadrature.get_laplace_quadrature_minimaxMethod
get_laplace_quadrature_minimax(εo::Vector{Float64}, εv::Vector{Float64}, npoints::Int; use_distribution::Bool=false)

Given occupied and virtual orbital energies, compute Laplace quadrature points and weights. When use_distribution=true, uses distribution function weighting for improved accuracy. Wrapper function for minimax-based Laplace quadrature calculation.

Returns:

  • Tuple (weights, points): wq and tq for Laplace quadrature
source
ElemCo.LaplaceQuadrature.nelder_mead_simplexMethod
nelder_mead_simplex(f, x0::Vector{Scalar}; 
                    maxiter=1000, tol=1e-8, α=1.0, β=0.5, γ=2.0, δ=0.5)

Simple Nelder-Mead simplex optimization.

  • f: objective function
  • x0: initial point
  • Returns: optimized point
source
ElemCo.LaplaceQuadrature.objective_functionMethod
objective_function(t_points::Vector{Scalar}, x_grid::Vector{Scalar}, f_x::Vector{Scalar})

Compute the least-squares objective function for given t_points. Returns the value of ∫ f(x) * (1/x - Σq wq * exp(-x*tq))² dx.

source