17.1.1.17. pysisyphus.numerov package
17.1.1.17.1. Submodules
17.1.1.17.2. pysisyphus.numerov.driver module
- pysisyphus.numerov.driver.get_A(n, d, coeffs)[source]
Dense A-build.
TODO: given the fact how simple the code for the sparse build is maybe we should just use it and convert the sparse matrix to a dense matrix, if desired. Then we could also delete off_diag_indices.
17.1.1.17. Parameter
- n
Number of rows & columns in A.
- d
Step size.
- stencil
Finite-differences stencil.
- returns:
Dense A matrix of improved Numerov method.
- rtype:
A
- pysisyphus.numerov.driver.get_A_periodic(n, d, coeffs)[source]
Dense A-build for a periodic potential.
17.1.1.17. Parameter
- n
Number of rows & columns in A.
- d
Step size.
- stencil
Finite-differences stencil.
- returns:
Dense A matrix of improved Numerov method and a periodic potential.
- rtype:
A
- pysisyphus.numerov.driver.get_A_periodic_sparse(n, d, coeffs)[source]
Sparse A-build for a periodic potential w/ DIAgonal storage.
17.1.1.17. Parameter
- n
Number of rows & columns in A.
- d
Step size.
- stencil
Finite-differences stencil.
- periodic
Whether periodic boundary calculations are used or not.
- returns:
Sparse A matrix of improved Numerov method with DIAgonal storage and a periodic potential.
- rtype:
A
- pysisyphus.numerov.driver.get_A_sparse(n, d, coeffs)[source]
Sparse A-build w/ DIAgonal storage.
17.1.1.17. Parameter
- n
Number of rows & columns in A.
- d
Step size.
- stencil
Finite-differences stencil.
- periodic
Whether periodic boundary calculations are used or not.
- returns:
Sparse A matrix of improved Numerov method with DIAgonal storage.
- rtype:
A
- pysisyphus.numerov.driver.off_diag_indices(n, k=0)[source]
Return (off-)diagonal indices for a n-by-n matrix.
To get the indices for a matrix of shape (500, 500) and a stencil size of 5 this function must be called as 'off_diag_indices(500, 5)'.
- Parameters:
n (
int) -- Length of the diagonal for k = 0 (number of rows/columns of the matrix).k (
int, default:0) -- Diagonal offset. For k = 0 indices for the main diagonal are returned. Positive k values 0 < k <= n - 1 yield indexs for diagonals above the main diagonal. Negative k value n - 1 <= k < 0 yield indexes for diagonals below the main diagonal.
- Returns:
Tuple containing 2 1d-integer arrays indexing the desired diagonal.
- Return type:
diag_indices
- pysisyphus.numerov.driver.run(grid, energy_getter, mass, nstates=50, accuracy=10, periodic=False, normalize=True)[source]
Improved 1d-Numerov method using a sparse matrix diagonalization.
TODO: Normalize eigenvectors already here?
- Parameters:
grid (
ndarray) -- 1d array containing an evenly spaced grid.energy_getter (
Callable[[int,float],float]) -- Callable that takes two arguments: an integer grid index and the floating point coordinate at this index. The index is useful in cases when all energies are already present and only have to be looked up.mass (
float) -- Mass in atomic units for the kinetic energy calculation.nstates (
int, default:50) -- Number of desired eigenstates to be calculated. Defaults to 50. As we use a sparse matrix diagonalization algorithm from scipy that converged the first nstats smallest eigenvalues nstates must be smaller than the number of grid points.accuracy (
Literal[2,4,6,8,10], default:10) -- Kind of stencil used for the improved Numerov-method. Must be one ofperiodic (
bool, default:False) -- Boolean flag that indicates whether the potential is periodic or not.normalize (default:
True) -- Whether the returned eigenvectors are normalized so that |ψ|² integrates to 1.0. If set to False, than the Euclidian norm of the eigenvetors will be 1.0, but the integral over the grid is most likely != 1.0
- Returns:
w -- 'nstates' smallest eigenvalues for given potential.
v -- 'nstates' eigenvectors belonging to the calculated eigenvectors.