recip
torch_admp.recip
Reciprocal space operations for torch-admp.
This module provides functions for reciprocal space calculations used in Particle Mesh Ewald (PME) and other reciprocal space methods, including B-spline interpolation, charge spreading, and k-point setup.
Q_m_peratom(charges: torch.Tensor, sph_harms: torch.Tensor, pme_order: int)
Computes
Inputs: Q: N_a * (l+1)2 matrix containing global frame multipole moments up to lmax, sph_harms: N_a, 216, (l+1)2 lmax: int: maximal L
Output: Q_m_pera: N_a * 216 matrix, values of theta evaluated on a 6 * 6 block about the atoms
Source code in torch_admp/recip.py
Q_mesh_on_m(Q_mesh_pera: torch.Tensor, m_u0: torch.Tensor, t_kmesh: torch.Tensor, shifts: torch.Tensor)
Reduce the local Q_m_peratom into the global mesh
Input: Q_mesh_pera, m_u0, N
Output: Q_mesh: Nx * Ny * Nz matrix
Source code in torch_admp/recip.py
bspline(u: torch.Tensor)
Computes the cardinal B-spline function
Source code in torch_admp/recip.py
get_recip_grid_vectors(box_inv: torch.Tensor, t_kmesh: torch.Tensor)
Compute reciprocal lattice vectors of grids
| PARAMETER | DESCRIPTION |
|---|---|
box_inv
|
(3 * 3)-matrix for inv cell vectors inv_box = torch.linalg.inv(box)
TYPE:
|
t_kmesh
|
(3,)-shaped tensor [kx, ky, kz]
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
recip_grid_vectors
|
(3 * 3)-matrix for reciprocal lattice vectors of grids
TYPE:
|
Source code in torch_admp/recip.py
setup_kpts(box_inv, kpts_int)
This function sets up the k-points used for reciprocal space calculations
Input: box_inv: 3 * 3, three axis arranged in rows kpts_int: n_k * 3 matrix
Output: kpts: 4 * K, K=K1K2K3, contains kx, ky, kz, k^2 for each kpoint
Source code in torch_admp/recip.py
setup_kpts_integer(t_kmesh: torch.Tensor)
Set up integer k-points for reciprocal space calculations.
| PARAMETER | DESCRIPTION |
|---|---|
t_kmesh
|
Mesh dimensions [Kx, Ky, Kz]
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
n_k * 3 matrix of integer k-points, where n_k = Kx * Ky * Kz |
Source code in torch_admp/recip.py
sph_harmonics_GO(u0: torch.Tensor, shifts: torch.Tensor, pme_order: int)
Find out the value of spherical harmonics GRADIENT OPERATORS, assume the order is: 00, 10, 11c, 11s, 20, 21c, 21s, 22c, 22s, ... Currently supports lmax <= 2
| PARAMETER | DESCRIPTION |
|---|---|
u0
|
(N_a * 3)-matrix containing all positions
TYPE:
|
recip_grid_vectors
|
(3 * 3)-matrix for reciprocal lattice vectors of grids
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
harmonics
|
a Na * (63) * (l+1)^2 matrix, STGO operated on theta, evaluated at 666 integer points about reference points m_u0
TYPE:
|
Source code in torch_admp/recip.py
spread_charges(positions: torch.Tensor, box_inv: torch.Tensor, charges: torch.Tensor, t_kmesh: torch.Tensor, shifts: torch.Tensor, pme_order: int)
This is the high level wrapper function, in charge of spreading the charges/multipoles on grid
| PARAMETER | DESCRIPTION |
|---|---|
positions
|
Na * 3: positions of atoms
TYPE:
|
box
|
3 * 3: cell vectors
TYPE:
|
charges
|
Na * (lmax+1)**2: the multipole of each atomic site in global frame
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Nx * Ny * Nz: the meshed multipoles |
Output
|
Q_mesh: K1 * K2 * K3: the meshed multipoles |
Source code in torch_admp/recip.py
u_reference(positions: torch.Tensor, recip_grid_vectors: torch.Tensor, pme_order: int)
Each atom is meshed to dispersion_ORDER**3 points on the m-meshgrid. This function computes the xyz-index of the reference point, which is the point on the meshgrid just above atomic coordinates, and the corresponding values of xyz fractional displacements from real coordinate to the reference point.
| PARAMETER | DESCRIPTION |
|---|---|
positions
|
Na * 3: positions of atoms
TYPE:
|
recip_grid_vectors
|
(3 * 3)-matrix for reciprocal lattice vectors of grids
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
m_u0
|
N_a * 3 matrix, positions of the reference points of R_a on the m-meshgrid
TYPE:
|
u0
|
N_a * 3 matrix, (R_a - R_m)*a_star values
TYPE:
|