pdd
Pointwise distance distributions (PDD) and average minimum distances (AMD).
Widdowson and Kurlin (NeurIPS 2022; Widdowson et al., MATCH 87, 529 (2022)):
for each atom, the distances to its k nearest neighbours among every atom
of the periodic structure, its own images included, nearest first. Atoms whose
rows are the same by symmetry are kept as one row, so a PDD has one row per
asymmetric unit atom, averaged over that atom's copies in the unit cell, with
a weight: the fraction of the unit cell's atoms the row stands for. The AMD is
the weighted mean of the rows.
Two PDDs whose rows correspond, atom by atom, compare entry by entry
(pdd_rms); with match_rows, rows are first paired within each element by
least difference, which a copy relabelled by its molecule's own symmetry
needs. Otherwise -- different Z, a supercell, a different atom order --
the earth mover's distance (pdd_emd) matches rows by transporting weight
between them, at a cost of the largest difference between two rows.
PDD
dataclass
A pointwise distance distribution.
Attributes:
| Name | Type | Description |
|---|---|---|
rows |
ndarray
|
(m, k) nearest-neighbour distances, Angstroms, ascending along each row |
weights |
ndarray
|
(m,) fraction of the unit cell's atoms each row stands for |
numbers |
ndarray
|
(m,) atomic number of each row's atoms |
Source code in chmpy/descriptors/pdd.py
amd
property
(k,) average minimum distances: the weighted mean of the rows
amd(crystal, k=100)
pdd(crystal, k=100, groups=None)
The PDD of a crystal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
a |
required | |
k
|
int
|
neighbours per atom |
100
|
groups
|
(N,) the row each unit cell atom (in |
None
|
Returns:
| Type | Description |
|---|---|
PDD
|
PDD |
Source code in chmpy/descriptors/pdd.py
pdd_emd(a, b)
The earth mover's distance between two PDDs.
The least total cost of moving each PDD's row weights onto the other's, where moving weight w from row i to row j costs w times the largest difference between the two rows (the L-infinity distance). Rows need not correspond and their numbers may differ.
Source code in chmpy/descriptors/pdd.py
pdd_rms(a, b, match_rows=False)
The root mean square difference of two PDDs, entry by entry.
Their rows must correspond: the same atoms, in the same order. With
match_rows, the rows of each element are first paired by least total
squared difference, so a structure whose atoms were relabelled -- by its
molecule's own symmetry, say -- still compares row for row.