potential
Potential module.
This module contains predefined potential functions that can be used to generate electrostatic potentials for the simulation. The potential functions take a coordinate array as input and return the corresponding potential energy values.
Examples:
>>> import wave_packet_dynamics as wpd
>>> x = wpd.Grid((-1, 1), 11).coordinates
>>> V = wpd.potential.harmonic(x, k=5, x0=0)
>>> V
array([2.5, 1.6, 0.9, 0.4, 0.1, 0. , 0.1, 0.4, 0.9, 1.6, 2.5])
With the help of functools.partial, the potential function can be
converted into a Callable that only takes the coordinate array as an
argument.
>>> from functools import partial
>>> V = partial(wpd.potential.barrier, w=0.5, h=1)
>>> V(x)
array([0., 0., 0., 0., 1., 1., 1., 0., 0., 0., 0.])
zero(x: NDArray[np.float64]) -> NDArray[np.float64]
harmonic(x: NDArray[np.float64], *, k: float, x0: float = 0.0) -> NDArray[np.float64]
Harmonic potential function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
NDArray[float64]
|
Coordinate array. |
required |
k |
float
|
Force constant of the harmonic potential. |
required |
x0 |
float
|
Coordinate of the potential minimum. |
0.0
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Discretized harmonic potential. |
Notes
barrier(x: NDArray[np.float64], *, h: float, w: float, x0: float = 0.0) -> NDArray[np.float64]
Rectangular barrier potential function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
NDArray[float64]
|
Coordinate array. |
required |
h |
float
|
Height of the potential. |
required |
w |
float
|
Width of the potential. |
required |
x0 |
float
|
Center of the potential. |
0.0
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Discretized rectangular barrier potential. |
Notes
step(x: NDArray[np.float64], *, h: float, x0: float = 0.0) -> NDArray[np.float64]
Step potential function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
NDArray[float64]
|
Coordinate array. |
required |
h |
float
|
Height of the potential. |
required |
x0 |
float
|
Coordinate of the step. |
0.0
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Discretized step potential. |