Based on the Pytorch version of PhysNet, an evidential layer is implemented.
We recommend to use Miniconda for the creation of a virtual environment.
Once in miniconda, you can create a virtual environment called physnet_torch from the .yml
file with the following command
conda env create --file environment.yml
To activate the virtual environment use the command:
conda activate physnet_torch
For the moment, our model can be trained by .npz
file generated from .xyz
files. The .npz
is generated by gen_npz.py
using the following command
python gen_npz.py -f folder_with_.xyz_files -o name_of_npz_file
You should add the path to the folder with your .xyz
files and the desired name for your database.
The generated .npz
file will be saved in the current directory, we recommend moving it to a directory called data
.
Note: File gen_npz.py
contains the values of the atomization energies of QM9 by default. You can change the values by editing the file.
To run the model, you should modify the desired values in the input.inp
file and then you can run it on the terminal as:
python run_train.py @input.inp
For every training of the Neural Network model, the data is split into three portions. The first set is for training, the second one is for validation, and the final one is for testing. We recommend splitting 80% for training, 10% for validation, and 10% for test. The purpose of the test set
is to evaluate if the training of the model was correct and its performance. To do the evaluation, you can use the file Error_test_evaluation.py
.
Inside this file, there are three options to save a plot, a .csv
file or the .xyz
structures with a variance larger than
95% of the values for variance. To run it, you use the following command:
python Error_test_evaluation.py @input.inp --checkpoint x.pt
Here the checkpoint should contain the parameters for the neural network. The file input.inp
contains the parameters of the
NN architecture.
If you wish to evaluate a molecule with a trained model. You can use the example file calc_energy.py
.
In that file, you should modify the path to your checkpoint of a trained model and the path to the input file for training.
Then, you can run it on the terminal as:
python calc_energy.py -i file_to_eval.xyz
It will return a value for the energy of the molecule, the variance(epistemic uncertainty) and sigma(aleatory uncertainty).
Note: The sigma(aleatory uncertainty) can be recovered by dividing the variance with nu
Note2: If your evaluation(or training) is done on a computer without GPU, you should set up the variable device to 'cpu'
- Add other types of formats for the databases
- Make a better documentation
This is still a work in progress, if you have questions or problems please contact:
L.I.Vazquez-Salazar, email: [email protected]
- Vazquez-Salazar, L. I.; Boittier, E. D.; Meuwly, M. Uncertainty quantification for predictions of atomistic neural networks. arXiv e-prints 2022, arXiv:2207.06916