Penfold Group @ Newcastle University User Manual • Setup • Getting Started • Contact • Publications |
We think that the theoretical simulation of X-ray spectroscopy (XS) should be fast, affordable, and accessible to all researchers.
The popularity of XS is on a steep upward trajectory globally, driven by advances at, and widening access to, high-brilliance light sources such as synchrotrons and X-ray free-electron lasers (XFELs). However, the high resolution of modern X-ray spectra, coupled with ever-increasing data acquisition rates, brings into focus the challenge of accurately and cost-effectively analyzing these data. Decoding the dense information content of modern X-ray spectra demands detailed theoretical calculations that are capable of capturing satisfactorily the complexity of the underlying physics but that are - at the same time - fast, affordable, and accessible enough to appeal to researchers.
This is a tall order - but we're using deep neural networks to make this a reality.
Our XANESNET software address two fundamental challenges: the so-called forward (property/structure-to-spectrum) and reverse (spectrum-to-property/structure) mapping problems. The forward mapping appraoch is similar to the appraoch used by computational researchers in the sense that an input structure is used to generate a spectral observable. In this area the objective of XANESNET is to supplement and support analysis provided by first principles quantum mechnanical simulations. The reverse mapping problem is perhaps the more natural of the two, as it has a clear connection to the problem that X-ray spectroscopists face day-to-day in their work: how can a measurement/observable be interpreted? Here we are seeking to provide methodologies in allow the direct extraction of properties from a recorded spectrum.
XANESNET is under continuous development, so feel free to flag up any issues/make pull requests - we appreciate your input!
The original version of XANESNET, which was implemented using Keras, can be obtained from here. The XANESNET User Manual has more information about the code and its uses.
- GPLv3 licensed open-source distribution
- Automated data processing: Fourier transform, Gaussian transform
- Feature extraction: wACSF, RDC, pDOS, MACE
- Neural network architecture: MLP, CNN, GNN, LSTM, Autoencoder, AE-GAN, Multihead, Transformer, EnvEmbed
- Learning scheme: standard, K-fold, ensemble learning, bootstrapping
- Experiment tracking and visualisation: MLFlow, TensorBoard
- Learning rate scheduler
- Custom ML workflow components and run via input file
- Easy to extend with new components
- Web interface
The XANESNET distribution includes the following files and directories:
README this file LICENSE the GNU General Public License (GPL-3.0) setup.py Python setup script run_test.sh script to run workflow tests clean.sh script to clean generated data data example stucture (.XYZ) and xanes data docs user manual and other documentation inputs test problems and cases tests unit tests xanesnet XANESNET source code
The quickest way to get started with XANESNET is to clone this repository:
git clone https://github.com/NewcastleRSE/xray-spectroscopy-ml.git
The repository contains all source files, along with example input files and datasets.
Complete training sets for X-ray absorption and emission of molecules containing first row transition metals can be obtained using:
git clone https://gitlab.com/team-xnet/training-sets.git
Now you're good to go!
The code has been designed to support python 3.10 and above. Dependencies and version requirements can be installed using:
python -m pip install .
To train a model, use the following command:
python3 -m xanesnet.cli --mode MODE --in_file <path/to/file.yaml> --save
The implemented training modes MODE include:
train_xyz: uses featurised structures as input data and XANES spectra as the target.train_xanes: uses XANES spectra as input data and the featurised structures as the target.train_all: trains both featurised structures and XANES spectra simultaneously (only available for the AEGAN model type).
Replace <path/to/file.yaml> with the path to your YAML input file. Examples of commented input files for training and hyperparameter configuration can be found in the 'inputs/' directory.
Below is an example command for training a model using the MLP architecture, with featurised structures as input data:
python3 -m xanesnet.cli --mode train_xyz --in_file inputs/in_mlp.yaml --save
The resulting trained model and its metadata will be saved in the 'models/' directory.
To use a previously trained model for predictions, use the following command:
python3 -m xanesnet.cli --mode MODE --in_model <path/to/model> --in_file <path/to/file.yaml>
where
--modespecifies the prediction mode.--in_modelspecifies a directory containing a pre-trained model and its metadata.--in_filespecifies the path to the input file for prediction.
The implemented prediction modes include:
predict_xanes: predicts a XANES spectrum from a featurised structural input.predict_xyz: predicts featurised structures from an input XANES spectrum.predict_all: simultaneous prediction of both featurised structures and XANES spectra from corresponding inputs with reconstruction of inputs.
As an example, the following command predicts XANES spectra using the MLP model trained previously:
python3 -m xanesnet.cli --mode predict_xanes --in_model models/mlp_std_xyz_001 --in_file inputs/in_predict.yaml
Prof. Thomas Penfold , Newcastle University, (tom.penfold@newcastle.ac.uk)
Dr. Thomas Pope , Newcastle University (thomas.pope2@newcastle.ac.uk)
Dr. Conor Rankine , York University (conor.rankine@york.ac.uk)
Dr. Bowen Li , Newcastle University (bowen.li2@newcastle.ac.uk)
This project is licensed under the GPL-3.0 License - see the LICENSE.md file for details.
A Deep Neural Network for the Rapid Prediction of X-ray Absorption Spectra - C. D. Rankine, M. M. M. Madkhali, and T. J. Penfold, J. Phys. Chem. A, 2020, 124, 4263-4270.
Accurate, affordable, and generalizable machine learning simulations of transition metal x-ray absorption spectra using the XANESNET deep neural network - C. D. Rankine, and T. J. Penfold, J. Chem. Phys., 2022, 156, 164102.
A deep neural network for valence-to-core X-ray emission spectroscopy - T. J. Penfold, and C. D. Rankine, Mol. Phys., 2022, e2123406.
On the Analysis of X-ray Absorption Spectra for Polyoxometallates - E. Falbo, C. D. Rankine, and T. J. Penfold, Chem. Phys. Lett., 2021, 780, 138893.
Enhancing the Anaysis of Disorder in X-ray Absorption Spectra: Application of Deep Neural Networks to T-Jump-X-ray Probe Experiments - M. M. M. Madkhali, C. D. Rankine, and T. J. Penfold, Phys. Chem. Chem. Phys., 2021, 23, 9259-9269.
The Role of Structural Representation in the Performance of a Deep Neural Network for X-ray Spectroscopy - M. M. M. Madkhali, C. D. Rankine, and T. J. Penfold, Molecules, 2020, 25, 2715.
