Coder Social home page Coder Social logo

amirhajibabaei / autoforce Goto Github PK

View Code? Open in Web Editor NEW
26.0 5.0 13.0 1.67 MB

Sparse Gaussian Process Potentials

License: MIT License

Python 100.00%
physics chemistry machinelearning gaussian-processes sparse-gaussian-processes density-functional-theory molecular-dynamics-simulation ab-initio-simulations metadynamics metadynamics-simulations

autoforce's Introduction

Introduction

This is a package for machine learning (ML) of the potential energy surface (PES) from costly ab initio calculations using the sparse Gaussian process regression (SGPR) algorithm. Ab initio calculations such as structure relaxation, AIMD, NEB, etc. can be substantially accelerated by fast ML models built on-the-fly. Moreover, the ML models built with smaller size of physical systems can be applied for simulations of larger systems which are impossible with direct ab initio methods. In principle, all the calculators supported by the atomic simulation environment (ASE) can be modeled.

Dependencies

  • required: numpy, scipy, pytorch, ase, mpi
  • conditional: mpi4py (see below)
  • optional: pymatgen, spglib, mendeleev, matplotlib, nglview, psutil, LAMMPS

mpi4py is only required if pytorch is not directly linked with mpi (i.e. torch.distributed.is_mpi_available() == False). Note that for coupling pytorch with mpi it should be compiled from the source. This package is regularly synced with the latest versions of ase and pytorch. Additional setting maybe needed for linking the ab initio calculators (VASP, GAUSSIAN, etc.) with ase (see this).

Installation

Clone the source code by

git clone https://github.com/amirhajibabaei/AutoForce.git

Go to the source code directory and install by

pip install .

Command line interface

For machine learning accelerated molecular dynamics, structure relaxation, etc (using VASP, GAUSSIAN, etc.) from the command line see theforce/cl/README.md.

Python API

It wraps ASE calculators:

from theforce.calculator.active import ActiveCalculator

# atoms = see ASE docs
# main_calc = see ASE calculators
# kernel = see the proceeding

calc = ActiveCalculator(calculator=main_calc)
atoms.set_calculator(calc)

# proceed with the desired calculations
# ...

For detailed information see theforce/calculator/README.md.

Optional coupling with LAMMPS

For running LAMMPS dynamics, it's python package should be installed. See the examples/LAMMPS folder.

Examples

For usage examples, see the examples/ folder.

Practical notes

On-the-fly ML

  • Ab initio calculations: The ab-initio calculators should be used only for single-point energy and force calculations. If on-the-fly ML fails, first and foremost, check if the underlying ab initio calculations (for the electronic structure) do converge.
  • ML models: The default settings are such that ML models are automatically saved and loaded in consecutive simulations. Thus check if the proper model is present in the working directory.
  • Initial structure for MD: Starting MD with a relaxed strucure (forces=0) is not advised. Either manually disturb the initial structure or use the rattle mechanism.
  • Structure optimization: Many structure relaxation algorithms depend on the forces history. With on-the-fly ML, every time the model is updated, forces suddenly change. The force discontinuity, if too large, may corrupt the optimizer. This can be avoided by reseting the optimizer history or training a preliminary model before relaxation.

Scalability

  • Distributed computing with MPI: The algorithm can use at most N (=number of atoms in the system) processes during MD. Using more processes can only speed-up the ML updates.
  • CUDA: Currently no GPU acceleration is implemented.
  • Species: Presence of more atomic species makes the simulation slower (often exponentially).

Citation

@article{PhysRevB.103.214102,
  title = {Sparse Gaussian process potentials: Application to lithium diffusivity in superionic conducting solid electrolytes},
  author = {Hajibabaei, Amir and Myung, Chang Woo and Kim, Kwang S.},
  journal = {Phys. Rev. B},
  volume = {103},
  issue = {21},
  pages = {214102},
  numpages = {7},
  year = {2021},
  month = {Jun},
  publisher = {American Physical Society},
  doi = {10.1103/PhysRevB.103.214102},
  url = {https://link.aps.org/doi/10.1103/PhysRevB.103.214102}
}




alt text

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.