Transfer Learning Lithium and Electrolyte Potential Energy Surfaces from Pure and Hybrid DFT
Abstract
One of the most important problems in rational design of batteries is predicting the properties of the Solid Electrolyte Interphase, which (for a metallic anode) is the part of the battery where metallic and non-metallic components come into contact.
However, there is a fundamental problem with predicting the properties of such a mixed material: the two components are best simulated with incompatible levels of density functional theory.
Pure functionals perform well for metal properties, while hybrid or long-range-corrected density functionals perform better for molecular properties and reaction barriers.
We demonstrate a simple method to obviate this conflict by training a machine learning potential energy surface using both levels of theory via transfer learning.
We further show that the resulting model is more accurate than models trained individually to these levels of theory, allowing more accurate property prediction and potentially faster materials discovery.
Introduction
The Solid Electrolyte Interphase (SEI) is a key part of lithium-ion battery design which has proved resistant both to experimental characterization and to accurate simulation[1].
It is difficult to measure the properties of the SEI, such as electronic and ionic conductivity, and therefore difficult to gather enough data to predict how its properties will change with respect to electrode or electrolyte composition.
Quantum mechanics simulations can allow us to calculate materials properties that are difficult to characterize experimentally.
For example, Kuai et al[2] simulate the boundary between lithium metal and an electrolyte, as in a battery with a lithium metal anode, over short timescales using
Density Functional Theory (DFT).
DFT is the method of choice for quantum mechanics simulation of materials, providing excellent coverage of chemical space, reasonable accuracy, and tolerable cost (at least for small systems).
But the SEI is too large, and forms over too long a timescale, to be convenient to describe with DFT.
More fundamentally, the SEI is also plagued by a discrepancy between the types of DFT appropriate for accurate simulation of its different components.
A large number of DFT methods, known as "functionals", have been developed based on different approximations and parameterization (for further details, see Goerigk et al[3]).
DFT functionals without other quantum mechanical calculations included are known as "pure" DFT.
Pure DFT functionals such as the popular Perdew–Burke-Ernzerhof (PBE)[4] functional are computationally efficient and are known to accurately predict the properties of many metals, including lithium[5].
However, pure DFT produces less accurate results for organic systems, and in particular, is known to have large errors for reaction benchmarks[3].
For a reactive system like the SEI, this is a serious drawback. Hybrid DFT improves on pure DFT by incorporating an additional quantum mechanical property, Hartree-Fock exchange.
Long-range corrected (LRC) hybrid functionals such as ω B97X-D3(BJ)[6] achieve particularly high accuracy across large benchmark sets[3].
However, hybrid DFT is much more costly for periodic systems than pure DFT, making periodic hybrid DFT rare aside from computationally cheaper "screened" variants[7].
Even more problematic for SEI simulation, HartreeFock theory introduces poor convergence and non-physical effects when applied to metals[8].
Because of the limitations of both pure and hybrid DFT, there is no broadly satisfactory method to study organic reactions on a metallic surface with high accuracy.
Machine-learning models for potential energy functions [9] have shown promise in simulating electrolytes[10] and metals[11, 12] at much lower cost than either pure or hybrid DFT.
Furthermore, machine learned potential energy surfaces have been trained to output multiple target tasks including different types of DFT[13].
Therefore, it is natural to implement a combined machine learning potential energy surface which can cover both Li metal and common electrolytes, and also the interactions between these components which produce the SEI.
Methods
We begin from the dataset of Dajnowicz et al, which is composed of non-periodic organic electrolyte clusters labeled using the LRC hybrid functional ( ω B97X-D3(BJ)/def2-TZVPD).[10] We supplement this dataset with calculations at the same level of theory including metallic lithium clusters, organic reactions of common electrolytes, and lithium-organic complexes (see Appendix for details).
In addition, we add periodic bulk lithium metal data labeled using the pure DFT functional PBED3[4, 14].
The model architecture we use is QRNN (charge recursive neural network)[15] modified to allow transfer learning in a hard parameter sharing paradigm, as shown in Fig.
Each energy network
E NN shares parameters for the first N-1 layers, creating a shared latent space, followed by a linear output layer which decodes the latent space into separate predictions.
Therefore, the output of each energy network E NN is not one energy value, but one per level of theory to be predicted, as shown in
Eqn 1.
[Equation]
where E j is the energy for label j , pure or hybrid DFT in this case, NN QRNNZ i j is output head j of the energy network for chemical element i , E disp is the empirical dispersion correction of the ω B97X-D functional[16, 17] and E coul is a truncated Coulomb energy which decays smoothly at short range[18].
Input G AEVi is the Atomic Environment Vector (AEV), a rotationally-invariant set of descriptors of the environment of each atom within a radius of 5.2 Angstrom[18], q i is the atomic partial charge predicted as in QRNN (no transfer learning is used for charge prediction), and G qRi is the charge-weighted radial AEV of Jacobson et al[15].
For each training batch, the loss function is a Multi-task Learning (MTL)[19, 18] combination of the energy, atomic force, and charge loss terms over all training points which have the corresponding labels.
Rather than using DFT dipoles to determine the atomic charge loss, as in Dajnowicz et al[10], we use reference atomic partial charges, calculated with the method Geometries, Frequencies, and
Non-covalent 2 Extended Tight Binding (GFN2-xTB)[20].
For large systems, especially systems with high symmetry which have a very small dipole moment, atomic partial charge labels give much more information per system than the overall dipole, and GFN2-xTB is an inexpensive source of reasonable partial charge labels.
Training the charge model neural networks χ NN using periodic data introduces difficulties, since the dipole moment of a periodic system is difficult to define[21], and since no current GFN2-xTB implementation provides fully consistent support for periodic systems[22].
The subject of generating consistent charge training using both periodic and non-periodic data merits further study.
However, since in our dataset the periodic data is only 1% of the full dataset, the problem is not yet a practical concern in this work; we simply train the QRNN charge networks χ NN using only the non-periodic data.
Results
A sensitive test of a potential energy surface for a metal is to calculate its phonon spectrum[11].
Training only to the hybrid DFT dataset produces a qualitatively inaccurate phonon spectrum for lithium, as shown in Fig.
By comparison, transfer learning with both pure and hybrid DFT produces reasonable phonon spectra for both prediction heads of the model.
The pure-DFT head is more accurate, as expected, since the pure DFT dataset contains only periodic metallic lithium.
However, the ω B97X-D3BJ/def2-TZVPD head is still approximately correct, and vastly improved over the equivalent head trained without transfer learning.
Organic reaction barrier tests show a similar trend.
As shown in Table 1, the hybrid head of the transfer learning model shows equivalent or slightly improved performance compared to the equivalent model without transfer learning, on a test set composed of Li radical-initiated organic reaction barriers (see Fig.
4 and the Appendix).
For the transfer learning model, only the hybrid DFT head gives reasonable results, since the pure DFT dataset is composed of Li only: the transfer learning technique [Table] does not produce good results in the complete absence of relevant data for the given output head, which is expected.
Even more effective transfer learning might occur if the overlap between the pure and hybrid parts of the dataset were greater: currently no exactly-equivalent geometries exist in the dataset, since the pure DFT is uniformly periodic and the hybrid DFT is uniformly non-periodic.
The final entry in Table 1 is the equivalent RMSE for the pure DFT functional PBE-D3, demonstrating the relative weakness of this functional for electrolyte reaction barriers.
The model is able to simulate the dynamics of Li metal in contact with ethylene carbonate at 300K, as shown in Fig.
However, we do not yet have an appropriate reference comparison to determine the accuracy of the combined simulation, besides extrapolation from our test sets.
Comparison to DFT dynamics, such as the work of Kuai et al[2], is costly (especially with hybrid functionals) and not necessarily reliable.
Another option is to create non-periodic test sets labeled with hybrid DFT (or higher-level quantum mechanics calculations), allowing comparison to accurate references at lower cost, but with the risk of missing larger-scale effects.
Conclusions
C, White=H. We have shown that a simple transfer learning architecture allows effective transfer between pure and hybrid DFT, making simulations of metallic systems and organic reactions more effective.
In particular, we show that the phonon spectrum of metallic lithium for such a model is greatly improved over the non-periodic hybrid DFT equivalent, without degrading the accuracy for organic reaction barriers.
Like other machine learning potential energy surfaces, this model does not have the broad chemical applicability of DFT: functional groups outside the training set (such as phosphates) will likely give larger errors.
Likewise, given unusual geometric inputs such as atoms very close together, the energies and forces returned may be very inaccurate, thus ruining the predictive power of a given simulation from that point onward.
We find that these unstable regimes are easy to detect during MD because they produce obvious spikes in system energies.
However, demonstrating that a model is free from such errors without running MD appears to be difficult, since the recent work of Fu et al[24] shows that force benchmark accuracy does not correlate well with MD stability.
Further work is needed in this direction - for example, some models use added atomic repulsion terms to make out-of-training geometries in MD less likely[13].
Even with potential energy models much faster than DFT, such as this one, all-atom SEI simulations cannot reproduce the full dynamics of SEI formation, since the time scale of SEI formation (hours) is far beyond that of all-atom simulations (typically nanoseconds).
However, the same applies to problems such as crystal structure prediction for organic molecules, where all-atom methods have achieved successes - not by simulating the full crystallization, but by optimizing and ranking candidate crystal structures. Given an accurate potential energy surface, the same procedure should be applicable to the SEI, significantly refining our understanding of the SEI’s true nature.
Such a breakthrough would facilitate rational structure-property design of the SEI.
Furthermore, we expect all-atom SEI simulations to aid design by predicting structure-property relationships (such as variations in composition based on initial additives) which can be used as inputs for conventional or
AI-guided design methods.
Being able to simulate millions of timesteps per day on a GPU for systems of 1000 or more atoms, our method promises to be able to study materials systems much faster than pure DFT or hybrid
DFT, while avoiding the accuracy pitfalls of training to just a single DFT method.
Outside of our demonstrated area of application, lithium batteries, this technique should be applicable to other metal-nonmetal interface problems which commonly arise in materials science, such as the study of corrosion and the design of corrosion-resistant coatings.
We anticipate that transfer learning potential energy models will be an important tool for future materials design.
Acknowledgments and Disclosure of Funding
This work is supported and funded by the Bill and Melinda Gates Foundation.
The authors declare no competing financial interest.
We would like to thank Verena Neufeld, Nongnuch Artrith, Alexander Urban, Richard A. Friesner, and the other members of the Columbia Center for Computational Electrochemistry, as well as Karl
Leswing, Mat Halls, and Robert Abel of Schrodinger, Inc, and Adrian Roitberg of the University of
Florida, for their advice and consultations.
A Appendix
Training and test datasets of labeled data (atomic coordinates, system net charges, system energies, atomic forces, and atomic partial charges) are provided under the MIT license ( https://www.mit. edu/~amini/LICENSE.md ), and are available here: https://doi.org/10.6084/m9.figshare. 21200515.v1 .
The dataset is a superset of that from Dajnowicz et al[10] containing 600,390 total datapoints, of which 362,382 are from Dajnowicz et al and 238,008 are new calculations in a format compatible with the old.
Of the newly added points, 6902 are periodic systems.
GFN2-xTB charges have also been added to all non-periodic systems for which GFN2-xTB labeling converged (581,954 points), including the points from the Dajnowicz et al dataset.
The keys are arbitrary integers (stored as strings).
Each value is a dictionary with the following properties: { ’atomicNumbers’:
[integers representing atomic number for each atom], ’elements’: [strings representing the element for each atom], ’positions’:
[[x, y, z] coords of each atom, in Angstroms], ’charge’: integer representing system total charge, ’multiplicity’: integer representing spin multiplicity, ’lattice’:
[[lattice vectors, in Angstroms, only exists if periodic]], ’labels’:
dict of QM reference data for this point (energy, gradient, etc)
Every system needs at least one entry under ’labels’: ’PBE-D3’ or ’wB97X-D3BJ__def2-TZVPD’.
Some label types will be missing from some points, for example xtbCharges for periodic systems.
Labels not present for a datapoint are simply excluded from the loss function for that datapoint.
Example ’labels’ entry: { ’PBE-D3’: { ’totalEnergy’: system energy in Hartree, ’atomizationEnergy’: system energy, in Hartree, minus per-atom offsets, ’gradient’: [[dE/dx, dE/dy, dE/dz] for each atom, in Hartree/Angstrom] } ’wB97X-D3BJ__def2-TZVPD’: { ’totalEnergy’: system energy in Hartree, ’gradient’: [[dE/dx, dE/dy, dE/dz] for each atom, in Hartree/Angstrom], ’dipoleMoment’: [system dipole moment vector in electron-Angstroms], ’atomizationEnergy’: system energy, in Hartree, minus per-atom offsets, ’xtbCharges’: [atomic partial charges from GFN2-xTB, in e-] } }
The metallic lithium cluster geometries are sampled from common crystal packings (BCC, FCC,
SC) supplemented with scaling and Gaussian noise.
In addition, we add periodic bulk lithium metal data for these common crystal packings, also supplemented with scaling and Gaussian noise.
The organic reaction samples are generated by applying Articial Force-Induced Reactions (AFIR)[25, 26] sampled across the set of electrolytes by selecting atom pairs uniformly at random to induce reactions.
The lithium-organic complexes are prepared using AFIR between existing clusters to cause them to react, followed by one round of running MD of an EC/Li metal interface with the QRNN model and extracting clusters at random along the interface region.
This procedure could likely be improved by active learning, by running more rounds of MD and extracting new clusters selectively via ensemble estimates of model uncertainty[27]. Recent work by Zhang et al[28] provides evidence that active learning from MD performed with a machine learning model can be used to sample and model the space of chemical reactions.
All non-periodic DFT calculations in the training dataset are performed using Psi4[29] v1.6, with the same settings as in Dajnowicz et al (density fitting, a 1e-10 DFT basis tolerance, a [-1e-
 Schwarz-]1eSchwarz screening threshold)[10] with the addition of two newly available Psi4 acceleration settings: dft_pruning_scheme "robust" and s_orthogonalization "partialcholesky" with s_cholesky_tolerance set to 1e-6 (matching the 1e-6 linear dependency cutoff of Dajnowicz et al).
Using Google Compute n2d-highmem CPU nodes with hyperthreading disabled, we observed a CPU time per system of approximately
[Equation]
Where n basis is the number of basis functions used for the system and n basis − aux is the number of auxiliary basis functions.
This agrees with the expected cubic scaling of density-fitting DFT.
All periodic DFT calculations in the training dataset are performed using Quantum Espresso[30] as implemented in Schrodinger Materials Science Suite[31] version 2022-3.
The exchange-correlation energy is determined using generalized gradient approximation (GGA) Perdew-Burke-Ernzerhof (PBE) functional[4] coupled with D3 dispersion correction[14] and a plane wave energy cutoff of
[-of
-]Ry.
The Brillouin zone integration is performed using 3x3x3 k-point mesh for bulk supercells and 3x3x1 k-point mesh for the surface supercells.
GFN2-xTB charge labeling is performed using the Python API xtb-python[32] with default settings.
The test dataset of electrolyte decomposition reaction barriers is labeled using Jaguar[33] release 2019-4 using the ω B97X-D3(BJ)/def2-TZVPD and PBE-D3/def2-TZVPD levels of theory, with default settings for single-point energies.
It consists of Li radical-initiated decomposition reactions for the following common electrolytes: ethylene carbonate, propylene carbonate, vinylene carbonate, dimethyl carbonate, diethyl carbonate, ethyl methyl carbonate, and fluoroethylene carbonate.
The transition state geometries are generated using Jaguar transition state search[33].
Our code is a proprietary fork of TorchANI[34], the original of which is available at https:// github.com/aiqm/torchani .
Our phonon and molecular dynamics calculations are performed using our PyTorch code interfaced with the Atomic Simulation Environment (ASE)[35].
The molecular dynamics speed for this setup on a 1000-atom system is approximately 0.4ns/day on a 1080-Ti GPU in our internal cluster.
Significantly greater speed can be achieved with a native GPU implementation.
Our training is performed using the same hyperparameters as Dajnowicz et al[10], except for a training batch size of 128 (which makes periodic training more efficient), fixed epoch size of [-200,
-]200, (so that the length of training would not increase with dataset size), and a training/validation split uniformly at random at a ratio of 99:1 (we have not seen an increase in generalization from early stopping on larger validation sets, so we use a small validation set).
More hyperparameter tuning would probably be helpful, especially for metallic lithium, which is unlike the non-metallic systems for which these hyperparameters were originally developed.
Each training run is performed on a 1080-Ti GPU for approximately 48 hours.