grid.poisson module#
Poisson solver module.
This module solves the following Poisson equation:
for some Coulomb potential \(V(r)\) and charge density \(\rho(r)\) over a centered atomic grid. It is recommended to use the boundary value problem for handing singularities near the origin of the atomic grid.
- grid.poisson.solve_poisson_bvp(molgrid: MolGrid | AtomGrid, func_vals: ndarray, transform: BaseTransform, boundary: float | None = None, include_origin: bool = True, remove_large_pts: float = 1000000.0, ode_params: dict | None = None)#
Return interpolation of the solution to the Poisson equation solved as a boundary value problem.
The Poisson equation solves for function \(g\) of the following:
\[\nabla^2 g = (-4\pi) f,\]for a fixed function \(f\), where \(\nabla^2\) is the Laplacian. This is transformed to an set of ODE problems as a boundary value problem. [1]
If boundary is not provided, then the boundary of \(g\) for large r is set to \(\int \int \int f(r, \theta, \phi) / r\). The solution \(g\) is assumed to be zero at the origin \(g(0, \theta, \phi) = 0\). Use solve_poisson_ivp if this assumption isn’t needed.
Parameters#
- molgridMolGrid or AtomGrid
Molecular or atomic grid that is used for integration and expanding func into real spherical harmonic basis.
- func_valsndarray(N,)
The function values evaluated on all \(N\) points on the molecular grid.
- transformBaseTransform, optional
Transformation from infinite domain \(r \in [0, \infty)\) to another domain that is a finite.
- boundaryfloat, optional
The boundary value of \(g\) in the limit of r to infinity.
- include_originbool, optional
If true, will add r=0 point when solving for the ode only. If false, it is recommended to have many radial points near the origin.
- remove_large_ptsfloat, optional
If true, will remove any points larger than remove_large_pts when solving for the ode only.
- ode_paramsdict, optional
The parameters for the ode solver. See grid.ode.solve_ode_bvp for all options.
Returns#
- callable(ndarray(N, 3) -> float) :
The solution to Poisson equaiton/potential \(g : \mathbb{R}^3 \rightarrow \mathbb{R}\).
References#
- grid.poisson.solve_poisson_ivp(molgrid: MolGrid | AtomGrid, func_vals: ndarray, transform: BaseTransform, r_interval: tuple = (1000, 1e-05), ode_params: dict | None = None)#
Return interpolation of the solution to the Poisson equation solved as an initial value problem.
The Poisson equation solves for function \(g\) of the following:
\[\nabla^2 g = (-4\pi) f,\]for a fixed function \(f\), where \(\nabla^2\) is the Laplacian. This is transformed to a set of ODE problems as an initial value problem.
Ihe initial value problem is chosen so that the boundary of \(g\) for large r is set to \(\int \int \int f(r, \theta, \phi) / r\). Depending on \(f\), this function has difficulty in capturing the origin \(r=0\) region, and is recommended to keep the final interval \(a\) close to zero.
Parameters#
- molgridMolGrid or AtomGrid
Molecular or atomic grid that is used for integration and expanding func into real spherical harmonic basis.
- func_valsndarray(N,)
The function values evaluated on all \(N\) points on the molecular grid.
- transformBaseTransform, optional
Transformation from infinite domain \(r \in [0, \infty)\) to another domain that is a finite.
- r_intervaltuple, optional
The interval \((b, a)\) of \(r\) for which the ODE solver will start from and end, where \(b>a\). The value \(b\) should be large as it determines the asymptotic region of \(g\) and value \(a\) is recommended to be small but not zero depending on \(f\).
- ode_paramsdict, optional
The parameters for the ode solver. See grid.ode.solve_ode_ivp for all options.
Returns#
- callable(ndarray(N, 3) -> float) :
The solution to Poisson equaiton/potential \(g : \mathbb{R}^3 \rightarrow \mathbb{R}\).