# Structural Descriptors and Information Extraction from X-ray Spectra of
Liquids

E. A. Eronen  University of Turku, Department of Physics and Astronomy,
FI-20014 Turun yliopisto, Finland  A. Vladyka  University of Turku, Department
of Physics and Astronomy, FI-20014 Turun yliopisto, Finland  Ch. J. Sahle
ESRF, The European Synchrotron, 71 Avenue des Martyrs, CS40220, 38043 Grenoble
Cedex 9, France  J. Niskanen  University of Turku, Department of Physics and
Astronomy, FI-20014 Turun yliopisto, Finland

###### Abstract

Machine learning can reveal new insights into X-ray spectroscopy of liquids
when the local atomistic environment is presented to the model in a suitable
way. Many unique structural descriptor families have been developed for this
purpose. We benchmark the performance of six different descriptor types using
a computational data set of 24200 sulfur K$\beta$ X-ray emission spectra of
aqueous sulfuric acid simulated at six different concentrations. We train a
feed-forward neural network to predict the spectra from the corresponding
descriptor vectors and find that the local many-body tensor representation,
smooth overlap of atomic positions and atom-centered symmetry functions excel
in this comparison. We found a similar hierarchy when applying the emulator-
based component analysis to identify the spectrally relevant structural
characteristics. The spectra were dominantly dependent on the concentration of
the system, whereas adding the second most significant degree of freedom in
the decomposition allowed for distinction of the protonation state of the acid
molecule.

##  I Introduction

The liquid phase allows for the movement of solvent and solute molecules while
simultaneously having strong interactions among them. This leads to a
distribution of different possible local structures, and respective local
electronic Hamiltonians, in the sample. Computations have shown that these
local environments yield significantly different X-ray spectra, while their
ensemble mean is needed for a match with the corresponding experiment [1, 2,
3, 4, 5, 6, 7, 8]. Thus the changes in the experimental spectrum can be
connected to corresponding changes in the structural distribution. However,
the complexity of this problem calls for sophisticated methods able to
separate relevant from irrelevant information. Recent developments in
computational resources and machine learning (ML) have opened new paths for
these investigations [9, 10, 11, 12, 13, 14, 15, 16, 17].

Raw atomic coordinates $\mathbf{R}$ are unsuitable for machine learning of
spectra. To present the structural information in a more feasible fashion for
machine learning, numerous descriptors $\mathbf{D}(\mathbf{R})$ have been
developed [18, 19, 20, 21, 22, 23, 24, 25, 26, 27]. While each of these
representations might perform well for some tasks, they are not necessarily
equally fit for every situation. Besides the ML performance for spectrum
prediction, interpretability of the descriptor is a key consideration for
studies of actual structural information content of, e.g. X-ray spectra [17].
The study of the spectrum-to-structure inverse problem is indeed highly
dependent on the descriptor, which needs to include physically relevant
features that are also easily comprehensible by a human researcher.

Spectrum prediction by ML is a more viable task than structure prediction
[13], possibly because the former is not an injective function. Moreover, some
structural characteristics of the system are spectrally irrelevant. While this
behavior can be captured by a well-performing feed-forward neural network
(NN), the knowledge remains hidden in the respective weight matrices and bias
vectors. To this end, the NN is useful only for predicting the outcome for new
input, i.e. for emulation. Emulator-based component analysis (ECA) [14] is an
approach to extract knowledge contained by a ML model and a given data set.
The method finds structural features with dominant effect on the spectrum, and
disregards the irrelevant ones. While the advantage of this method is its lack
of need for any prior hypothesis, it gives rise to another requirement for a
descriptor: decomposability into a few dominant contributions [17].

We explore structural information content of simulated S K$\beta$ X-ray
emission spectra (XES) of aqueous sulfuric acid. We sample atomistic local
structures from ab initio molecular dynamics (AIMD) simulations at six
different concentrations and evaluate spectra for these structures. We assess
a total of six structural descriptors in terms of spectrum prediction
performance by NN and in terms of ECA decomposition. For fair comparison
between the descriptors, equal computational resources were allocated to the
hyperparameter search of each of them. Next, we identify the spectrally
dominant structural degrees of freedom using ECA, and study the performance of
each descriptor in the task. The acid molecules exist in three protonation
states, which are distinguishable from the XES after rank-two decomposition,
in which the first rank covers intermolecular interaction given by the
concentration. Our results highlight the difficulty of obtaining simple
structural information from contemporary structural descriptors, that may have
a notably abstract mathematical form.

##  II Methods

Table 1: Details of the AIMD simulations for each concentration: simulation box length, the corresponding concentration, total simulation time, sampling interval for the snapshots, the total number of snapshots Nsnapshots, and the total number of emission sites for which the X-ray emission spectra are calculated Nspectra. Configuration | Box side length [Å] | Concentration [M] | Simulation time [ps] | Sampling [fs] | Nsnapshots | Nspectra
---|---|---|---|---|---|---
1v63 (1 acid molecule/63 water) | 12.50 | 0.9 | 100 | 62.5 | 1600 | 1600
6v54 | 12.66 | 4.9 | 50 | 62.5 | 800 | 4800
12v36 | 12.55 | 10.1 | 50 | 125 | 400 | 4800
20v20 | 12.95 | 15.3 | 50 | 250 | 200 | 4000
21v7 | 12.58 | 17.5 | 50 | 250 | 200 | 4200
24v0 | 12.90 | 18.6 | 50 | 250 | 200 | 4800
Total |  |  |  |  |  | 24200

We base the study on structure–spectrum data pairs obtained from AIMD
simulations and subsequent spectrum calculations resulting in 24200 data
points. We encoded the structural data using six different descriptors and
studied the resulting performance of ML and subsequent ECA.

###  II.1 Simulations

We extended the AIMD runs of Ref. 28 for structural sampling for six
concentrations. The details are presented in Table 1. The simulations for the
NVT ensemble were run using the CP2K software [29] with Kohn-Sham density
functional theory (DFT) with Perdew–Burke–Ernzerhof (PBE) exchange correlation
potential [30]. The AIMD runs utilized periodic boundary conditions,
Goedecker–Teter-Hutter (GTH) pseudopotentials [31, 32, 33] and triple-$\xi$
TZVP-GTH basis set delivered with the software.

We computed the XES for every sulfur site of each sampled snapshot using the
projector-augmented-wave (PAW) method [34] with plane wave basis and density
functional theory (DFT) implemented in GPAW version 22.1.0 [35, 34, 36]. We
used periodic boundary conditions, the PBE exchange correlation potential and
a 600 eV plane wave energy cutoff (for justification, see Supplementary
Information).

The spectrum calculations applied transition potential DFT [37] in a fashion
motivated in Ref. 38. First, we computed the neutral ground state of each
snapshot and emission lines for each site on a relative energy scale. We then
calibrated the individual spectra on the absolute energy scale by a
$\Delta$-DFT calculation for the highest transition. This procedure builds on
calculation with one valence vacancy and on respective calculations for the
full core hole at each site, repeated for each snapshot. We convoluted the
obtained energy–intensity pairs (a stick spectrum) with a Gaussian of full
width at half maximum of 1.5 eV and then presented the spectra on a grid with
bin width of 0.075 eV.

###  II.2 Data preprocessing

For ML and further analysis, we took the relevant portion around the peak
group K$\beta_{\mathrm{x}}$, K$\beta_{\mathrm{1,3}}$, and
K$\beta^{\prime\prime}$ [39], and coarsened it by integration to a new grid
with bin width of 0.75 eV leading to target spectra of 16 values. We chose
this grid to be as coarse as possible while still containing the relevant
spectral features due to three reasons: (i) the fewer output values simplify
the ML problem; (ii) individual data points are more independent without
significant loss of information; (iii) we hope to avoid over-interpretation
through overly detailed analysis of simulations [13]. The last point follows
the principle of correspondence i.e. analyzing simulations only to a degree in
which they reproduce the experiment.

We evaluated the protonation state of each acid molecule as in Ref. 28. An
oxygen atom was considered to belong to the molecule if it was at most
$2.0~{}\text{\AA}$ from the respective sulfur atom. A hydrogen atom, in turn,
was considered a part of the acid molecule if it was closer than
$1.3~{}\text{\AA}$ from any of its oxygen atoms. Throughout the simulations,
the acid molecules always had four oxygen atoms with the distribution of
forms: 5878 SO4^2-, 9435 HSO4^-, 8847 H2SO4, and 40 H3SO4^+ corresponding to
protonations states from 0 to 3, respectively.

In this work we study six different descriptor families for encoding the local
atomistic structure around the emission site Sem. We used the implementation
within the DScribe-package (version 2.0.1) [19, 40] for the local version of
the many-body tensor representation (LMBTR) [20], smooth overlap of atomic
positions (SOAP) [22] and atom-centered symmetry functions (ACSF) [21]. For
the many-body distribution functionals (MBDF) [27] we used the implementation
provided with the original publication. In addition, we implemented the
descriptor introduced in Ref. 25 calling it “Gaussian tensors” (GT) hereafter.
Finally, we used a sorted variant of the Coulomb matrix (CM) [23] similar to
the bag of bonds [24] and analogous to the implementation in [16].

We split the data set randomly to 80% (19360 data points) for the training,
and the rest 20% (4840 data points) for testing. We calculated feature-wise
z-score standardization for input and output features using the training set
and then applied this scaling to all data prior any further procedures.

###  II.3 Data analysis

Successful emulation requires model selection of the hyperparameters of the
NN, and also those of the descriptor family. For example, there is no single
LMBTR descriptor, but the numerous internal hyperparameters of this family are
subject to model selection for optimal performance. Different descriptor
hyperparametrizations (e.g. those within LMBTR) require different NN
hyperparameters for optimal performance of the structure–spectrum emulator
system. We carried out a joint search for these two hyperparametrizations in a
randomized grid search for each descriptor family separately, allocating equal
computational time for each search. In each case we used the best found
descriptor–NN system for analysis.

We used fully connected feed-forward NN implemented in PyTorch (version 2.0.1)
[41] for ML. This NN architecture allows for a range of possible
hyperparameters that we searched over: the L2-regularization term $\alpha$
(from $10^{-13}$ to $1$), number of hidden layers (2, 3, 4 or 5), hidden layer
width (16, 32, 64, 128 or 256 neurons) and the learning rate (0.0001 or
0.00025). As the activation function of the neurons, we used the exponential
linear unit (ELU) [42]. The training of the networks was done in mini-batches
of 200 data points by maximizing the R2 score (coefficient of determination;
generalized covered variance) using the Adam optimizer [43]. We applied early
stopping of the training by checking every 200 epochs if the validation score
no longer improved.

We calculated the average score from a five-fold cross-validation (CV) on the
training set for each selected descriptor–NN hyperparameter combination.
Because building the descriptor consumed significantly more computational
resources than training one NN model, we trained ten different NN
architectures for every single descriptor hyperparametrization. The same
procedure was repeated for each of the six descriptor families with equal
total processor (CPU) time of the random grid search by allocating a total of
1440 CPU hours per descriptor family on Intel Xeon Gold 6230 processors at
Puhti cluster computer, CSC, Finland. Different descriptor families have
different free parameters to search over, which is detailed in the
Supplementary Information. We found slight variation of the results to persist
within the searched grid space due to randomness, for example, in shuffling of
the mini-batches and initialization of NN weights. In the end, we chose the
descriptor–NN hyperparameters with the highest CV score and trained the final
model using the full training set. In this final training we used 80% of re-
shuffled training data (15488 points) for actual training and the rest 20%
(3872 points) for validation to determine the early stopping condition.

We carried out ECA decomposition [14] of the structural descriptor space using
the PyTorch implementation of the algorithm [44]. In the procedure, basis
vectors $V=\\{\mathbf{v}_{j}\\}_{j=1}^{k}$ are searched for to achieve a
rank-$k$ approximation for $\mathbf{D}({\mathbf{R}})$:

$\mathbf{D}^{(k)}(\mathbf{R})=\sum_{j=1}^{k}\underbrace{\left\langle\mathbf{v}_{j}|\mathbf{D}(\mathbf{R})\right\rangle}_{=:t_{j}}\mathbf{v}_{j}.$
(1)

The search of the basis vectors is done by maximizing the R2 score between the
ML prediction for ${\mathbf{D}^{(k)}}(\mathbf{R})$ and the known data. We
optimized one basis vector at a time and applied orthonormality constraints.
In the ECA procedure z-score standardization of the features is assumed.

We found that the randomly selected initial guess of the ECA component vectors
sometimes affected the resulting fit. Therefore, we ran the ECA procedure with
25 different random initial guesses for each component and always chose the
vector resulting in the highest R2 score, before moving on to optimizing the
next component. This is likely a symptom of the high-dimensional feature
vectors, which encode a wealth of atomistic information within each
(correlated) element of the vector. This complexity is inherited from the
physical problem itself.

We used the training set for both NN training and ECA decomposition. The
generalizability of the outcome was assessed with the test set in both cases.
To allow for apples-to-apples comparison, we used the R2 score for all NN
training, testing, and ECA.

Figure 1: Simulation results of aqueous sulfuric acid. a, b: Two sample
structures for 0.9 M and 15.3 M, respectively, prepared with the Jmol software
[45]. Only molecules within 3 Å distance from the central molecule are shown
for clarity. c, d: Computational ensemble mean X-ray emission spectrum for
each concentration with the standard deviation $\sigma$ shown as grey shaded
area. In addition, the coarsened grid points used for the target spectra of
the machine-learning-based analysis are shown on the mean spectra.

##  III Results

Sulfuric acid exists in different protonation states as exemplified by sample
structures in Figures 1a,b showing local structures from simulations of 0.9 M
and 15.3 M solutions. The simulated ensemble average spectra of different
concentrations are shown in Figures 1c,d. The general shape of the spectra
match well with the experiment published in Ref. 5. Therefore, the data set
can be considered suitable for the ML and subsequent analysis of this work.
The chosen region and coarsened bins of the target spectra (depicted with
points in Figure 1c,d) are sufficient to capture the shape of the spectrum.

Even after extensive model selection, the descriptors yield varying prediction
performance of the target spectra as presented in Table 2. Practically equal
accuracy is obtained with the best-performing descriptors LMBTR, SOAP and
ACSF. The MBDF descriptor provides intermediate performance among the studied
ones, whereas GT and CM yield more than 0.1 units lower R2 than the most
accurate descriptors. The tendency of an ML model to overfit is commonly
measured by the difference between the train and the test scores. Our results
hint an increasing trend in this difference along decreasing accuracy. Figure
2a illustrates the distribution of the R2 scores for z-score-standardized
spectral features when using the LMBTR emulator (test set R${}^{2}=0.928$).
Typical prediction quality along this distribution is presented in Figure 2b–d
in the absolute intensity scale (test set R${}^{2}=0.950$).

Table 2: Comparison of descriptors with best performing hyperparameters after the joint model selection for the representation and neural network architecture: the number of structural features and neural network emulator train R2 score, test R2 score, and their difference with z-score standardized target spectra. Descriptor | Nfeatures |  – R${}^{2}_{\mathrm{train}}$ – | R${}^{2}_{\mathrm{test}}$ | Difference
---|---|---|---|---
LMBTR | 420 | 0.944 | 0.928 | 0.015
SOAP | 2700 | 0.961 | 0.928 | 0.033
ACSF | 543 | 0.952 | 0.923 | 0.029
MBDF | 330 | 0.915 | 0.878 | 0.036
GT | 1275 | 0.857 | 0.814 | 0.043
CM | 595 | 0.889 | 0.806 | 0.083
Figure 2: Performance of the LMBTR descriptor on the test set after joint
model selection of the representation and neural network architecture. a:
Distribution of R2 scores for each data point in the standardized test set.
Examples of known and predicted spectra in the test set with R2 score closest
to b: the 1st decile, c: the median, and d: the 9th decile. The R2-score
values are for the standardized spectra, which were used throughout the
analysis. The spectra have been z-score inverse transformed into the absolute
intensity scale, in which drastic errors in the z-score-standardized scale are
suppressed on features with low absolute intensity (also low variance).

We measure the ECA decomposition performance with the R2 score, shown as a
function of the rank of the decomposition in Figure 3. The scores for the
train set and for the test set both rise monotonically and approach a plateau
near the respective emulator performance. In general, the R2 scores of high
rank ($\geq 5$) ECA are roughly ordered along the overall ML accuracy of the
respective emulators. The design principle of ECA aims at maximal covered
spectral variance at any given rank, manifested by the diminishing improvement
as a function of $k$ observed in Figure 3. The intended rapid reduction of
dimensionality motivates the study of low rank (e.g. $\leq\,3$) decompositions
for which LMBTR performs the best. We have noticed jumps in the R2 curves as a
function of the decomposition rank $k$, seen in Figure 3 for SOAP and CM. This
phenomenon is unpredictable and potentially related to the initial guess of
the ECA component vector. Apart from the obvious complexity of the problem,
the detailed origin and cure for this behaviour remain unknown to us.

Figure 3: Typical behaviour of of the R2 score as a function of the ECA rank
$k$ for each descriptor after joint model selection of the representation and
neural network architecture. At hight ranks ($\geq\,5$) the results closely
follow those of the emulation performance. Increasing the rank shows
diminishing R2-score gains. At low ranks ($\leq\,3$) LMBTR outperforms the
rest. The jump observed SOAP and CM may occur for any descriptor and is due to
the complexity of the problem and stochasticity of the iterative solution.

Next, we analyse the ECA results using the LMBTR descriptor, which contains
simple physical information as part of it, namely interatomic distances to the
atomic site of emission Sem. Instead of presenting the numeric values of these
distances, the descriptor encodes this information on a predefined grid as a
sum of Gaussian functions, centered at the respective positions. The
respective features of the first ECA component vector, z-score inverse
transformed into the descriptor space, are shown in Figure 4a. In the sense of
the aforementioned representation, these curves indicate the change in
interatomic distances most relevant in terms of the target spectrum shape. The
spectrum is notably affected by distant molecules, as the curves do not vanish
at long interatomic separations (up to half of the simulation box size). In
the region from 4 Å to 6 Å, the Sem—O curve has an opposite effect compared to
the Sem—H curve. This can indicate different H/O number fraction in the acid
and the water molecules, and possibly the orientation of the water molecules
depending on the protonation state of the acid molecule, which can act both as
hydrogen bond donor and acceptor. As discussed later, these Sem—H, Sem—O and
Sem—S curves reflect changes due to change of concetration, which the first
ECA vector is indicative of. Although higher-rank ECA components may have
cancelling contributions, their structural effects derivable from spectra will
be smaller due to diminishing related spectral R2 gain along the expansion
rank $k$ (R${}^{2}_{k=1}=0.682$; R${}^{2}_{k=2}=0.788$). Although the overall
sign of an ECA vector is arbitrary, the relative signs of its components (e.g.
the curves in Figure 4a) are fixed.

To study the separability of spectrally dominant structural features, we
performed projection of each data point in the test set on two-dimensional ECA
space. We focus on two most obvious characteristics: the protonation state of
an acid molecule and the concentration of the system, which are indicated by
coloring of each point in the resulting scatter plot, shown in Figures 4b,c,
respectively. The protonation state is not the ruling structural
characteristic behind variation of the S K$\beta$ XES as the first ECA
component (Figure 4b) can be classified by the first ECA score $t_{1}$ only
partially. However, the interplay of $t_{1}$ and $t_{2}$ disentangles these
classes almost completely. In contrast, the score $t_{1}$ describes the
concentration of the system, in agreement with Figures 1c,d.

Figure 4: Results of the ECA using the LMBTR descriptor. a: Interatomic
distance part of the first ECA vector (with spectral R${}^{2}_{k=1}=0.682$)
z-score inverse transformed into the descriptor space. The non-zero values of
the vector show that even distant atoms have a significant effect on the
spectra. b,c: Two-dimensional ECA projection (with spectral
R${}^{2}_{k=2}=0.788$) of each data point in the test set: both of the
components are necessary to distinguish the protonation state of the acid
molecule, whereas the first component follows intermolecular interactions
given by concentration. See text for details.

##  IV Discussion

The role of the descriptor is to present the structural data in the most
utilizable form for emulation; numerous comparative studies have also been
published in the contexts of atomistic systems [46, 47, 48, 15]. Our results
suggest that, in X-ray spectroscopy of liquids (with $\approx 2\cdot 10^{4}$
data points) an equal ML performance can be obtained with LMBTR, SOAP and ACSF
with joint model selection of the descriptor hyperparameters together with the
NN architecture. Among the studied descriptor families, we obtained
intermediate performance with MBDF, whereas we could not achieve competitive
accuracy when using CM and GT. Aqueous sulfuric acid is composed of covalently
bonded molecules that are also coordinated to allow for the tight packing
associated with the liquid phase. This suggests that accounting for three-body
terms could be necessary for good emulation: the top performers of this work
fulfill this criterion. The lack of explicit coordination information could
also explain the under-performance of CM in the current work, whereas the
descriptor provided more impressive results for Ge K$\beta$ XES of amorphous
GeO2 [16].

Picking a descriptor family poses a serious model selection problem because
there are inherent tunable hyperparameters characteristic to each one of them
(see Supplementary Information). Ideally this optimization is done jointly
with the hyperparameters of the NN, which multiplies the required
computational effort. Without prior knowledge, descriptors with more free
hyperparameters are more flexible than those with fewer. Therefore, their
parameter-optimized forms have a higher prior potential for accuracy as well.
Because this tuning is ultimately left for the user, we accounted for the
discrepancy in descriptor design by applying equal computation time for
refining each descriptor, regardless how many free hyperparameters the
implementation had. We propose this practice for fair assessment of structural
descriptors of ever-increasing multitude. Furthermore, as several different
parametrizations can result in equally accurate prediction and information
recoverability via ECA, a reasonable stopping condition for the joint
randomized hyperparameter grid search can be provided by diminishing CV score
gains.

Analogous to the principal component analysis (PCA) [49], ECA works as a
dimensionality reduction tool. Instead of maximizing the covered structural
variance, the method focuses on maximizing the spectral one for a
decomposition in the structural space. Because the relation
$\mathbf{S}(\mathbf{R})$ is a non-linear, non-injective, and non-surjective
function, finding such a transformation is not necessarily straightforward. As
a result, the basis vectors of ECA can be used to identify descriptor
features, which affect (or do not affect) the shape of the target spectra.
Moreover, the low-dimensional ECA coordinate vector $\mathbf{t}$
characterizing a structure can be used for visualization and cluster analysis.
For example, Figures 4b,c show that the spectrally most important structural
variation parameter $t_{1}$ follows the concentration of the system, whereas
inclusion of the second most relevant coordinate $t_{2}$ allows for
distinction of the protonation state of the acid molecule.

The ECA decomposition can be used to find an approximate solution to the
inverse problem from spectra to structure by reconstruction of the dominant
scores $\mathbf{t}$ of Eq. (1) by a fitting procedure [16]. Owing to the low
dimensionality and owing to their significance in terms of the target spectra,
the reconstruction of these scores may be a more stable numerical problem than
reconstruction of the full descriptor vector. However the unique correct
solution can not be generally guaranteed for the ill-defined nonlinear inverse
problem. During our investigations we have also observed that performance of a
drastically overfitting model may sometimes be improved by expansion along
only a few ECA components. An explanation for this might be that such
decomposition regularizes the feature vector itself. On another note, the
best-performing hyperparametrization of the descriptor–NN system, obtained
from the model selection focusing on emulation accuracy, might not be the
optimal choice for maximal spectral R2 for ECA of a given rank. Inclusion of
ECA as a part of the model selection procedure would be an obvious cure for
the problem. However, this would come with added computational cost.

Structural interpretation of spectra sets several requirements for a
descriptor. The representation needs to allow for accurate emulation,
effective decomposition, and back-conversion to simple physical information.
For example, CM can be converted into interatomic distances from the active
atomic site or even to the full three-dimensional structure [16]. In this work
we found LMBTR to provide superior performance in ECA, especially with low
rank decomposition. Fortunately, this descriptor also contains broadened
interatomic distance features, which can be used for structural analysis by a
human; interpretation of the other well-performing descriptors (SOAP, ACSF and
MBDF) remains more difficult. Although all of the studied descriptors are
calculated from local atomistic structures, several factors complicate
recovering such information from them. These include smearing the exact values
on a grid and summation of information from many atoms into one feature,
possibly with distance-dependent weights. In addition, some of the descriptors
rely on basis functions. In this line of thought, interpretation of
descriptors calls for future efforts.

Machine learning by NNs requires large data sets, that have only recently
become feasible owing to the increase in computational resources and the
developments in simulation tools. Advances of ML in potentials for molecular
dynamics [50, 51], and in electron structure calculations [52], could help
generate more extensive and more accurate training data, leading to improved
performance of spectrum emulation and subsequent analyses.

##  V Conclusions

We benchmarked six structural descriptor families in machine learning of
simulated X-ray emission spectra (XES) of aqueous sulfuric acid. For unbiased
assessment of these descriptor types with varying number of hyperparameters,
we allocated equal computation time for the joint descriptor–neural network
model selection in each of the six cases. We found local many-body tensor
representation (LMBTR), smooth overlap of atomic positions (SOAP) and atom-
centered symmetry functions (ACSF) to perform best (equally accurately) with
the data set of $\sim 2\cdot 10^{4}$ points.

We observed a similar hierarchy in the comparison of the descriptor families
for structural dimensionality reduction guided by covered spectral variance.
The LMBTR stood out especially in the low-rank decompositions of the applied
emulator-based component analysis. Although the system manifests significant
complexity, the analysis method managed to condense spectral dependence into
two dimensions with R${}^{2}=0.788$ for an independent test set. The results
indicated that even distant atoms have a significant effect on the XES, that
probes local bound orbitals around the emission site. The dominant underlying
coordinate $t_{1}$ followed the concentration of the system, whereas inclusion
of the second most relevant degree of freedom $t_{2}$ allowed for clear
distinction of the protonation state of the acid molecule.

Structural descriptors facilitate accurate prediction of X-ray spectra by a
neural network. Advances in simulation methods can be anticipated to extend
and improve the data sets to allow for studies of even more complex systems
and analyses with higher accuracy. Conversion of the descriptor back to simple
atomistic information may need more specific research efforts, as results
presented in terms of these mathematically sophisticated representations can
be difficult to interpret by a human.

## Data availability

The data and relevant scripts are available in Zenodo:
10.5281/zenodo.10650121.

## Author contributions

E.A.E. machine learning, data analysis, writing the manuscript. A.V.
simulations, data analysis, writing the manuscript. C.J.S writing the
manuscript. J.N. research design, simulations, funding, writing the
manuscript.

###### Acknowledgements.

E.A.E. acknowledges Jenny and Antti Wihuri Foundation for funding. E.A.E.,
A.V. and J.N. acknowledge Academy of Finland for funding via project 331234.
The authors acknowledge CSC – IT Center for Science, Finland, and the FGCI -
Finnish Grid and Cloud Infrastructure for computational resources.

## References

  * Wernet et al. [2004] Ph. Wernet, D. Nordlund, U. Bergmann, M. Cavalleri, M. Odelius, H. Ogasawara, L. Å. Näslund, T. K. Hirsch, L. Ojamäe, P. Glatzel, L. G. M. Pettersson, and A. Nilsson.  The Structure of the First Coordination Shell in Liquid Water.  _Science_ , 304(5673):995–999, 2004.  doi: 10.1126/science.1096205.
  * Leetmaa et al. [2010] M. Leetmaa, M.P. Ljungberg, A. Lyubartsev, A. Nilsson, and L.G.M. Pettersson.  Theoretical approximations to X-ray absorption spectroscopy of liquid water and ice.  _Journal of Electron Spectroscopy and Related Phenomena_ , 177(2–3):135–157, 2010.  doi: 10.1016/j.elspec.2010.02.004.
  * Ottosson et al. [2011] Niklas Ottosson, Knut J. Børve, Daniel Spångberg, Henrik Bergersen, Leif J. Sæthre, Manfred Faubel, Wandared Pokapanich, Gunnar Öhrwall, Olle Björneholm, and Bernd Winter.  On the Origins of Core–Electron Chemical Shifts of Small Biomolecules in Aqueous Solution: Insights from Photoemission and ab Initio Calculations of Glycineaq.  _Journal of the American Chemical Society_ , 133(9):3120–3130, 2011.  doi: 10.1021/ja110321q.
  * Sahle et al. [2013] Christoph J. Sahle, Christian Sternemann, Christian Schmidt, Susi Lehtola, Sandro Jahn, Laura Simonelli, Simo Huotari, Mikko Hakala, Tuomas Pylkkänen, Alexander Nyrow, Kolja Mende, Metin Tolan, Keijo Hämäläinen, and Max Wilke.  Microscopic structure of water at elevated pressures and temperatures.  _Proceedings of the National Academy of Sciences_ , 110(16):6301–6306, 2013.  doi: 10.1073/pnas.1220301110.
  * Niskanen et al. [2016] J. Niskanen, Ch. J. Sahle, K. O. Ruotsalainen, H. Müller, M. Kavčič, M. Žitnik, K. Bučar, M. Petric, M. Hakala, and S. Huotari.  Sulphur K$\beta$ emission spectra reveal protonation states of aqueous sulfuric acid.  _Scientific Reports_ , 6:21012, 2016.  doi: 10.1038/srep21012.
  * Niskanen et al. [2017] Johannes Niskanen, Christoph J. Sahle, Keith Gilmore, Frank Uhlig, Jens Smiatek, and Alexander Föhlisch.  Disentangling Structural Information From Core-level Excitation Spectra.  _Physical Review E_ , 96:013319, 2017.  doi: 10.1103/PhysRevE.96.013319.
  * Niskanen et al. [2019] J. Niskanen, M. Fondell, Ch. J. Sahle, S. Eckert, R. M. Jay, K. Gilmore, A. Pietzsch, M. Dantz, X. Lu, D. McNally, T. Schmitt, V. Vaz da Cruz, V. Kimberg, F. Gel’mukhanov, and A. Föhlisch.  Compatibility of quantitative X-ray spectroscopy with continuous distribution models of water at ambient conditions.  _Proceedings of the National Academy of Science of USA_ , 116(10):4058–4063, 2019.  doi: 10.1073/pnas.1815701116.
  * Vaz da Cruz et al. [2019] Vinícius Vaz da Cruz, Faris Gel’mukhanov, Sebastian Eckert, Marcella Iannuzzi, Emelie Ertan, Annette Pietzsch, Rafael C. Couto, Johannes Niskanen, Mattis Fondell, Marcus Dantz, Thorsten Schmitt, Xingye Lu, Daniel McNally, Raphael M. Jay, Victor Kimberg, Alexander Föhlisch, and Michael Odelius.  Probing hydrogen bond strength in liquid water by resonant inelastic X-ray scattering.  _Nature Communications_ , 10(1):1013, 2019.  doi: 10.1038/s41467-019-08979-4.
  * Timoshenko et al. [2017] Janis Timoshenko, Deyu Lu, Yuewei Lin, and Anatoly I. Frenkel.  Supervised Machine-Learning-Based Determination of Three-Dimensional Structure of Metallic Nanoparticles.  _The Journal of Physical Chemistry Letters_ , 8(20):5091–5098, 2017.  doi: 10.1021/acs.jpclett.7b02364.
  * Timoshenko and Frenkel [2019] Janis Timoshenko and Anatoly I. Frenkel.  “Inverting” X-ray Absorption Spectra of Catalysts by Machine Learning in Search for Activity Descriptors.  _ACS Catalysis_ , 9(11):10192–10211, 2019.  doi: 10.1021/acscatal.9b03599.
  * Liu et al. [2019] Yang Liu, Nicholas Marcella, Janis Timoshenko, Avik Halder, Bing Yang, Lakshmi Kolipaka, Michael. J. Pellin, Soenke Seifert, Stefan Vajda, Ping Liu, and Anatoly I. Frenkel.  Mapping XANES spectra on structural descriptors of copper oxide clusters using supervised machine learning.  _The Journal of Chemical Physics_ , 151(16):164201, 2019.  doi: 10.1063/1.5126597.
  * Andrejevic et al. [2022] Nina Andrejevic, Jovana Andrejevic, B. Andrei Bernevig, Nicolas Regnault, Fei Han, Gilberto Fabbris, Thanh Nguyen, Nathan C. Drucker, Chris H. Rycroft, and Mingda Li.  Machine-Learning Spectral Indicators of Topology.  _Advanced Materials_ , 34(49):2204113, 2022.  doi: 10.1002/adma.202204113.
  * Niskanen et al. [2022a] Johannes Niskanen, Anton Vladyka, J. Antti Kettunen, and Christoph J. Sahle.  Machine learning in interpretation of electronic core-level spectra.  _Journal of Electron Spectroscopy and Related Phenomena_ , 260:147243, 2022a.  doi: 10.1016/j.elspec.2022.147243.
  * Niskanen et al. [2022b] J. Niskanen, A. Vladyka, J. Niemi, and C.J. Sahle.  Emulator-based decomposition for structural sensitivity of core-level spectra.  _Royal Society Open Science_ , 9(6):220093, 2022b.  doi: 10.1098/rsos.220093.
  * Kwon et al. [2023] Hyuna Kwon, Wenyu Sun, Tim Hsu, Wonseok Jeong, Fikret Aydin, Shubham Sharma, Fanchen Meng, Matthew R. Carbone, Xiao Chen, Deyu Lu, Liwen F. Wan, Michael H. Nielsen, and Tuan Anh Pham.  Harnessing Neural Networks for Elucidating X-ray Absorption Structure–Spectrum Relationships in Amorphous Carbon.  _The Journal of Physical Chemistry C_ , 127(33):16473–16484, 2023.  doi: 10.1021/acs.jpcc.3c02029.
  * Vladyka et al. [2023a] Anton Vladyka, Christoph J. Sahle, and Johannes Niskanen.  Towards structural reconstruction from X-ray spectra.  _Physical Chemistry Chemical Physics_ , 25(9):6707–6713, 2023a.  doi: 10.1039/D2CP05420E.
  * Eronen et al. [2024] Eemeli A Eronen, Anton Vladyka, Florent Gerbon, Christoph J Sahle, and Johannes Niskanen.  Information bottleneck in peptide conformation determination by x-ray absorption spectroscopy.  _Journal of Physics Communications_ , 8(2):025001, 2024.  doi: 10.1088/2399-6528/ad1f73.
  * Behler [2016] Jörg Behler.  Perspective: Machine learning potentials for atomistic simulations.  _The Journal of Chemical Physics_ , 145(17):170901, 2016.  doi: 10.1063/1.4966192.
  * Himanen et al. [2020] Lauri Himanen, Marc O. J. Jäger, Eiaki V. Morooka, Filippo Federici Canova, Yashasvi S. Ranawat, David Z. Gao, Patrick Rinke, and Adam S. Foster.  DScribe: Library of descriptors for machine learning in materials science.  _Computer Physics Communications_ , 247:106949, 2020.  doi: 10.1016/j.cpc.2019.106949.
  * Huo and Rupp [2022] Haoyan Huo and Matthias Rupp.  Unified representation of molecules and crystals for machine learning.  _Machine Learning: Science and Technology_ , 3(4):045017, 2022.  doi: 10.1088/2632-2153/aca005.
  * Behler [2011] Jörg Behler.  Atom-centered symmetry functions for constructing high-dimensional neural network potentials.  _The Journal of Chemical Physics_ , 134(7):074106, 2011.  doi: 10.1063/1.3553717.
  * Bartók et al. [2013] Albert P. Bartók, Risi Kondor, and Gábor Csányi.  On representing chemical environments.  _Physical Review B_ , 87:184115, 2013.  doi: 10.1103/PhysRevB.87.184115.
  * Rupp et al. [2012] Matthias Rupp, Alexandre Tkatchenko, Klaus-Robert Müller, and O. Anatole von Lilienfeld.  Fast and Accurate Modeling of Molecular Atomization Energies with Machine Learning.  _Physical Review Letters_ , 108:058301, 2012.  doi: 10.1103/PhysRevLett.108.058301.
  * Hansen et al. [2015] Katja Hansen, Franziska Biegler, Raghunathan Ramakrishnan, Wiktor Pronobis, O. Anatole von Lilienfeld, Klaus-Robert Müller, and Alexandre Tkatchenko.  Machine Learning Predictions of Molecular Properties: Accurate Many-Body Potentials and Nonlocality in Chemical Space.  _The Journal of Physical Chemistry Letters_ , 6(12):2326–2331, 2015.  doi: 10.1021/acs.jpclett.5b00831.
  * Chandrasekaran et al. [2019] Anand Chandrasekaran, Deepak Kamal, Rohit Batra, Chiho Kim, Lihua Chen, and Rampi Ramprasad.  Solving the electronic structure problem with machine learning.  _npj Computational Materials_ , 5(1):22, 2019\.  doi: 10.1038/s41524-019-0162-7.
  * Langer et al. [2022] Marcel F. Langer, Alex Goeßmann, and Matthias Rupp.  Representations of molecules and materials for interpolation of quantum-mechanical simulations via machine learning.  _npj Computational Materials_ , 8(1):41, 2022\.  doi: 10.1038/s41524-022-00721-x.
  * Khan et al. [2023] Danish Khan, Stefan Heinen, and O. Anatole von Lilienfeld.  Kernel based quantum machine learning at record rate: Many-body distribution functionals as compact representations.  _The Journal of Chemical Physics_ , 159(3):034106, 2023.  doi: 10.1063/5.0152215.
  * Niskanen et al. [2015] J. Niskanen, Ch. J. Sahle, I. Juurinen, J. Koskelo, S. Lehtola, R. Verbeni, H. Müller, M. Hakala, and S. Huotari.  Protonation dynamics and hydrogen Bonding in aqueous sulfuric acid.  _Journal of Physical Chemistry B_ , 119(35):11732, 2015.  doi: 10.1021/acs.jpcb.5b04371.
  * Kühne et al. [2020] Thomas D. Kühne, Marcella Iannuzzi, Mauro Del Ben, Vladimir V. Rybkin, Patrick Seewald, Frederick Stein, Teodoro Laino, Rustam Z. Khaliullin, Ole Schütt, Florian Schiffmann, Dorothea Golze, Jan Wilhelm, Sergey Chulkov, Mohammad Hossein Bani-Hashemian, Valéry Weber, Urban Borštnik, Mathieu Taillefumier, Alice Shoshana Jakobovits, Alfio Lazzaro, Hans Pabst, Tiziano Müller, Robert Schade, Manuel Guidon, Samuel Andermatt, Nico Holmberg, Gregory K. Schenter, Anna Hehn, Augustin Bussy, Fabian Belleflamme, Gloria Tabacchi, Andreas Glöß, Michael Lass, Iain Bethune, Christopher J. Mundy, Christian Plessl, Matt Watkins, Joost VandeVondele, Matthias Krack, and Jürg Hutter.  CP2K: An electronic structure and molecular dynamics software package - Quickstep: Efficient and accurate electronic structure calculations.  _The Journal of Chemical Physics_ , 152(19):194103, 2020.  doi: 10.1063/5.0007045.
  * Perdew et al. [1996] J. P. Perdew, K. Burke, and M. Ernzerhof.  Generalized gradient approximation made simple.  _Physical Review Letters_ , 77:3865–3868, 1996.  doi: 10.1103/PhysRevLett.77.3865.
  * Goedecker et al. [1996] S. Goedecker, M. Teter, and J. Hutter.  Separable dual-space Gaussian pseudopotentials.  _Physical Reviev B_ , 54:1703–1710, 1996.  doi: 10.1103/PhysRevB.54.1703.
  * Hartwigsen et al. [1998] C. Hartwigsen, S. Goedecker, and J. Hutter.  Relativistic separable dual-space Gaussian pseudopotentials from H to Rn.  _Physical Review B_ , 58:3641–3662, 1998.  doi: 10.1103/PhysRevB.58.3641.
  * Krack [2005] M. Krack.  Pseudopotentials for H to Kr optimized for gradient-corrected exchange-correlation functionals.  _Theoretical Chemistry Accounts_ , 114(1):145–152, 2005.  doi: 10.1007/s00214-005-0655-y.
  * Enkovaara et al. [2010] J Enkovaara, C Rostgaard, J J Mortensen, J Chen, M Dułak, L Ferrighi, J Gavnholt, C Glinsvad, V Haikola, H A Hansen, H H Kristoffersen, M Kuisma, A H Larsen, L Lehtovaara, M Ljungberg, O Lopez-Acevedo, P G Moses, J Ojanen, T Olsen, V Petzold, N A Romero, J Stausholm-Møller, M Strange, G A Tritsaris, M Vanin, M Walter, B Hammer, H Häkkinen, G K H Madsen, R M Nieminen, J K Nørskov, M Puska, T T Rantala, J Schiøtz, K S Thygesen, and K W Jacobsen.  Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method.  _Journal of Physics: Condensed Matter_ , 22(25):253202, 2010.  doi: 10.1088/0953-8984/22/25/253202.
  * Mortensen et al. [2005] J. J. Mortensen, L. B. Hansen, and K. W. Jacobsen.  Real-space grid implementation of the projector augmented wave method.  _Physical Review B_ , 71(3):035109, 2005.  doi: 10.1103/PhysRevB.71.035109.
  * Larsen et al. [2017] Ask Hjorth Larsen, Jens Jørgen Mortensen, Jakob Blomqvist, Ivano E Castelli, Rune Christensen, Marcin Dułak, Jesper Friis, Michael N Groves, Bjørk Hammer, Cory Hargus, Eric D Hermes, Paul C Jennings, Peter Bjerre Jensen, James Kermode, John R Kitchin, Esben Leonhard Kolsbjerg, Joseph Kubal, Kristen Kaasbjerg, Steen Lysgaard, Jón Bergmann Maronsson, Tristan Maxson, Thomas Olsen, Lars Pastewka, Andrew Peterson, Carsten Rostgaard, Jakob Schiøtz, Ole Schütt, Mikkel Strange, Kristian S Thygesen, Tejs Vegge, Lasse Vilhelmsen, Michael Walter, Zhenhua Zeng, and Karsten W Jacobsen.  The atomic simulation environment—a Python library for working with atoms.  _Journal of Physics: Condensed Matter_ , 29(27):273002, 2017.  doi: 10.1088/1361-648X/aa680e.
  * Triguero et al. [1998] L. Triguero, L. G. M. Pettersson, and H. Ågren.  Calculations of near-edge x-ray-absorption spectra of gas-phase and chemisorbed molecules by means of density-functional and transition-potential theory.  _Physical Review B_ , 58:8097–8110, 1998.  doi: 10.1103/PhysRevB.58.8097.
  * Ljungberg et al. [2011] M.P. Ljungberg, J.J. Mortensen, and L.G.M. Pettersson.  An implementation of core level spectroscopies in a real space Projector Augmented Wave density functional theory code.  _Journal of Electron Spectroscopy and Related Phenomena_ , 184(8):427–439, 2011.  doi: 10.1016/j.elspec.2011.05.004.
  * Mori et al. [2010] R. Alonso Mori, E. Paris, G. Giuli, S. G. Eeckhout, M. Kavčič, M. Žitnik, K. Bučar, L. G. M. Pettersson, and P. Glatzel.  Sulfur-metal orbital hybridization in sulfur-bearing compounds studied by x-ray emission spectroscopy.  _Inorganic Chemistry_ , 49(14):6468–6473, 2010\.  doi: 10.1021/ic100304z.
  * Laakso et al. [2023] Jarno Laakso, Lauri Himanen, Henrietta Homm, Eiaki V. Morooka, Marc O. J. Jäger, Milica Todorović, and Patrick Rinke.  Updates to the DScribe library: New descriptors and derivatives.  _The Journal of Chemical Physics_ , 158(23):234802, 2023.  doi: 10.1063/5.0151031.
  * Paszke et al. [2019] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala.  PyTorch: An Imperative Style, High-Performance Deep Learning Library.  In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, _Advances in Neural Information Processing Systems 32_ , pages 8024–8035. Curran Associates, Inc., 2019.  URL https://dl.acm.org/doi/10.5555/3454287.3455008.
  * Clevert et al. [2016] Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter.  Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs).  _arXiv:1511.07289v5 [cs.LG]_ , 2016.  doi: 10.48550/arXiv.1511.07289.
  * Kingma and Ba [2017] Diederik P. Kingma and Jimmy Ba.  Adam: A Method for Stochastic Optimization.  _arXiv:1412.6980v9 [cs.LG]_ , 2017.  doi: 10.48550/arXiv.1412.6980.
  * Vladyka et al. [2023b] Anton Vladyka, Eemeli A. Eronen, and Johannes Niskanen.  Implementation of the Emulator-based Component Analysis.  _arXiv:2312.12967v1 [math.NA]_ , 2023b.  doi: 10.48550/arXiv.2312.12967.
  * [45] Jmol development team.  Jmol: an open-source Java viewer for chemical structures in 3D.  URL http://www.jmol.org/.
  * Jäger et al. [2018] Marc O. J. Jäger, Eiaki V. Morooka, Filippo Federici Canova, Lauri Himanen, and Adam S. Foster.  Machine learning hydrogen adsorption on nanoclusters through structural descriptors.  _npj Computational Materials_ , 4(1):37, 2018\.  doi: 10.1038/s41524-018-0096-5.
  * Onat et al. [2020] Berk Onat, Christoph Ortner, and James R. Kermode.  Sensitivity and dimensionality of atomic environment representations used for machine learning interatomic potentials.  _The Journal of Chemical Physics_ , 153(14):144106, 2020.  doi: 10.1063/5.0016005.
  * Hirai et al. [2022] Haruki Hirai, Takumi Iizawa, Tomoyuki Tamura, Masayuki Karasuyama, Ryo Kobayashi, and Takakazu Hirose.  Machine-learning-based prediction of first-principles XANES spectra for amorphous materials.  _Physical Review Materials_ , 6:115601, 2022.  doi: 10.1103/PhysRevMaterials.6.115601.
  * Jolliffe and Cadima [2016] Ian T. Jolliffe and Jorge Cadima.  Principal component analysis: a review and recent developments.  _Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences_ , 374(2065):20150202, 2016.  doi: 10.1098/rsta.2015.0202.
  * Pattnaik et al. [2020] Punyaslok Pattnaik, Shampa Raghunathan, Tarun Kalluri, Prabhakar Bhimalapuram, C. V. Jawahar, and U. Deva Priyakumar.  Machine Learning for Accurate Force Calculations in Molecular Dynamics Simulations.  _The Journal of Physical Chemistry A_ , 124(34):6954–6967, 2020.  doi: 10.1021/acs.jpca.0c03926.
  * Behler [2021] Jörg Behler.  Four Generations of High-Dimensional Neural Network Potentials.  _Chemical Reviews_ , 121(16):10037–10072, 2021\.  doi: 10.1021/acs.chemrev.0c00868.
  * Golze et al. [2022] Dorothea Golze, Markus Hirvensalo, Patricia Hernández-León, Anja Aarva, Jarkko Etula, Toma Susi, Patrick Rinke, Tomi Laurila, and Miguel A. Caro.  Accurate Computational Prediction of Core-Electron Binding Energies in Carbon-Based Materials: A Machine-Learning Model Combining Density-Functional Theory and GW.  _Chemistry of Materials_ , 34(14):6240–6254, 2022\.  doi: 10.1021/acs.chemmater.1c04279.
  * Nguyen et al. [2018] Thuong T. Nguyen, Eszter Székely, Giulio Imbalzano, Jörg Behler, Gábor Csányi, Michele Ceriotti, Andreas W. Götz, and Francesco Paesani.  Comparison of permutationally invariant polynomials, neural networks, and Gaussian approximation potentials in representing water interactions through many-body expansions.  _Journal of Chemical Physics_ , 148(24):241725, 2018.  doi: 10.1063/1.5024577.

## Supplementary information

### Spectrum simulation plane wave cutoff convergence check

We checked the convergence of the spectrum with respect to the plane wave
cutoff used in the simulations. The results from one 0.9 M structure, seen in
Figure 5, show that convergence is reached after 500 eV. We used 600 eV cutoff
in the simulations of this work.

Figure 5: Spectrum from one sample structure calculated using different plane
wave cutoff values. The chosen 600 eV spectrum is on top of both the 500 eV
one and the 700 eV one: convergence has been reached.

### Descriptor hyperparameter grids

The model selection for each descriptor type was carried out as a joint
randomized grid search of the relevant descriptor and neural network
(emulator) parameters. Every atom (S, O and H) of any molecule within
$6~{}\text{\AA}$ of the emission site was included in constructing the
descriptor vector, except in the case of CM. A single center, the emission
site Sem, was used with the descriptors LMBTR, SOAP, ACSF and GT. When
applicable, the cut of radius "r cut" was selected as $6.5~{}\text{\AA}$ to
include all the atoms which were part of the spectrum calculations.

#### LMBTR

We used the implementation of the DScribe package [19, 40] for the LMBTR
descriptor [20]. The studied parameter grid is presented in Table 3. Our
previous knowledge of the descriptor [17] helped with the selection of the
grid. Some unnecessary features (always zero as our system is non-periodic)
were removed from the output.

Table 3: The LMBTR parameter grid. Where applicable, the selected parameter value is shown in bold. Parameter | Distances (k2) | Angles (k3)
---|---|---
geometry function | distance | angle
grid min | $0.7~{}\text{\AA}$ | $0^{\circ}$
grid max | $6.5~{}\text{\AA}$ | $180^{\circ}$
grid n | 20,40,60,80,100 | 5,10,20,30,40
grid $\sigma$ | 0.2,0.4,0.6,0.8,1.0 Å | 9,12,15,18,21∘
weighting function | unity | exp
weighting scale | — | 0.8,1.0,1.2,1.4,1.6
weighting threshold | — | 1e–8

#### SOAP

We used the implementation of the DScribe package [19, 40] for the SOAP [22]
descriptor. The studied parameter grid is presented in Table 4.

Table 4: The SOAP parameter grid. Where applicable, the selected parameter value is shown in bold. Parameter | Values
---|---
r cut | $6.5~{}\text{\AA}$
n max | 4,5,6,7,8
l max | 4,5,6,7,8
sigma | 0.25,0.5,0.75,1.0 Å
rbf | gto
weighting | pow
c |  0.25,0.5,1.0,2.0,4.0
d | 0.25,0.5,1.0,2.0,4.0
m |  2,4,6,8
r0 | 1,2,3,4

#### ACSF

We used the implementation of the DScribe package [19, 40] for the ACSF [21]
descriptor. The studied parameter grid, inspired by Nguyen and co-workers
[53], is presented in Table 5. We used $G^{2}$ and $G^{4}$ to include both
two-body and three-body (radial and angular) interactions. For $G^{2}$ we used
"$R_{s}$ n" linearly spaced values from $0.7~{}\text{\AA}$ to
$6.5~{}\text{\AA}$ and $\eta=12.5/(R_{s}^{2})$. For $G^{4}$ we always had both
$\lambda=-1$ and $\lambda=1$, and $\zeta=2^{x}$ where $x$ is a range of
integers from $0$ to some value with increments of $1$. The parameter $\eta$
had "$\eta$ n" values from "$\eta$ min" to "$\eta$ max" placed on a
logarithmic grid.

Table 5: The ACSF parameter grid. Where applicable, the selected parameter value is shown in bold. "$R_{s}$ n" is for the $G^{2}$ function and the rest are for the $G^{4}$. Parameter | Values
---|---
r cut | $6.5~{}\text{\AA}$
$R_{s}$ n | 10,20,30,40,50,60,70,80
$\eta$ min | 0.0001,0.001,0.01,0.1
$\eta$ max |  1.0,2.0,3.0,4.0
$\eta$ n |  5,10,15,20,25,30
$\zeta$ min | 1
$\zeta$ max | 32,64,128,256
$\lambda$ |  $-1$ and $1$

#### GT

The parameter grid for the self-implemented descriptor GT [25] is presented in
Table 6. Each of the three components (scalar, vector and tensor) had the same
minimum and maximum gaussian width values. The number of linearly spaced
widths between the minimum and the maximum ("n") was unique for each
component.

Table 6: The GT parameter grid. Where applicable, the selected parameter value is shown in bold. Parameter | Values
---|---
r cut | $6.5~{}\text{\AA}$
width min | 0.025,0.05,0.1,0.2,0.4 Å
width max | 4,5,6,7,8,9,10 Å
scalar n | 10,25,50,75,100,125,150
vector n | 10,20,40,60,80,100
tensor n | 10,20,40,60,80,100

#### CM

The parameter grid for the self-implemented descriptor CM [23, 24] is
presented in Table 7. In our implementation the columns and rows of the
initial full Coulomb matrix are first arranged by grouping the elements. These
groups are then individually distance sorted with respect to the emission
site. For each element S, O and H, only a specific number of the closest atoms
(with respect to the emission site $S_{\mathrm{em}}$) are included in the
final matrix. If a given structure had less atoms of a given element than
specified in the grid, the corresponding matrix elements were zeroed. We
constructed the used descriptor vector by flattening the upper triangle
(excluding the diagonal) of the Coulomb matrix.

Table 7: The CM parameter grid. The selected parameter value is shown in bold. Parameter | Values
---|---
sulfur n | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
oxygen n | 4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50
hydrogen n | 2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,66

#### MBDF

The parameter grid for the MBDF developed and implemented by Khan et al. [27]
is presented in Table 8. Excluding the cutoff radius "r cut", the internal
parameters of the descriptor selected by the original authors were assumed to
be suitable. Ideally, we would have included these in the search, but this
would have made the model selection computationally too heavy as building the
feature vector required significantly more CPU time than the other
descriptors. Instead, we opted for an approach similar to that applied to CM.
For each atom (row), the initial matrix had a total of six features (columns).
The rows of the matrix are first arranged by grouping the elements. These
groups are then individually distance sorted with respect to the emission site
Sem. For each element S, O and H, only a specific number rows (obtained from
the closest atoms with respect to the emission site) were included in the
final matrix. In the end, all the atoms (within $6~{}\text{\AA}$ of the
emission site) are included in the descriptor through at least one row, as
each row contains information about the local environment within "r cut" of
one specific center atom. If a given structure had atoms of a given element
than specified in the grid, the corresponding matrix elements were zeroed.

The authors also introduced a grid-based variant, which is independent of the
number of atoms. The variant caused an increase in the dimensionality of the
feature vector including a notable portion of zeros, and was left out of this
work. At the time of download (2023-11-08), the provided code produced six
features for each included center atom.

Table 8: The MBDF parameter grid. Where applicable, the selected parameter value is shown in bold. Parameter | Values
---|---
r cut | $6.5~{}\text{\AA}$
sulfur n | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
oxygen n | 4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50
hydrogen n | 2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,66

### Hyperparameter grid search R2-score distributions

The cross validation R2-score distributions and the number of tested
hyperparameter combinations for each of the six descriptors is shown in Figure
6.

Figure 6: a–f: The CV R2-score distributions and the number of tested
hyperparameter combinations for each of the six descriptors. We used the same
bins for each panel.