ued.py🔗
aimsprop.ued
🔗
Functions🔗
compute_ued_simple(bundle: Bundle, key: str, R: ndarray, alpha: float, ABpairs = None) -> Bundle
🔗
Compute the simple pairwise-distance form of the UED cross section, with Gaussian blurring in R.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bundle |
Bundle |
the Bundle object to compute the property for (modified in place) |
required |
key |
str |
the name of the property |
required |
R |
ndarray |
the distances to collocate the UED cross section to. |
required |
alpha |
float |
the Guassian blurring exponent |
required |
ABpairs |
|
a restricted list of atom pair indices to include in the computation, or None for all atom pairs. |
None |
Returns:
Type | Description |
---|---|
Bundle |
bundle: reference to the input Bundle object. The property key is set to computed UED property. |
Source code in aimsprop/ued.py
def compute_ued_simple(
bundle: Bundle,
key: str,
R: np.ndarray,
alpha: float,
ABpairs=None,
) -> Bundle:
"""Compute the simple pairwise-distance form of the UED cross section,
with Gaussian blurring in R.
Params:
bundle: the Bundle object to compute the property for (modified in
place)
key: the name of the property
R: the distances to collocate the
UED cross section to.
alpha: the Guassian blurring exponent
ABpairs: a restricted list of atom pair indices
to include in the computation, or None for all atom pairs.
Return:
bundle: reference to the input Bundle object. The property
key is set to computed UED property.
"""
for frame in bundle.frames:
N = frame.N
xyz = frame.xyz
# Which pair indices?
if ABpairs is None:
ABpairs2 = []
for A in range(len(N)):
for B in range(A):
ABpairs2.append((A, B))
else:
ABpairs2 = ABpairs
# Compute UED cross section
V = np.zeros_like(R)
for A, B in ABpairs2:
rAB = xyz[A, :] - xyz[B, :]
RAB = math.sqrt(sum(rAB ** 2))
SAB = math.sqrt(_ued_cross_sections[N[A]] * _ued_cross_sections[N[B]]) / RAB
V += SAB * math.sqrt(alpha / math.pi) * np.exp(-alpha * (R - RAB) ** 2)
frame.properties[key] = V
return bundle