Skip to main content

Atomic Graph ATtention networks for predicting atomic energies and forces.

Project description

AGAT (Atomic Graph ATtention networks)

GitHub Pypi PyPI - Downloads PyPI - Wheel Documentation Status

The PyTorch backend AGAT is on the way...



Model architecture

Using AGAT

The documentation of AGAT API is available.

Installation

Install with conda environment

  • Create a new environment

    conda create -n agat python==3.10
    
  • Activate the environment

    conda activate agat
    
  • Install package

    pip install agat
    
  • Install dgl.
    Please navigate to the Get Started page of dgl. For GPU version:

    conda install -c dglteam/label/cu118 dgl
    

    For now, the cpu version 1.1.2 of dgl has bugs. You can install the cpu version with pip install dgl==1.1.1.

  • Change dgl backend to tensorflow.

    If you still cannot use tensorflow backend dgl, run the following on Linux OS:

    wget https://data.dgl.ai/wheels/cu118/dgl-1.1.1%2Bcu118-cp310-cp310-manylinux1_x86_64.whl
    pip install ./dgl-1.1.1+cu118-cp310-cp310-manylinux1_x86_64.whl
    pip install numpy --upgrade
    
  • For tensorflow of GPU version, if you don't have CUDA and CUDNN on your device, you need to run (Linux OS):

    conda install -c conda-forge cudatoolkit=11.8.0
    pip install nvidia-cudnn-cu11==8.6.0.163
    mkdir -p $CONDA_PREFIX/etc/conda/activate.d
    echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
    echo 'export LD_LIBRARY_PATH=$CUDNN_PATH/lib:$CONDA_PREFIX/lib/:$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
    source $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
    # Verify install:
    python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
    

    Refer to Install TensorFlow with pip and Tensorflow_GPU for more details (other OSs).

    Attention: Please use the correct cuda and cudnn to avoid unnecessary issues.

Quick start

Prepare VASP calculations

Collect paths of VASP calculations

  • We provided examples of VASP outputs at VASP_calculations_example.
  • Find all directories containing OUTCAR file:
    find . -name OUTCAR > paths.log
    
  • Remove the string 'OUTCAR' in paths.log.
    sed -i 's/OUTCAR$//g' paths.log
    
  • Specify the absolute paths in paths.log.
    sed -i "s#^.#${PWD}#g" paths.log
    

Build database

from agat.data import AgatDatabase
if __name__ == '__main__':
    ad = AgatDatabase(mode_of_NN='ase_dist', num_of_cores=2)
    ad.build()

Train AGAT model

from agat.model import Train
at = Train()
at.fit_energy_model()
at.fit_force_model()

Model prediction

from agat.app import GatApp
energy_model_save_dir = os.path.join('out_file', 'energy_ckpt')
force_model_save_dir = os.path.join('out_file', 'force_ckpt')
graph_build_scheme_dir = 'dataset'
app = GatApp(energy_model_save_dir, force_model_save_dir, graph_build_scheme_dir)
graph, info = app.get_graph('POSCAR')
energy = app.get_energy(graph)
forces = app.get_forces(graph)

Geometry optimization

from ase.io import read
from ase.optimize import BFGS
from agat.app import GatAseCalculator
from agat.default_parameters import default_hp_config
poscar = read('POSCAR')
calculator=GatAseCalculator(energy_model_save_dir,
                            force_model_save_dir,
                            graph_build_scheme_dir)
poscar = Atoms(poscar, calculator=calculator)
dyn = BFGS(poscar, trajectory='test.traj')
dyn.run(**default_hp_config['opt_config'])

Some default parameters

agat/default_parameters.py; Explanations: docs/sphinx/source/Default parameters.md.

Change log

Please check Change_log.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agat-7.14.0.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

agat-7.14.0-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

Details for the file agat-7.14.0.tar.gz.

File metadata

  • Download URL: agat-7.14.0.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for agat-7.14.0.tar.gz
Algorithm Hash digest
SHA256 9b7de3bdc8b11df2d5cfd6d7620d1f23d8c60254b03918edfb5cd945bf48d785
MD5 351f98d55d1ec9e743c1ae41f6d9cc09
BLAKE2b-256 0eaa2e8bbc3bc9299417bfefd89fa059762b4f0fa91a8a5272b2422b4641a25c

See more details on using hashes here.

File details

Details for the file agat-7.14.0-py3-none-any.whl.

File metadata

  • Download URL: agat-7.14.0-py3-none-any.whl
  • Upload date:
  • Size: 71.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for agat-7.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89bc78e65d3f66af074c938c0a1b4bfe9000d80f457997ea7a5cf03357b27a0c
MD5 bb6e1de4b3cee918cd7b9c2bc2ee5633
BLAKE2b-256 05eb076f056efa5bd10a60cd98466a1800f1933ee4acb395a17598cc3d8311a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page