pyalchemy package
Submodules
pyalchemy.kernels module
A module which provides implementations of the kernel of the Alchemical Integral Transform (AIT) in 1D, 2D, 3D.
Throughout this code, Hartree atomic units are used.
- pyalchemy.kernels.kernel_1D(partial_v_A, partial_v_B, x, orders=[1, 2, 3], verbose=False)
1D kernel of the Alchemical Integral Transform
- Parameters:
- partial_v_Acallable
A function of the initial system’s external potential in 1D. It expects two arguments,
n_x
andx
, such thatpartial_v_A(n_x, x)
\(= \frac{\partial^{n_x} }{\partial x^{n_x}} v_A(x)\)- partial_v_Bcallable
A function of the final system’s external potential in 1D. It expects two arguments,
n_x
andx
, such thatpartial_v_B(n_x, x)
\(= \frac{\partial^{n_x} }{\partial x^{n_x}} v_B(x)\)- xfloat
coordinate
- orderslist, optional
A list of the orders \(p\) in the kernel to be summed over. Recommended are at least
[1,2,3]
, precise is[1,2,3,4,5]
. \(p\) is implemented up to and including 9-th order- verbosebool, optional
If
True
, prints a warning if the naive convergence criterion \(|1 - v_B(x)/v_A(x)| < 1\) is violated. This does not imply divergence of the series but may hint towards too large differences between initial and final system.
- Returns:
- float
The 1D kernel of AIT between systems A and B at
x
for all orders inorders
.
- pyalchemy.kernels.kernel_2D(partial_v_A, partial_v_B, x, y, orders=[1, 2, 3], verbose=False)
2D kernel of the Alchemical Integral Transform
- Parameters:
- partial_v_Acallable
A function of the initial system’s external potential in 2D. It expects four arguments,
n_x, n_y
andx, y
, such thatpartial_v_A(n_x, n_y, x, y)
\(= \frac{\partial^{n_x + n_y} }{\partial x^{n_x} \partial y^{n_y} } v_A(x,y)\)- partial_v_Bcallable
A function of the final system’s external potential in 2D. It expects four arguments,
n_x, n_y
andx, y
, such thatpartial_v_B(n_x, n_y, x, y)
\(= \frac{\partial^{n_x + n_y} }{\partial x^{n_x} \partial y^{n_y} } v_B(x,y)\)- x, yfloat
coordinates
- orderslist, optional
A list of the orders \(p\) in the kernel to be summed over. Recommended are at least
[1,2,3]
, precise is[1,2,3,4,5]
. \(p\) is implemented up to and including 9-th order- verbosebool, optional
If
True
, prints a warning if the naive convergence criterion \(|1 - v_B(x,y)/v_A(x,y)| < 1\) is violated. This does not imply divergence of the series but may hint towards too large differences between initial and final system.
- Returns:
- float
The 2D kernel of AIT between systems A and B at
x, y
for all orders inorders
.
- pyalchemy.kernels.kernel_3D(partial_v_A, partial_v_B, x, y, z, orders=[1, 2, 3], verbose=False)
3D kernel of the Alchemical Integral Transform
- Parameters:
- partial_v_Acallable
A function of the initial system’s external potential in 3D. It expects six arguments,
n_x, n_y, n_z
andx, y, z
, such thatpartial_v_A(n_x, n_y, n_z, x, y, z)
\(= \frac{\partial^{n_x + n_y + n_z} }{\partial x^{n_x} \partial y^{n_z} \partial y^{n_z} } v_A(x,y,z)\)- partial_v_Bcallable
A function of the final system’s external potential in 3D. It expects six arguments,
n_x, n_y, n_z
andx, y, z
, such thatpartial_v_B(n_x, n_y, n_z, x, y, z)
\(= \frac{\partial^{n_x + n_y + n_z} }{\partial x^{n_x} \partial y^{n_z} \partial y^{n_z} } v_B(x,y,z)\)- x, y, zfloat
coordinates
- orderslist, optional
A list of the orders \(p\) in the kernel to be summed over. Recommended are at least
[1,2,3]
, precise is[1,2,3,4,5]
. \(p\) is implemented up to and including 9-th order- verbosebool, optional
If
True
, prints a warning if the naive convergence criterion \(|1 - v_B(x,y,z)/v_A(x,y,z)| < 1\) is violated. This does not imply divergence of the series but may hint towards too large differences between initial and final system.
- Returns:
- float
The 3D kernel of AIT between systems A and B at
x, y, z
for all orders inorders
.
pyalchemy.potentials module
A module which provides implementations of the Coulombic potential in 3D
Throughout this code, Hartree atomic units are used.
- pyalchemy.potentials.partial_v_mol_3D(mole, n_x, n_y, n_z, x, y, z, nuc_rad=0)
A function for the external potential in 3D of a given molecule and its spatial derivatives. These derivatives are analytical up to and including third order \(n_x+n_y+n_z \leq 3\), and defined recursively via finite differences for higher orders.
- Parameters:
- molearray of shape (…, 4)
A list of lists of the 4D coordinates (nuclear charge \(Z_i\), coordinates \(x_i, y_i, z_i\) of all atoms, i.e.
mole = [[Z_1, x_1, y_1, z_1], [Z_2, x_2, y_2, z_2], ...]
- n_x, n_y, n_zint
Order of the derivative
- x, y, zfloat
coordinates
- nuc_radfloat, optional
An optional nuclear radius \(\eta\) such that the Coulomb potential is rendered finite everywhere: \(\frac{-Z_i}{\sqrt{(x - x_i)^2 + (y - y_i)^2 + (z - z_i)^2}} \rightarrow \frac{-Z_i}{\sqrt{(x - x_i)^2 + (y - y_i)^2 + (z - z_i)^2 + \eta^2}}\)
- Returns:
- float
the \(n_x+n_y+n_z\)-th derivative of the external potential of
mole
with nuclear radiusnuc_rad
atx,y,z
, i.e. \(\frac{\partial^{n_x + n_y + n_z} }{\partial x^{n_x} \partial y^{n_y} \partial z^{n_z} } v_{\text{mole}}(x,y,z)\)