Environment types of the pair kernel

--gp-environment-types <file> gives every atom a fixed type for the Cartesian pair kernel of gprn and gprd. The inverse-distance kernel fits one length scale per pair of atom types, so the type file sets the number of length-scale hyperparameters. scripts/gp_environment_types.py writes the file from the endpoint structures of a search:

python scripts/gp_environment_types.py reactant.con product.con \
  --types-output types.dat

Each row of types.dat holds the atom index, the atomic number, the environment type and the base type. The base type is the element and reaction role that the environment type refines. Atoms whose bonded neighbours differ between the endpoints are reactive and never share a type with spectators. The script prints a JSON report that lists every environment, its atoms and the pair types.

How the length scales grow

With n types the kernel can hold one length scale for every unordered pair of types, n(n+1)/2 of them. The pairs that the molecule actually contains are fewer: a type with a single atom has no pair with itself. The pair_types list of the report counts these, and they are the length scales that the fit adjusts.

The count is quadratic in the number of types, so a descriptor that splits a large molecule finely produces a large fit. On the Baker and Birkholz benchmark sets of the published campaigns, the default descriptor gives at most 25 environments and 305 pair length scales (the Grignard reaction, 37 atoms). On a 78-atom BODIPY rotary motor (40 C, 33 H, 2 N, 2 F, 1 B) the same default gives 59 environments and 1724 pair length scales. The hyperparameter fit of that model did not return. With element types (5 types, 14 pair length scales) the same searches ran.

Element types remain the fallback that always stays small: a file whose third column is the atomic number gives at most e(e+1)/2 length scales for e elements.

Descriptors

--descriptor selects how atoms of one element and role are grouped.

Descriptor

Groups atoms by

Extra dependency

knn+soap (default)

nearest-neighbour radial features and SOAP within --cutoff, split at the largest gap of their distances

featomic

knn, soap

one of the two feature blocks alone

featomic for soap

topology

seams-core rooted bond-graph keys, two bonds deep

pydseams

bonds

element and bonded neighbourhood, --hops bonds deep

none

decaf

DECAF class in each endpoint, from anneal

the anneal Python package

The descriptor of the default sees the conformation as well as the bonding. Within a 4 A cutoff, the three hydrogens of a methyl rotor have different neighbours at different distances, so the default does not give them one type; it splits all five methyls of the BODIPY motor. A coarser grouping of the same normalized vectors (featomic SOAP, 6 radial and 5 angular channels) does not repair this. A fixed complete-linkage radius (--threshold), a leader clustering, and a metric MDS embedding with mean-shift clustering of these vectors were measured on BODIPY at radii from 0.05 to 0.3 of the normalized descriptor distance. They give 13 to 54 environments. Every one that gives more than 13 splits all five methyls; at 13, two methyls are joined and 58 of the 78 atoms change group when the reactant and the product are classified separately.

bonds reads the covalent bond graph only (the bond rule of the reactive-atom test, 1.25 times the summed covalent radii). With --hops 1 an atom’s type is its element and the elements of its bonded neighbours; each further hop adds the types of those neighbours. Atoms that only a conformation distinguishes share a type, and the type of an atom is the same on both endpoints unless its bonds change.

python scripts/gp_environment_types.py reactant.con product.con \
  --descriptor bonds --hops 2 --types-output types.dat

decaf uses the DECAF classification of local environments in anneal (anneal.decaf_atom_classes). Its descriptor is coarser than the default’s: the species-resolved SOAP power spectrum and four-body scalars at 3 radial and 3 angular channels within 3.5 A, unnormalized. anneal computes these rows with its own expansion in every build; its tests check them against featomic’s spherical expansion (rows to 1e-12 relative, identical classes). The report records the descriptor under decaf.expansion, which reads anneal. anneal pools these rows over both endpoints and leader-clusters them, with a radius of half the median distance between distinct rows; --decaf-radius sets the radius instead. An atom’s type is its element, its reaction role, and its class in each endpoint. At that radius the hydrogens of each methyl share a class and the classes follow the bonding: on BODIPY they are the partition of bonds at one hop, as they are on 41 of the 44 benchmark systems. The rows see no periodic image, so the descriptor refuses a frame in which an atom has an image within the cutoff. The script imports anneal only for this descriptor; without it the descriptor stops with a message and the others are unaffected.

Measured counts

Environments / pair length scales from the endpoints, for each descriptor.

System

Atoms

Element

knn+soap

decaf

bonds, 1 hop

bonds, 2 hops

bonds, 3 hops

BODIPY rotary motor

78

5 / 14

59 / 1724

10 / 52

10 / 52

24 / 291

32 / 515

Grignard (Birkholz)

37

5 / 12

25 / 305

8 / 31

8 / 31

10 / 50

14 / 100

Oxirane (Birkholz)

27

3 / 6

21 / 214

9 / 39

10 / 48

14 / 96

18 / 159

DACP (Birkholz)

22

2 / 3

18 / 156

4 / 10

4 / 10

10 / 50

16 / 125

Largest of 44 benchmark systems (per column)

5 / 12

25 / 305

12 / 68

10 / 49

14 / 96

18 / 159

Sum over 44 benchmark systems

306 / 1499

213 / 554

213 / 548

271 / 967

294 / 1245

On BODIPY the default splits all five methyls; decaf, and bonds at every depth, keep each methyl in one type, and every descriptor keeps the two fluorines on boron together. On the benchmark sets bonds gives the spectator hydrogens of every methyl one type; a methyl hydrogen that reacts takes its reactive type.

The default is unchanged, because the published campaigns used it. decaf would change the type count of 31 of the 44 benchmark systems (24 fewer, 7 more), bonds with one hop 30 of them (23 fewer, 7 more), and with two hops 33 of them (19 fewer, 14 more).

A type count alone does not show that the length scales are identifiable from the observations. Compare searches with each type file on the same system before choosing one.

Periodic cells

The script keeps periodic images in every descriptor. A .con file stores a gas-phase molecule with a zero box, and the reader returns it as periodic; the script drops periodicity along any cell vector of zero length before it computes neighbours. Without that, the Diels-Alder endpoints of the Baker set gave 12 environments and 70 pair length scales instead of 8 and 36.