GithubHelp home page GithubHelp logo

physnet_der's Introduction

PhysNet DER (Deep Evidential Regression)

Based on the Pytorch version of PhysNet, an evidential layer is implemented.

Using Physnet-DER

Setting up the environment

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

Creating a new Database

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.

Running a model

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

Evaluating a model in the test set.

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.

Evaluating a molecule with a trained model

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'

To Do:

  • Add other types of formats for the databases
  • Make a better documentation

Contact

This is still a work in progress, if you have questions or problems please contact:

L.I.Vazquez-Salazar, email: [email protected]

Reference

  • Vazquez-Salazar, L. I.; Boittier, E. D.; Meuwly, M. Uncertainty quantification for predictions of atomistic neural networks. arXiv e-prints 2022, arXiv:2207.06916

physnet_der's People

Contributors

julianguyenkieu avatar livazquezs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.