├── .nojekyll ├── docs ├── .nojekyll ├── _sources │ ├── FAQ.md.txt │ ├── Reference.md.txt │ ├── Contribution.md.txt │ ├── API_Docs.rst.txt │ ├── Introduction.rst.txt │ └── index.rst.txt ├── sphinx │ ├── source │ │ ├── FAQ.md │ │ ├── logo.png │ │ ├── Change_log.rst │ │ ├── API_Docs │ │ │ ├── bin │ │ │ │ ├── bayesian_skopt.rst │ │ │ │ └── agat_bayesian_opt.rst │ │ │ ├── app │ │ │ │ ├── ase_torch │ │ │ │ │ ├── ase_filters.rst │ │ │ │ │ ├── bfgs_torch.rst │ │ │ │ │ ├── optimize_torch.rst │ │ │ │ │ ├── ase_dyn.rst │ │ │ │ │ └── ase_abc.rst │ │ │ │ ├── cata │ │ │ │ │ ├── volcano_plot.rst │ │ │ │ │ ├── volcano_2e.rst │ │ │ │ │ ├── find_adsorption_site.rst │ │ │ │ │ ├── increase_vacuum.rst │ │ │ │ │ ├── high_throughput_dft_calculation.rst │ │ │ │ │ └── high_throughput_predict.rst │ │ │ │ ├── ase_torch.rst │ │ │ │ ├── cata.rst │ │ │ │ ├── app_deprecated.rst │ │ │ │ └── ensembles.rst │ │ │ ├── bin.rst │ │ │ ├── model.rst │ │ │ ├── app.rst │ │ │ ├── lib.rst │ │ │ ├── data.rst │ │ │ ├── lib │ │ │ │ ├── exceptions.rst │ │ │ │ ├── file_lib.rst │ │ │ │ ├── incar_tag.rst │ │ │ │ └── high_throughput_lib.rst │ │ │ ├── data │ │ │ │ ├── PymatgenStructureAnalyzer.rst │ │ │ │ ├── generate_database.rst │ │ │ │ ├── load_dataset.rst │ │ │ │ └── atomic_feature.rst │ │ │ └── model │ │ │ │ ├── fit.rst │ │ │ │ ├── layer.rst │ │ │ │ └── model.rst │ │ ├── Chinese_support │ │ │ ├── WeChat_QR_code.jpg │ │ │ └── 中文支持.md │ │ ├── Chinese_support.rst │ │ ├── Reference.md │ │ ├── Contribution.md │ │ ├── API_Docs.rst │ │ ├── Introduction.rst │ │ ├── Tutorial │ │ │ ├── Structural_optimization.md │ │ │ ├── Build_graph.md │ │ │ ├── Predict_structural_file.md │ │ │ ├── High_throughput_prediction.md │ │ │ ├── Build_database.md │ │ │ └── Train_AGAT_model.md │ │ ├── index.rst │ │ ├── conf - Copy.py │ │ ├── conf.py │ │ ├── logo.svg │ │ ├── logo FuHaijun.svg │ │ ├── Quick start.md │ │ ├── Installation.md │ │ └── Tutorial.rst │ ├── build │ │ └── doctrees │ │ │ ├── FAQ.doctree │ │ │ ├── index.doctree │ │ │ ├── API_Docs.doctree │ │ │ ├── Reference.doctree │ │ │ ├── Tutorial.doctree │ │ │ ├── API_Docs │ │ │ ├── app.doctree │ │ │ ├── lib.doctree │ │ │ ├── data.doctree │ │ │ ├── model.doctree │ │ │ ├── app │ │ │ │ ├── cata.doctree │ │ │ │ └── cata │ │ │ │ │ ├── volcano_2e.doctree │ │ │ │ │ ├── volcano_plot.doctree │ │ │ │ │ ├── increase_vacuum.doctree │ │ │ │ │ ├── find_adsorption_site.doctree │ │ │ │ │ ├── high_throughput_predict.doctree │ │ │ │ │ ├── generate_adsorption_sites.doctree │ │ │ │ │ └── high_throughput_dft_calculation.doctree │ │ │ ├── model │ │ │ │ ├── fit.doctree │ │ │ │ ├── layer.doctree │ │ │ │ └── model.doctree │ │ │ ├── lib │ │ │ │ ├── file_lib.doctree │ │ │ │ ├── incar_tag.doctree │ │ │ │ ├── model_lib.doctree │ │ │ │ ├── exceptions.doctree │ │ │ │ ├── adsorbate_poscar.doctree │ │ │ │ └── high_throughput_lib.doctree │ │ │ └── data │ │ │ │ ├── build_dataset.doctree │ │ │ │ ├── load_dataset.doctree │ │ │ │ ├── atomic_feature.doctree │ │ │ │ └── PymatgenStructureAnalyzer.doctree │ │ │ ├── Change_log.doctree │ │ │ ├── Contribution.doctree │ │ │ ├── Installation.doctree │ │ │ ├── Introduction.doctree │ │ │ ├── Quick start.doctree │ │ │ ├── environment.pickle │ │ │ ├── Chinese_support.doctree │ │ │ ├── Default parameters.doctree │ │ │ ├── Change_log │ │ │ └── Change_log.doctree │ │ │ ├── Chinese_support │ │ │ └── 中文支持.doctree │ │ │ └── Tutorial │ │ │ ├── Build_graph.doctree │ │ │ ├── Build_database.doctree │ │ │ ├── Train_AGAT_model.doctree │ │ │ ├── VASP_calculations.doctree │ │ │ ├── Predict_structural_file.doctree │ │ │ ├── Structural_optimization.doctree │ │ │ └── High_throughput_prediction.doctree │ ├── Makefile │ └── make.bat ├── objects.inv ├── _static │ ├── file.png │ ├── minus.png │ ├── plus.png │ ├── css │ │ ├── fonts │ │ │ ├── lato-bold.woff │ │ │ ├── lato-bold.woff2 │ │ │ ├── lato-normal.woff │ │ │ ├── lato-normal.woff2 │ │ │ ├── Roboto-Slab-Bold.woff │ │ │ ├── lato-bold-italic.woff │ │ │ ├── Roboto-Slab-Bold.woff2 │ │ │ ├── Roboto-Slab-Regular.woff │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ ├── lato-bold-italic.woff2 │ │ │ ├── lato-normal-italic.woff │ │ │ ├── lato-normal-italic.woff2 │ │ │ ├── Roboto-Slab-Regular.woff2 │ │ │ └── fontawesome-webfont.woff2 │ │ └── badge_only.css │ ├── fonts │ │ ├── Lato │ │ │ ├── lato-bold.eot │ │ │ ├── lato-bold.ttf │ │ │ ├── lato-bold.woff │ │ │ ├── lato-bold.woff2 │ │ │ ├── lato-italic.eot │ │ │ ├── lato-italic.ttf │ │ │ ├── lato-italic.woff │ │ │ ├── lato-italic.woff2 │ │ │ ├── lato-regular.eot │ │ │ ├── lato-regular.ttf │ │ │ ├── lato-regular.woff │ │ │ ├── lato-regular.woff2 │ │ │ ├── lato-bolditalic.eot │ │ │ ├── lato-bolditalic.ttf │ │ │ ├── lato-bolditalic.woff │ │ │ └── lato-bolditalic.woff2 │ │ └── RobotoSlab │ │ │ ├── roboto-slab-v7-bold.eot │ │ │ ├── roboto-slab-v7-bold.ttf │ │ │ ├── roboto-slab-v7-bold.woff │ │ │ ├── roboto-slab-v7-bold.woff2 │ │ │ ├── roboto-slab-v7-regular.eot │ │ │ ├── roboto-slab-v7-regular.ttf │ │ │ ├── roboto-slab-v7-regular.woff │ │ │ └── roboto-slab-v7-regular.woff2 │ ├── documentation_options.js │ ├── js │ │ ├── badge_only.js │ │ └── theme.js │ ├── logo.svg │ ├── _sphinx_javascript_frameworks_compat.js │ ├── doctools.js │ ├── pygments.css │ └── language_data.js ├── _images │ └── WeChat_QR_code.jpg └── .buildinfo ├── .gitattributes ├── files ├── package.pptx └── architecture.pptx ├── dist ├── agat-9.1.1.tar.gz └── agat-9.1.1-py3-none-any.whl ├── .spyproject └── config │ ├── defaults │ ├── defaults-encoding-0.2.0.ini │ ├── defaults-vcs-0.2.0.ini │ ├── defaults-codestyle-0.2.0.ini │ └── defaults-workspace-0.2.0.ini │ ├── encoding.ini │ ├── backups │ ├── encoding.ini.bak │ ├── vcs.ini.bak │ ├── codestyle.ini.bak │ └── workspace.ini.bak │ ├── vcs.ini │ ├── codestyle.ini │ └── workspace.ini ├── agat ├── __main__.py ├── app │ ├── __init__.py │ ├── optimizers.py │ ├── cata │ │ ├── __init__.py │ │ ├── increase_vacuum.py │ │ ├── find_adsorption_site.py │ │ └── volcano_2e.py │ ├── ase_torch │ │ └── ase_abc.py │ └── ensembles.py ├── lib │ ├── exceptions.py │ ├── __init__.py │ ├── incar_tag.py │ └── file_lib.py ├── model │ ├── __init__.py │ └── layer.py ├── __init__.py ├── main.py ├── data │ ├── __init__.py │ └── atomic_feature.py └── bin │ └── agat_bayesian_opt.py ├── test ├── test.py ├── export_cell_stress.py ├── dataloader_test.py ├── tesor_computation_test.py └── dgl_bug_test.py ├── FAQ.md ├── How_to_use_documentation_of_previous_versions.md ├── .gitignore ├── How_to_use_sphinx.md ├── CITATION.cff ├── .github └── workflows │ ├── pypi-package.yml │ └── python-package.yml ├── setup.py ├── agat_win_cpu.yml ├── agat_linux_gpu_cu124_py312.yml ├── agat_linux_gpu_cu124.yml └── Customized_installation.md /.nojekyll: -------------------------------------------------------------------------------- 1 | This is a test. 2 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | This is a test. 2 | -------------------------------------------------------------------------------- /docs/_sources/FAQ.md.txt: -------------------------------------------------------------------------------- 1 | # Frequently asked questions (FAQ) 2 | 3 | - TEST -------------------------------------------------------------------------------- /docs/sphinx/source/FAQ.md: -------------------------------------------------------------------------------- 1 | # Frequently asked questions (FAQ) 2 | 3 | - TEST -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/objects.inv -------------------------------------------------------------------------------- /files/package.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/files/package.pptx -------------------------------------------------------------------------------- /dist/agat-9.1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/dist/agat-9.1.1.tar.gz -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/plus.png -------------------------------------------------------------------------------- /.spyproject/config/defaults/defaults-encoding-0.2.0.ini: -------------------------------------------------------------------------------- 1 | [encoding] 2 | text_encoding = utf-8 3 | 4 | -------------------------------------------------------------------------------- /files/architecture.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/files/architecture.pptx -------------------------------------------------------------------------------- /docs/sphinx/source/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/source/logo.png -------------------------------------------------------------------------------- /.spyproject/config/encoding.ini: -------------------------------------------------------------------------------- 1 | [encoding] 2 | text_encoding = utf-8 3 | 4 | [main] 5 | version = 0.2.0 6 | 7 | -------------------------------------------------------------------------------- /dist/agat-9.1.1-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/dist/agat-9.1.1-py3-none-any.whl -------------------------------------------------------------------------------- /docs/_images/WeChat_QR_code.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_images/WeChat_QR_code.jpg -------------------------------------------------------------------------------- /.spyproject/config/backups/encoding.ini.bak: -------------------------------------------------------------------------------- 1 | [encoding] 2 | text_encoding = utf-8 3 | 4 | [main] 5 | version = 0.2.0 6 | 7 | -------------------------------------------------------------------------------- /.spyproject/config/defaults/defaults-vcs-0.2.0.ini: -------------------------------------------------------------------------------- 1 | [vcs] 2 | use_version_control = False 3 | version_control_system = 4 | 5 | -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-bold.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bold.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bold.ttf -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-normal.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bold.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-italic.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-italic.ttf -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/FAQ.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/FAQ.doctree -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-normal.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-italic.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-regular.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-regular.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-regular.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-regular.woff2 -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/index.doctree -------------------------------------------------------------------------------- /.spyproject/config/vcs.ini: -------------------------------------------------------------------------------- 1 | [vcs] 2 | use_version_control = False 3 | version_control_system = 4 | 5 | [main] 6 | version = 0.2.0 7 | 8 | -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/Roboto-Slab-Bold.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-bold-italic.woff -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bolditalic.eot -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bolditalic.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bolditalic.woff -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Reference.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Reference.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/Change_log.rst: -------------------------------------------------------------------------------- 1 | Change log 2 | ============ 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | Change_log/Change_log.md -------------------------------------------------------------------------------- /.spyproject/config/defaults/defaults-codestyle-0.2.0.ini: -------------------------------------------------------------------------------- 1 | [codestyle] 2 | indentation = True 3 | edge_line = True 4 | edge_line_columns = 79 5 | 6 | -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/Roboto-Slab-Regular.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-bold-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-normal-italic.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/lato-normal-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/Lato/lato-bolditalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/Lato/lato-bolditalic.woff2 -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Change_log.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Change_log.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Contribution.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Contribution.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Installation.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Installation.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Introduction.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Introduction.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Quick start.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Quick start.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/environment.pickle -------------------------------------------------------------------------------- /.spyproject/config/backups/vcs.ini.bak: -------------------------------------------------------------------------------- 1 | [vcs] 2 | use_version_control = False 3 | version_control_system = 4 | 5 | [main] 6 | version = 0.2.0 7 | 8 | -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/css/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/data.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/data.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/model.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/model.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Chinese_support.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Chinese_support.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/bin/bayesian_skopt.rst: -------------------------------------------------------------------------------- 1 | bayesian_skopt 2 | ----------------- 3 | 4 | Optimize AGAT hyperparameters with ``skopt`` module. 5 | 6 | -------------------------------------------------------------------------------- /.spyproject/config/codestyle.ini: -------------------------------------------------------------------------------- 1 | [codestyle] 2 | indentation = True 3 | edge_line = True 4 | edge_line_columns = 79 5 | 6 | [main] 7 | version = 0.2.0 8 | 9 | -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/model/fit.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/model/fit.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Default parameters.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Default parameters.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/Chinese_support/WeChat_QR_code.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/source/Chinese_support/WeChat_QR_code.jpg -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/file_lib.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/file_lib.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/incar_tag.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/incar_tag.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/model_lib.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/model_lib.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/model/layer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/model/layer.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/model/model.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/model/model.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Change_log/Change_log.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Change_log/Change_log.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Chinese_support/中文支持.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Chinese_support/中文支持.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/Build_graph.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/Build_graph.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/Chinese_support.rst: -------------------------------------------------------------------------------- 1 | 中文手册 2 | ================== 3 | 4 | 5 | .. toctree:: 6 | :maxdepth: 6 7 | 8 | Chinese_support/中文支持 9 | 10 | -------------------------------------------------------------------------------- /.spyproject/config/backups/codestyle.ini.bak: -------------------------------------------------------------------------------- 1 | [codestyle] 2 | indentation = True 3 | edge_line = True 4 | edge_line_columns = 79 5 | 6 | [main] 7 | version = 0.2.0 8 | 9 | -------------------------------------------------------------------------------- /docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/exceptions.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/exceptions.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/Build_database.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/Build_database.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/data/build_dataset.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/data/build_dataset.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/data/load_dataset.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/data/load_dataset.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/Train_AGAT_model.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/Train_AGAT_model.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/VASP_calculations.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/VASP_calculations.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch/ase_filters.rst: -------------------------------------------------------------------------------- 1 | ########### 2 | ase_filters 3 | ########### 4 | 5 | .. Hint:: Modified objects to fit the Torch tensor calculation. 6 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch/bfgs_torch.rst: -------------------------------------------------------------------------------- 1 | ########## 2 | bfgs_torch 3 | ########## 4 | 5 | .. Hint:: Modified objects to fit the Torch tensor calculation. 6 | -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/volcano_2e.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/volcano_2e.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/data/atomic_feature.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/data/atomic_feature.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/adsorbate_poscar.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/adsorbate_poscar.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/bin.rst: -------------------------------------------------------------------------------- 1 | #### 2 | bin 3 | #### 4 | 5 | .. toctree:: 6 | :maxdepth: 6 7 | 8 | bin/agat_bayesian_opt 9 | bin/bayesian_skopt 10 | 11 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/model.rst: -------------------------------------------------------------------------------- 1 | model 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | model/layer 8 | model/model 9 | model/fit 10 | 11 | -------------------------------------------------------------------------------- /docs/_sources/Reference.md.txt: -------------------------------------------------------------------------------- 1 | # Reference 2 | 3 | [**Design high-entropy electrocatalyst via interpretable deep graph attention learning**](https://doi.org/10.1016/j.joule.2023.06.003) -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/volcano_plot.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/volcano_plot.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/lib/high_throughput_lib.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/lib/high_throughput_lib.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/Predict_structural_file.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/Predict_structural_file.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/Structural_optimization.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/Structural_optimization.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/Reference.md: -------------------------------------------------------------------------------- 1 | # Reference 2 | 3 | [**Design high-entropy electrocatalyst via interpretable deep graph attention learning**](https://doi.org/10.1016/j.joule.2023.06.003) -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/increase_vacuum.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/increase_vacuum.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch/optimize_torch.rst: -------------------------------------------------------------------------------- 1 | ############## 2 | optimize_torch 3 | ############## 4 | 5 | .. Hint:: Modified objects to fit the Torch tensor calculation. 6 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/bin/agat_bayesian_opt.rst: -------------------------------------------------------------------------------- 1 | agat_bayesian_opt 2 | ----------------- 3 | 4 | Optimize AGAT hyperparameters with ``bayes_opt.BayesianOptimization`` module. 5 | 6 | -------------------------------------------------------------------------------- /agat/__main__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from agat.main import main 9 | main('NiCoFePdPt') 10 | -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/Tutorial/High_throughput_prediction.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/Tutorial/High_throughput_prediction.doctree -------------------------------------------------------------------------------- /.spyproject/config/defaults/defaults-workspace-0.2.0.ini: -------------------------------------------------------------------------------- 1 | [workspace] 2 | restore_data_on_startup = True 3 | save_data_on_exit = True 4 | save_history = True 5 | save_non_project_files = False 6 | 7 | -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/find_adsorption_site.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/find_adsorption_site.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/data/PymatgenStructureAnalyzer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/data/PymatgenStructureAnalyzer.doctree -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/high_throughput_predict.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/high_throughput_predict.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch/ase_dyn.rst: -------------------------------------------------------------------------------- 1 | ########## 2 | ase_dyn 3 | ########## 4 | 5 | .. class:: MDMinTorch(Optimizer) 6 | 7 | Modified object to fit the Torch tensor calculation. 8 | 9 | -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/generate_adsorption_sites.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/generate_adsorption_sites.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/volcano_plot.rst: -------------------------------------------------------------------------------- 1 | ############################## 2 | volcano_plot 3 | ############################## 4 | 5 | 6 | .. function:: volcano_plot() 7 | 8 | Volcano plot. 9 | -------------------------------------------------------------------------------- /test/test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Oct 3 20:55:10 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | # test build graphs 9 | 10 | # test train 11 | 12 | # test application 13 | -------------------------------------------------------------------------------- /agat/app/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | # import important object. 9 | from .calculators import AgatCalculator 10 | -------------------------------------------------------------------------------- /docs/sphinx/build/doctrees/API_Docs/app/cata/high_throughput_dft_calculation.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jzhang-github/AGAT/HEAD/docs/sphinx/build/doctrees/API_Docs/app/cata/high_throughput_dft_calculation.doctree -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/volcano_2e.rst: -------------------------------------------------------------------------------- 1 | ############################## 2 | volcano_2e 3 | ############################## 4 | 5 | 6 | .. function:: volcano_2e() 7 | 8 | Volcano plot with 2e mechanism. 9 | -------------------------------------------------------------------------------- /agat/app/optimizers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Nov 19 19:14:31 2024 4 | 5 | @author: ZHANGJUN 6 | """ 7 | 8 | from .ase_torch.bfgs_torch import BFGSTorch 9 | from .ase_torch.ase_dyn import MDMinTorch 10 | -------------------------------------------------------------------------------- /docs/_sources/Contribution.md.txt: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | You can fock the [repo](https://github.com/jzhang-github/AGAT) or contact [Dr. ZHANG](https://www.researchgate.net/profile/Jun-Zhang-369) if you want to contribute to this project. -------------------------------------------------------------------------------- /docs/sphinx/source/Contribution.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | You can fock the [repo](https://github.com/jzhang-github/AGAT) or contact [Dr. ZHANG](https://www.researchgate.net/profile/Jun-Zhang-369) if you want to contribute to this project. -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 1. What is the unit of `ase.atoms.get_stress()`? 3 | 4 | `eV/Å^3`. 5 | 6 | Knuth et. al. Comput. Phys. Commun 190, 33-50, 2015 7 | https://github.com/atomistic-machine-learning/schnetpack/issues/165#issuecomment-559028863 8 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app.rst: -------------------------------------------------------------------------------- 1 | app 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | app/calculators 8 | app/cata 9 | app/ase_torch 10 | app/ensembles 11 | app/optimizers 12 | app/app_deprecated 13 | 14 | -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: dc668d30a5a958ca51a5ea009d2744b4 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch.rst: -------------------------------------------------------------------------------- 1 | ase_torch 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | ase_torch/ase_abc 8 | ase_torch/ase_dyn 9 | ase_torch/ase_filters 10 | ase_torch/bfgs_torch 11 | ase_torch/optimize_torch -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/lib.rst: -------------------------------------------------------------------------------- 1 | lib 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | lib/adsorbate_poscar 8 | lib/exceptions 9 | lib/file_lib 10 | lib/high_throughput_lib 11 | lib/incar_tag 12 | lib/model_lib 13 | 14 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/find_adsorption_site.rst: -------------------------------------------------------------------------------- 1 | find_adsorption_site 2 | -------------------- 3 | 4 | 5 | .. function:: find_adsorption_site() 6 | 7 | Find the adsorption site of a relaxed adsorbate. 8 | 9 | .. note:: Use ``ase`` module insted. 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/data.rst: -------------------------------------------------------------------------------- 1 | data 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | data/atomic_feature 8 | data/build_graph 9 | data/build_dataset 10 | data/dataset 11 | data/generate_database 12 | data/load_dataset 13 | data/PymatgenStructureAnalyzer 14 | -------------------------------------------------------------------------------- /.spyproject/config/workspace.ini: -------------------------------------------------------------------------------- 1 | [workspace] 2 | restore_data_on_startup = True 3 | save_data_on_exit = True 4 | save_history = True 5 | save_non_project_files = False 6 | project_type = 'empty-project-type' 7 | recent_files = ['test\\agat9.1.py'] 8 | 9 | [main] 10 | version = 0.2.0 11 | recent_files = [] 12 | 13 | -------------------------------------------------------------------------------- /.spyproject/config/backups/workspace.ini.bak: -------------------------------------------------------------------------------- 1 | [workspace] 2 | restore_data_on_startup = True 3 | save_data_on_exit = True 4 | save_history = True 5 | save_non_project_files = False 6 | project_type = 'empty-project-type' 7 | recent_files = ['test\\agat9.1.py'] 8 | 9 | [main] 10 | version = 0.2.0 11 | recent_files = [] 12 | 13 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata.rst: -------------------------------------------------------------------------------- 1 | cata 2 | ------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 6 6 | 7 | cata/find_adsorption_site 8 | cata/generate_adsorption_sites 9 | cata/high_throughput_dft_calculation 10 | cata/high_throughput_predict 11 | cata/increase_vacuum 12 | cata/volcano_2e 13 | cata/volcano_plot 14 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/increase_vacuum.rst: -------------------------------------------------------------------------------- 1 | ############################## 2 | increase_vacuum 3 | ############################## 4 | 5 | 6 | .. function:: increase_vacuum(fname) 7 | 8 | :param fname: Structural file name. 9 | :type fname: str 10 | :return: A new file with thicker vacuum. 11 | :rtype: A new file 12 | -------------------------------------------------------------------------------- /How_to_use_documentation_of_previous_versions.md: -------------------------------------------------------------------------------- 1 | # Previous versions of documentation 2 | 3 | 4 | 5 | ### Navigate to previously released repo: [Change_log.md](Change_log.md), or [branches](https://github.com/jzhang-github/AGAT/branches). 6 | 7 | ### Download all files in the directory: `docs`. 8 | 9 | ### Open `index.html` with browser. 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/lib/exceptions.rst: -------------------------------------------------------------------------------- 1 | exceptions 2 | ########### 3 | 4 | 5 | .. py:class:: FileExit 6 | 7 | A exception object. 8 | 9 | 10 | 11 | .. function:: file_exit() 12 | 13 | Stop high-throughput prediction if ``StopPython`` file is detected. 14 | 15 | :raises FileExit: Exit because `StopPython` file is found. 16 | 17 | 18 | -------------------------------------------------------------------------------- /agat/lib/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sat Aug 12 16:08:41 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | import os 8 | class FileExit(Exception): 9 | pass 10 | 11 | def file_exit(): 12 | if os.path.exists('StopPython'): 13 | os.remove('StopPython') 14 | raise FileExit('Exit because `StopPython` file is found.') 15 | 16 | -------------------------------------------------------------------------------- /agat/model/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from .layer import Layer 9 | from .model import PotentialModel, CrystalPropertyModel, AtomicPropertyModel, AtomicVectorModel 10 | from .fit import Fit 11 | from agat.lib.model_lib import save_model, load_model, save_state_dict, load_state_dict 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore file 2 | 3 | __pycache__ 4 | cata_old 5 | dataset 6 | out_file 7 | tools 8 | *.txt 9 | *.gat 10 | POSCAR* 11 | CONTCAR* 12 | *.json 13 | ads_surf_energy_H_0.txt 14 | *.log 15 | *.out 16 | README.txt 17 | *.traj 18 | data/dataset 19 | agat.egg-info 20 | debug 21 | *.bin 22 | agat_model 23 | generator_config.json 24 | agat_model 25 | build 26 | potential_models 27 | -------------------------------------------------------------------------------- /docs/sphinx/source/Chinese_support/中文支持.md: -------------------------------------------------------------------------------- 1 | # 中文手册持续更新中,您可在GitHub提问或点此添加开发者微信讨论交流: 2 | 3 | 4 | - 提问链接:[https://github.com/jzhang-github/AGAT/issues](https://github.com/jzhang-github/AGAT/issues) 5 | - 微信号:**jzhang988** 6 | - 二维码: ![二维码](WeChat_QR_code.jpg) 7 | 8 | 9 | - pip安装下载速度慢问题:[https://www.runoob.com/w3cnote/pip-cn-mirror.html](https://www.runoob.com/w3cnote/pip-cn-mirror.html) 10 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ase_torch/ase_abc.rst: -------------------------------------------------------------------------------- 1 | ########## 2 | ase_abc 3 | ########## 4 | 5 | .. class:: Optimizable(collections.abc.Sized) 6 | 7 | Modified object to fit the Torch tensor calculation. 8 | 9 | .. method:: converged(self, forces, fmax) 10 | 11 | .. Note:: Replace ``return np.linalg.norm(forces, axis=1).max() < fmax`` with ``return torch.linalg.norm(forces, dim=1).max() < fmax`` 12 | -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '2022.10.04', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /agat/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from .adsorbate_poscar import adsorbate_poscar 9 | from .exceptions import FileExit 10 | from .file_lib import generate_file_name, file_exit, modify_INCAR 11 | from .model_lib import save_model, load_model, save_state_dict, load_state_dict 12 | from .model_lib import config_parser, EarlyStopping, load_graph_build_method, PearsonR 13 | 14 | -------------------------------------------------------------------------------- /test/export_cell_stress.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Dec 26 21:01:10 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import os 9 | import matplotlib.pyplot as plt 10 | from dgl.data.utils import load_graphs 11 | 12 | os.environ['KMP_DUPLICATE_LIB_OK']='TRUE' 13 | graph_list, props = load_graphs('all_graphs_generation_0.bin') 14 | 15 | stresses = props['stress_true'].numpy() 16 | 17 | 18 | plt.hist(stresses[:,0], bins=100, range=[-0.01, 0.01]) 19 | -------------------------------------------------------------------------------- /agat/app/cata/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | # import important object. 9 | from .find_adsorption_site import find_adsorption_site 10 | from .generate_adsorption_sites import AddAtoms 11 | from .high_throughput_predict import HtAds 12 | from .increase_vacuum import increase_vacuum 13 | from .volcano_2e import volcano_2e 14 | from .volcano_plot import volcano_plot 15 | 16 | from .high_throughput_dft_calculation import HtDftAds 17 | 18 | -------------------------------------------------------------------------------- /agat/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | __version__ = '9.1.1' 9 | 10 | import os 11 | # os.environ['DGLBACKEND']="pytorch" 12 | 13 | # import important object. 14 | from .data.build_dataset import BuildDatabase 15 | from .data.build_dataset import CrystalGraph 16 | from .data.dataset import Dataset 17 | from .model.fit import Fit 18 | from .app.cata.high_throughput_predict import HtAds 19 | from .model.model import PotentialModel 20 | 21 | del os 22 | -------------------------------------------------------------------------------- /agat/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | def main(formula): 9 | from agat.data.build_dataset import BuildDatabase 10 | from agat.model.fit import Fit 11 | from agat.app.cata import high_throughput_predict 12 | from agat.app.cata.high_throughput_predict import HtAds 13 | 14 | ad = BuildDatabase(mode_of_NN='ase_dist', num_of_cores=16) 15 | ad.build() 16 | 17 | f = Fit() 18 | f.fit() 19 | 20 | HA = HtAds() 21 | HA.run(formula, device='cuda') 22 | -------------------------------------------------------------------------------- /agat/data/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 15 11:41:20 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from .build_graph import CrystalGraph, AseGraphTorch 9 | from .build_dataset import ReadGraphs, ExtractVaspFiles, BuildDatabase 10 | from .dataset import concat_graphs, concat_dataset, select_graphs_random 11 | from .dataset import select_graphs_from_dataset_random, save_dataset 12 | from .atomic_feature import get_atomic_feature_onehot 13 | from .load_dataset import LoadDataset, Collater 14 | from .dataset import Dataset 15 | from .dataset import Collater as Collater_new 16 | 17 | from ..lib.model_lib import load_graph_build_method 18 | -------------------------------------------------------------------------------- /docs/_sources/API_Docs.rst.txt: -------------------------------------------------------------------------------- 1 | API_Docs 2 | ============ 3 | 4 | default_parameters 5 | ------------------ 6 | .. toctree:: 7 | :maxdepth: 6 8 | 9 | Default parameters 10 | 11 | lib 12 | ------------- 13 | .. toctree:: 14 | :maxdepth: 6 15 | 16 | API_Docs/lib 17 | 18 | 19 | data 20 | ------------- 21 | .. toctree:: 22 | :maxdepth: 6 23 | 24 | API_Docs/data 25 | 26 | 27 | model 28 | ------------- 29 | .. toctree:: 30 | :maxdepth: 6 31 | 32 | API_Docs/model 33 | 34 | app 35 | ------------- 36 | .. toctree:: 37 | :maxdepth: 6 38 | 39 | API_Docs/app 40 | 41 | 42 | bin 43 | ------------- 44 | .. toctree:: 45 | :maxdepth: 6 46 | 47 | API_Docs/bin 48 | 49 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs.rst: -------------------------------------------------------------------------------- 1 | API_Docs 2 | ============ 3 | 4 | default_parameters 5 | ------------------ 6 | .. toctree:: 7 | :maxdepth: 6 8 | 9 | Default parameters 10 | 11 | lib 12 | ------------- 13 | .. toctree:: 14 | :maxdepth: 6 15 | 16 | API_Docs/lib 17 | 18 | 19 | data 20 | ------------- 21 | .. toctree:: 22 | :maxdepth: 6 23 | 24 | API_Docs/data 25 | 26 | 27 | model 28 | ------------- 29 | .. toctree:: 30 | :maxdepth: 6 31 | 32 | API_Docs/model 33 | 34 | app 35 | ------------- 36 | .. toctree:: 37 | :maxdepth: 6 38 | 39 | API_Docs/app 40 | 41 | 42 | bin 43 | ------------- 44 | .. toctree:: 45 | :maxdepth: 6 46 | 47 | API_Docs/bin 48 | 49 | -------------------------------------------------------------------------------- /docs/sphinx/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/data/PymatgenStructureAnalyzer.rst: -------------------------------------------------------------------------------- 1 | PymatgenStructureAnalyzer 2 | ########################## 3 | 4 | .. Note:: Distributed under the terms of the MIT License. 5 | 6 | __author__ = "Shyue Ping Ong, Geoffroy Hautier, Sai Jayaraman" 7 | __copyright__ = "Copyright 2011, The Materials Project" 8 | 9 | 10 | .. Important:: This file is originated from `pymatgen`. 11 | 12 | Original author: "Shyue Ping Ong, Geoffroy Hautier, Sai Jayaraman" 13 | 14 | ZHANG Jun modified this script on 2021/05/14 (yyyy/mm/dd). 15 | 16 | Detail: get_connections() are replaced by get_connections_new(). The new one has a faster speed and more suitable for constructing a DGL graph. 17 | 18 | .. Warning:: The `pymatgen` module is discouraged by AGAT. 19 | -------------------------------------------------------------------------------- /agat/app/cata/increase_vacuum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Created on Mon Apr 4 18:12:17 2022 5 | 6 | @author: ZHANG Jun 7 | """ 8 | 9 | from ase.io import read, write 10 | import sys 11 | 12 | def increase_vacuum(fname): 13 | """ 14 | 15 | :param fname: Structural file name. 16 | :type fname: str 17 | :return: A new file with thicker vacuum. 18 | :rtype: A new file 19 | 20 | """ 21 | 22 | # fname = sys.argv[1] 23 | 24 | poscar = read(fname) 25 | # frac = poscar.get_scaled_positions() 26 | cart = poscar.get_positions() 27 | cell = poscar.cell.array 28 | cell[2][2] += 5 29 | 30 | poscar.set_cell(cell) 31 | poscar.set_positions(cart) 32 | 33 | write(f'{fname}_more_vacuum', poscar) 34 | -------------------------------------------------------------------------------- /docs/_sources/Introduction.rst.txt: -------------------------------------------------------------------------------- 1 | ############ 2 | Introduction 3 | ############ 4 | 5 | 6 | 7 | 8 | 9 | ============================= 10 | Atomic Graph ATtention (AGAT) 11 | ============================= 12 | 13 | AGAT model is an high-efficient deep-graph model for prediction energy, forces, and stress of crystals. 14 | 15 | .. image:: ./architecture.svg 16 | :align: center 17 | :alt: AGAT architecture 18 | 19 | 20 | ================== 21 | API documentation 22 | ================== 23 | 24 | - :doc:`API doc `. 25 | 26 | 27 | 28 | =========== 29 | Source code 30 | =========== 31 | 32 | - Navigate to the `GitHub repo `_. 33 | - For previous versions: Go to `GitHub branches `_. 34 | 35 | -------------------------------------------------------------------------------- /docs/sphinx/source/Introduction.rst: -------------------------------------------------------------------------------- 1 | ############ 2 | Introduction 3 | ############ 4 | 5 | 6 | 7 | 8 | 9 | ============================= 10 | Atomic Graph ATtention (AGAT) 11 | ============================= 12 | 13 | AGAT model is an high-efficient deep-graph model for prediction energy, forces, and stress of crystals. 14 | 15 | .. image:: ./architecture.svg 16 | :align: center 17 | :alt: AGAT architecture 18 | 19 | 20 | ================== 21 | API documentation 22 | ================== 23 | 24 | - :doc:`API doc `. 25 | 26 | 27 | 28 | =========== 29 | Source code 30 | =========== 31 | 32 | - Navigate to the `GitHub repo `_. 33 | - For previous versions: Go to `GitHub branches `_. 34 | 35 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/Structural_optimization.md: -------------------------------------------------------------------------------- 1 | # Application (structural optimization) 2 | 3 | ```python 4 | from ase.optimize import BFGS 5 | from ase.io import read 6 | from ase import Atoms 7 | from agat.app import AgatCalculator 8 | 9 | model_save_dir = 'agat_model' 10 | graph_build_scheme_dir = 'dataset' 11 | 12 | atoms = read('POSCAR') 13 | calculator=AgatCalculator(model_save_dir, 14 | graph_build_scheme_dir) 15 | atoms = Atoms(atoms, calculator=calculator) 16 | dyn = BFGS(atoms, trajectory='test.traj') 17 | dyn.run(fmax=0.05, steps=200) 18 | 19 | ``` 20 | 21 | Navigate to [ase.optimize.BFGS](https://wiki.fysik.dtu.dk/ase/ase/optimize.html#ase.optimize.BFGS) for more details. 22 | 23 | 24 | **Note**: You need to prepare the well-trained model, copy `graph_build_scheme.json` file, and structure file, i.e. `POSCAR`. -------------------------------------------------------------------------------- /agat/lib/incar_tag.py: -------------------------------------------------------------------------------- 1 | INCAR_TAG = ''' 2 | SYSTEM 3 | ISTART 4 | ICHARG 5 | INIWAV 6 | ENCUT 7 | ENAUG 8 | PREC 9 | IALGO 10 | NELM 11 | NELMIN 12 | NELMDL 13 | EDIFF 14 | NBANDS 15 | GGA 16 | VOSKOWN 17 | LREAL 18 | WEIMIN 19 | EDIFFG 20 | NSW 21 | IBRION 22 | ISIF 23 | POTIM 24 | IOPT 25 | ISYM 26 | SIGMA 27 | ISMEAR 28 | ISPIN 29 | MAGMOM 30 | LWAVE 31 | LCHARG 32 | RWIGS 33 | NPAR 34 | LORBIT 35 | LDAU 36 | LDAUTYPE 37 | LDAUL 38 | LDAUU 39 | LDAUJ 40 | LDAUPRINT 41 | LMAXMIX 42 | LASPH 43 | IDIPOL 44 | LDIPOL 45 | LAECHG 46 | LADDGRID 47 | NGX 48 | NGY 49 | NGZ 50 | NGXF 51 | NGYF 52 | NGZF 53 | ICHAIN 54 | IMAGES 55 | SPRING 56 | LCLIMB 57 | DdR 58 | DRotMax 59 | DFNMin 60 | DFNMax 61 | NFREE 62 | LUSE_VDW 63 | Zab_vdW 64 | AGGAC 65 | AMIX 66 | AMIX_MAG 67 | BMIX 68 | BMIX_MAG 69 | ALGO 70 | KPAR 71 | NCORE 72 | NEDOS 73 | IVDW 74 | LELF 75 | MDALGO 76 | '''.split() 77 | 78 | -------------------------------------------------------------------------------- /docs/_static/js/badge_only.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}}); -------------------------------------------------------------------------------- /docs/sphinx/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /How_to_use_sphinx.md: -------------------------------------------------------------------------------- 1 | # Manual for the sphinx documentation pages 2 | 3 | 1. Change directory to [docs/sphinx](docs/sphinx). 4 | 5 | 2. Modify/add files in [docs/sphinx/source](docs/sphinx/source) 6 | 7 | 3. generate html files. 8 | 9 | For the first run: 10 | 11 | - ```shell 12 | sphinx-quickstart.exe 13 | ``` 14 | 15 | - ```shell 16 | sphinx-build.exe source build 17 | ``` 18 | 19 | Next time, run: 20 | 21 | ```shell 22 | .\make.bat clean 23 | .\make.bat html 24 | ``` 25 | 26 | 4. Copy all files under [docs/sphinx/build/html](docs/sphinx/build/html) to [docs](docs). 27 | 28 | 29 | 30 | ## Note: 31 | 32 | 1. Replace all files under [docs](docs). 33 | 2. Keep `.nojekyll` if you need to clean the `docs` folder. 34 | 35 | 36 | 37 | ## Sphinx style basics 38 | 39 | https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html 40 | 41 | Go to OneNote for more details. 42 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/Build_graph.md: -------------------------------------------------------------------------------- 1 | # Build graph 2 | 3 | 4 | 5 | ### Python script 6 | You may want to build a topology graph without atomic `energy`, `forces`, `stress`, and `cell`. You can achieve this by setting `topology_only=True` when instantiating the [CrystalGraph](https://jzhang-github.github.io/AGAT/API_Docs/data/build_dataset.html#CrystalGraph) object: 7 | 8 | ```python 9 | import os 10 | from agat.data import CrystalGraph 11 | from agat.data import load_graph_build_scheme 12 | 13 | graph_build_method = load_graph_build_method(os.path.join('dataset', 'graph_build_scheme.json')) 14 | cg = CrystalGraph(**{**graph_build_method, **{'topology_only': True}}) 15 | graph, prop = cg.get_graph('POSCAR') 16 | print(graph.ndata) 17 | print('==========') 18 | print(graph.edata) 19 | ``` 20 | 21 | You can further save the graph as a binary file to the disk: 22 | ```python 23 | from dgl import save_graphs 24 | save_graphs("graph.bin", [graph], prop) 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/Predict_structural_file.md: -------------------------------------------------------------------------------- 1 | # Predict_structural_file 2 | 3 | 4 | 5 | ### Python script 6 | To predict a structure file, you can use: 7 | 8 | ```python 9 | import os 10 | import torch 11 | from agat.data import CrystalGraph 12 | from agat.data import load_graph_build_scheme 13 | from agat.lib import load_model 14 | 15 | # load graph from structure file 16 | graph_build_method = load_graph_build_scheme(os.path.join('agat_model', 'graph_build_scheme.json')) 17 | cg = CrystalGraph(**{**graph_build_method, **{'topology_only': True}}) 18 | graph, prop = cg.get_graph('POSCAR') 19 | graph = graph.to('cuda') 20 | 21 | # load the model 22 | model = load_model('agat_model', device='cuda') 23 | with torch.no_grad(): 24 | energy_per_atom, force, stress = model(graph) 25 | ``` 26 | 27 | Before using this script, you need to prepare: 28 | 29 | - a `POSCAR` file; 30 | - a `graph_build_scheme.json` file, which is normally saved when you build your database; 31 | - a well-trained model: `agat.pth`. -------------------------------------------------------------------------------- /agat/app/ase_torch/ase_abc.py: -------------------------------------------------------------------------------- 1 | import collections 2 | from abc import abstractmethod 3 | 4 | # import numpy as np 5 | import torch 6 | 7 | # Due to the high prevalence of cyclic imports surrounding ase.optimize, 8 | # we define the Optimizable ABC here in utils. 9 | # Can we find a better way? 10 | 11 | 12 | class Optimizable(collections.abc.Sized): 13 | @abstractmethod 14 | def get_positions(self): 15 | ... 16 | 17 | @abstractmethod 18 | def set_positions(self, positions): 19 | ... 20 | 21 | @abstractmethod 22 | def get_forces(self): 23 | ... 24 | 25 | @abstractmethod 26 | def get_potential_energy(self): 27 | ... 28 | 29 | @abstractmethod 30 | def iterimages(self): 31 | ... 32 | 33 | def converged(self, forces, fmax): 34 | # return np.linalg.norm(forces, axis=1).max() < fmax 35 | return torch.linalg.norm(torch.tensor(forces), dim=1).max() < fmax 36 | 37 | def is_neb(self): 38 | return False 39 | 40 | def __ase_optimizable__(self): 41 | return self 42 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: "ZHANG" 5 | given-names: "Jun" 6 | orcid: "https://orcid.org/0000-0001-8872-6153" 7 | - family-names: "ZHAO" 8 | given-names: "Shijun" 9 | orcid: "https://orcid.org/0000-0003-0870-8153" 10 | title: "Design high-entropy electrocatalyst via interpretable deep graph attention learning" 11 | version: 1.0.0 12 | doi: 10.5281/zenodo.7979079 13 | date-released: 2023-05-28 14 | url: "https://github.com/jzhang-github/AGAT" 15 | preferred-citation: 16 | type: article 17 | authors: 18 | - family-names: "ZHANG" 19 | given-names: "Jun" 20 | orcid: "https://orcid.org/0000-0001-8872-6153" 21 | - family-names: "ZHAO" 22 | given-names: "Shijun" 23 | orcid: "https://orcid.org/0000-0003-0870-8153" 24 | doi: "10.1016/j.joule.2023.06.003" 25 | journal: "Joule" 26 | month: 8 27 | start: 1832 # First page number 28 | end: 1851 # Last page number 29 | title: "Design high-entropy electrocatalyst via interpretable deep graph attention learning" 30 | issue: 8 31 | volume: 7 32 | year: 2023 -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/lib/file_lib.rst: -------------------------------------------------------------------------------- 1 | file_lib 2 | ######### 3 | 4 | 5 | 6 | 7 | .. function:: generate_file_name(fname) 8 | 9 | Generate a new file name according to the input. 10 | 11 | :param str fname: file name. 12 | :Returns: fname. A new file name by appending ``_new`` 13 | :rtype: str 14 | 15 | 16 | .. function:: file_exit() 17 | :no-index: 18 | 19 | Stop high-throughput prediction if ``StopPython`` file is detected. 20 | 21 | :raises FileExit: Exit because ``StopPython`` file is found. 22 | 23 | 24 | 25 | .. function:: modify_INCAR(key='NSW', value='300', s='') 26 | 27 | Modify the INCAR file. 28 | 29 | Example:: 30 | 31 | from agat.lib import modify_INCAR 32 | modify_INCAR('NSW', '200') 33 | 34 | 35 | :param key: The INCAR tag, defaults to 'NSW'. The INCAR tag must be found in :py:data:`agat.lib.incar_tag.INCAR_TAG`. 36 | :type key: str, optional 37 | :param value: Value of the INCAR tag, defaults to '300' 38 | :type value: str, optional 39 | :param s: Comment string, defaults to '' 40 | :type s: str, optional 41 | :return: Modified INCAR file 42 | -------------------------------------------------------------------------------- /.github/workflows/pypi-package.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | # GitHub recommends pinning actions to a commit SHA. 7 | # To get a newer version, you will need to update the SHA. 8 | # You can also reference a tag or branch, but the action may change without warning. 9 | 10 | name: Upload Python Package 11 | 12 | on: 13 | release: 14 | types: [published] 15 | 16 | jobs: 17 | deploy: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: '3.x' 25 | - name: Install dependencies 26 | run: | 27 | python -m pip install --upgrade pip 28 | pip install build 29 | - name: Build package 30 | run: python -m build 31 | - name: Publish package 32 | uses: pypa/gh-action-pypi-publish@release/v1 33 | with: 34 | password: ${{ secrets.AGAT_PYPI_TOKEN }} 35 | -------------------------------------------------------------------------------- /test/dataloader_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sun Oct 1 19:49:49 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import time 9 | 10 | from agat.data.loda_dataset import LoadDataset, Collater 11 | from torch.utils.data import DataLoader 12 | 13 | if __name__ == '__main__': 14 | dataset = LoadDataset('all_graphs.bin') 15 | g, p = dataset[10] 16 | 17 | collate_fn = Collater(device='cpu') 18 | 19 | start = time.time() 20 | loader = DataLoader(dataset, batch_size=64, shuffle=True, num_workers=4, 21 | collate_fn=collate_fn) 22 | 23 | for i, sample in enumerate(loader): 24 | graph, props = sample 25 | print(time.time()-start) 26 | 27 | # test of num_workers larger than 0. 28 | start = time.time() 29 | for i, sample in enumerate(loader): 30 | graph, props = sample 31 | if i > 500: 32 | break 33 | dur1 = time.time()-start 34 | 35 | start = time.time() 36 | for i, sample in enumerate(loader): 37 | graph, props = sample 38 | time.sleep(0.01) 39 | if i > 500: 40 | break 41 | dur2 = time.time()-start 42 | print(dur2-5.0-dur1) 43 | -------------------------------------------------------------------------------- /agat/app/cata/find_adsorption_site.py: -------------------------------------------------------------------------------- 1 | # This script is used to find atoms connected with specified atomic index. 2 | # from pymatgen.core.structure import Structure # pymatgen module deprecated for now. 3 | import numpy as np 4 | import sys 5 | from collections import Counter 6 | 7 | def find_adsorption_site(): 8 | """ 9 | 10 | :return: DESCRIPTION 11 | :rtype: TYPE 12 | 13 | """ 14 | from pymatgen.core.structure import Structure 15 | 16 | assert len(sys.argv) > 3, 'Usage: command + file name + atomic index (start from zero) + distance cutoff' 17 | fname = sys.argv[1] 18 | atom_num = sys.argv[2] 19 | dist_cutoff = sys.argv[3] 20 | 21 | crystal = Structure.from_file(fname) 22 | element_list = [crystal.sites[x].specie.name for x in range(crystal.num_sites)] 23 | dist_mat = crystal.distance_matrix[int(atom_num)] 24 | OneNN_index = np.where(dist_mat < float(dist_cutoff)) 25 | 26 | # sort_index = sorted(range(len(dist_mat)), key=lambda k: dist_mat[k]) 27 | ele = np.array(element_list)[OneNN_index] 28 | for i in ['O', 'H']: 29 | location = np.where(ele == i) 30 | ele = np.delete(ele, location) 31 | for i in ele: 32 | print(i, end=' ') 33 | print() 34 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/data/generate_database.rst: -------------------------------------------------------------------------------- 1 | ################# 2 | generate_database 3 | ################# 4 | 5 | Generate database for AGAT, including strain, perturbation, vacancy, static, NPT, and NVT simulations. The function names are quite intuitive, so allow me finish this page later. 6 | 7 | .. py:class:: DataGenerator(object) 8 | 9 | 10 | .. py:method:: __init__(self, bulk_fname) 11 | 12 | .. py:method:: set_structure(self, fname) 13 | 14 | .. py:method:: get_INCAR(self, dst='.') 15 | 16 | .. py:method:: get_KPOINTS(self, dst='.') 17 | 18 | .. py:method:: get_POTCAR(self, line=1, working_dir='.') 19 | 20 | .. py:method:: apply_strain(self, ase_atoms, strain: float) 21 | 22 | .. py:method:: apply_perturbation(self, ase_atoms, amplitude: float = 0.2) 23 | 24 | .. py:method:: create_vacancy(self, ase_atoms, index='random') 25 | 26 | 27 | .. py:method:: create_species_vacancy(self, ase_atoms, species='Li', num=1) 28 | 29 | 30 | .. py:method:: relocate_atoms(self, ase_atoms, displacement=[0.0, 0.0, 0.1], species='Li') 31 | 32 | 33 | .. py:method:: static(self, dst='.', strain=[-0.02, -0.01, 0.0, 0.01, 0.02], perturbation_num=10) 34 | 35 | 36 | 37 | .. py:method:: aimd(self, dst='.', strain=[-0.02, -0.01, 0.0, 0.01, 0.02], start_T=[100, 300, 500], end_T=[400, 600, 800]) 38 | -------------------------------------------------------------------------------- /docs/sphinx/source/index.rst: -------------------------------------------------------------------------------- 1 | .. AGAT documentation master file, created by 2 | sphinx-quickstart on Tue Oct 4 19:12:54 2022. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to AGAT's documentation! 7 | ================================ 8 | 9 | 10 | `Github Homepage `_ 11 | 12 | 13 | .. note:: 14 | 15 | Navigate to `v1.0.0 `_ for the documentation and source codes to reproduce results and support conclusions of `Design High-Entropy Electrocatalyst via Interpretable Deep Graph Attention Learning `_. 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | :caption: AGAT: 20 | 21 | Introduction 22 | Installation 23 | Quick start 24 | 25 | 26 | .. toctree:: 27 | :maxdepth: 2 28 | :caption: AGAT Tutorial: 29 | 30 | Tutorial 31 | 32 | 33 | .. toctree:: 34 | :maxdepth: 6 35 | :caption: 中文手册: 36 | 37 | Chinese_support 38 | 39 | .. toctree:: 40 | :maxdepth: 2 41 | :caption: AGAT API: 42 | 43 | API_Docs 44 | 45 | 46 | .. toctree:: 47 | :maxdepth: 2 48 | :caption: OTHER: 49 | 50 | Contribution 51 | Reference 52 | FAQ 53 | Change_log 54 | 55 | 56 | 57 | Indices and tables 58 | ================== 59 | 60 | * :ref:`genindex` 61 | * :ref:`modindex` 62 | * :ref:`search` 63 | -------------------------------------------------------------------------------- /.github/workflows/python-package.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: Python package 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | python-version: ["3.9", "3.10", "3.11"] 20 | 21 | steps: 22 | - uses: actions/checkout@v3 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v3 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - name: Install dependencies 28 | run: | 29 | python -m pip install --upgrade pip 30 | python -m pip install flake8 pytest 31 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 32 | - name: Lint with flake8 33 | run: | 34 | # stop the build if there are Python syntax errors or undefined names 35 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 36 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 37 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 38 | # - name: Test with pytest 39 | # run: | 40 | # pytest 41 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. AGAT documentation master file, created by 2 | sphinx-quickstart on Tue Oct 4 19:12:54 2022. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to AGAT's documentation! 7 | ================================ 8 | 9 | 10 | `Github Homepage `_ 11 | 12 | 13 | .. note:: 14 | 15 | Navigate to `v1.0.0 `_ for the documentation and source codes to reproduce results and support conclusions of `Design High-Entropy Electrocatalyst via Interpretable Deep Graph Attention Learning `_. 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | :caption: AGAT: 20 | 21 | Introduction 22 | Installation 23 | Quick start 24 | 25 | 26 | .. toctree:: 27 | :maxdepth: 2 28 | :caption: AGAT Tutorial: 29 | 30 | Tutorial 31 | 32 | 33 | .. toctree:: 34 | :maxdepth: 6 35 | :caption: 中文手册: 36 | 37 | Chinese_support 38 | 39 | .. toctree:: 40 | :maxdepth: 2 41 | :caption: AGAT API: 42 | 43 | API_Docs 44 | 45 | 46 | .. toctree:: 47 | :maxdepth: 2 48 | :caption: OTHER: 49 | 50 | Contribution 51 | Reference 52 | FAQ 53 | Change_log 54 | 55 | 56 | 57 | Indices and tables 58 | ================== 59 | 60 | * :ref:`genindex` 61 | * :ref:`modindex` 62 | * :ref:`search` 63 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/model/fit.rst: -------------------------------------------------------------------------------- 1 | ############## 2 | fit 3 | ############## 4 | 5 | 6 | .. py:class:: Fit(object) 7 | 8 | 9 | .. note:: 10 | 11 | See https://jzhang-github.github.io/AGAT/Tutorial/Train_AGAT_model.html to know how to train an AGAT model. 12 | 13 | The first value of ``gat_node_dim_list`` is the depth of atomic representation, which will be modified if you specify a wrong value. 14 | 15 | The first value of ``energy_readout_node_list``, ``force_readout_node_list``, ``stress_readout_node_list`` is the input dimension and equals to last value of ``gat_node_list * num_heads``. The correct values will also be assigned. 16 | 17 | The last values of ``energy_readout_node_list``, ``force_readout_node_list``, ``stress_readout_node_list`` are ``1``, ``3``, and ``6``, respectively. The correct values will also be assigned. 18 | 19 | Example:: 20 | 21 | from agat.model import Fit 22 | f = Fit() 23 | f.fit() 24 | 25 | 26 | 27 | .. py:method:: __init__(self, **train_config) 28 | 29 | Initialize parameters and model. 30 | 31 | :param dict train_config: Configuration file for building database. See https://jzhang-github.github.io/AGAT/Default%20parameters.html#default-train-configfor more details. 32 | 33 | 34 | .. py:method:: fit(self, **train_config) 35 | 36 | Fit the :class:`PotentialModel`. You can modify some settings here by input keyword arguements or dictionary. 37 | 38 | .. note:: Some settings are already used in the :meth:`Fit.__init__` method, so input arguements here will not change them. -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/lib/incar_tag.rst: -------------------------------------------------------------------------------- 1 | incar_tag 2 | ######### 3 | 4 | 5 | .. py:data:: incar_tag 6 | 7 | A list of INCAR tags. 8 | 9 | .. code-block:: python 10 | 11 | ['SYSTEM', 12 | 'ISTART', 13 | 'ICHARG', 14 | 'INIWAV', 15 | 'ENCUT', 16 | 'ENAUG', 17 | 'PREC', 18 | 'IALGO', 19 | 'NELM', 20 | 'NELMIN', 21 | 'NELMDL', 22 | 'EDIFF', 23 | 'NBANDS', 24 | 'GGA', 25 | 'VOSKOWN', 26 | 'LREAL', 27 | 'WEIMIN', 28 | 'EDIFFG', 29 | 'NSW', 30 | 'IBRION', 31 | 'ISIF', 32 | 'POTIM', 33 | 'IOPT', 34 | 'ISYM', 35 | 'SIGMA', 36 | 'ISMEAR', 37 | 'ISPIN', 38 | 'MAGMOM', 39 | 'LWAVE', 40 | 'LCHARG', 41 | 'RWIGS', 42 | 'NPAR', 43 | 'LORBIT', 44 | 'LDAU', 45 | 'LDAUTYPE', 46 | 'LDAUL', 47 | 'LDAUU', 48 | 'LDAUJ', 49 | 'LDAUPRINT', 50 | 'LMAXMIX', 51 | 'LASPH', 52 | 'IDIPOL', 53 | 'LDIPOL', 54 | 'LAECHG', 55 | 'LADDGRID', 56 | 'NGX', 57 | 'NGY', 58 | 'NGZ', 59 | 'NGXF', 60 | 'NGYF', 61 | 'NGZF', 62 | 'ICHAIN', 63 | 'IMAGES', 64 | 'SPRING', 65 | 'LCLIMB', 66 | 'DdR', 67 | 'DRotMax', 68 | 'DFNMin', 69 | 'DFNMax', 70 | 'NFREE', 71 | 'LUSE_VDW', 72 | 'Zab_vdW', 73 | 'AGGAC', 74 | 'AMIX', 75 | 'AMIX_MAG', 76 | 'BMIX', 77 | 'BMIX_MAG', 78 | 'ALGO', 79 | 'KPAR', 80 | 'NCORE', 81 | 'NEDOS', 82 | 'IVDW', 83 | 'LELF', 84 | 'MDALGO'] -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Jul 11 13:22:58 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from distutils.core import setup 9 | from setuptools import find_packages 10 | 11 | with open("README.md", "r") as f: 12 | long_description = f.read() 13 | 14 | # print(long_description) 15 | # with open('requirements.txt', "r") as f: 16 | # requirements = f.readlines() 17 | # requirements = [x.strip() for x in requirements] 18 | 19 | # long_description = (this_directory / "README.md").read_text() 20 | 21 | setup(name='agat', 22 | version='9.1.1', 23 | python_requires='>=3.10', 24 | description='Atomic Graph ATtention networks for predicting atomic energies and forces.', 25 | long_description=long_description, 26 | include_package_data=True, 27 | long_description_content_type='text/markdown', 28 | author='ZHANG Jun; ZHAO Shijun', 29 | author_email='j.zhang@my.cityu.edu.hk', 30 | url='https://github.com/jzhang-github/AGAT', 31 | install_requires=['numpy', 32 | 'ase', 33 | 'tqdm'], 34 | license='GPL', 35 | packages=find_packages(exclude=['cata_old', 'tools']), 36 | platforms=["all"], 37 | classifiers=[ 38 | # How mature is this project? Common values are 39 | # 3 - Alpha 40 | # 4 - Beta 41 | # 5 - Production/Stable 42 | 'Development Status :: 3 - Alpha', 43 | 'License :: OSI Approved :: GNU General Public License (GPL)', 44 | 'Intended Audience :: Developers', 45 | 'Operating System :: OS Independent', 46 | 'Natural Language :: English', 47 | 'Programming Language :: Python', 48 | 'Programming Language :: Python :: 3.10', 49 | 'Topic :: Software Development :: Libraries' 50 | ], 51 | ) 52 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/model/layer.rst: -------------------------------------------------------------------------------- 1 | ############## 2 | layer 3 | ############## 4 | 5 | Single graph attention network for predicting crystal properties. 6 | 7 | .. Note:: Some abbreviations used in :class:`Layer` class: 8 | 9 | =============== ================= 10 | Abbreviations Full name 11 | =============== ================= 12 | dist distance matrix 13 | feat features 14 | ft features 15 | src source node 16 | dst destination node 17 | e e_i_j: refer to: https://arxiv.org/abs/1710.10903 18 | a alpha_i_j: refer to: https://arxiv.org/abs/1710.10903 19 | att attention mechanism 20 | act activation function 21 | =============== ================= 22 | 23 | 24 | .. class:: Layer() 25 | 26 | .. method:: __init__(self, in_dim, out_dim, num_heads, device='cuda', bias=True, negative_slope=0.2) 27 | 28 | :param int in_dim: Depth of node representation in the input of this AGAT `Layer`. 29 | :param int out_dim: Depth of node representation in the output of this `GAT` layer. 30 | :param int num_heads: Number of attention heads. 31 | :param str device: Device to perform tensor calculations and store parameters. 32 | :param bool bias: Whether the dense layer uses a bias vector. 33 | :param float negative_slope: Negative slope coefficient of the LeakyReLU activation function. 34 | 35 | 36 | 37 | .. method:: forward(self, feat, dist, graph) 38 | 39 | Forward this AGAT `Layer`. 40 | 41 | :param torch.tensor feat: Input features of all nodes (atoms). 42 | :param torch.tensor dist: Distances between connected atoms. 43 | :param DGL.graph graph: A graph built with DGL. 44 | 45 | :Returns: dst: output features of all nodes. 46 | :rtype dst: torch.tensor 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/High_throughput_prediction.md: -------------------------------------------------------------------------------- 1 | # Application (high-throughput prediction) 2 | 3 | Modify the passed input dict to control the prediction. 4 | 5 | ### Python script 6 | ```python 7 | import os 8 | from agat.app import HtAds 9 | 10 | ase_calculator_config = {'fmax' : 0.1, 11 | 'steps' : 200, 12 | 'maxstep' : 0.05, 13 | 'restart' : None, 14 | 'restart_steps' : 0, 15 | 'perturb_steps' : 0, 16 | 'perturb_amplitude': 0.05} 17 | 18 | high_throughput_config = { 19 | 'model_save_dir': 'agat_model', 20 | 'opt_config': ase_calculator_config, 21 | 'calculation_index' : '0', # sys.argv[1], 22 | 'fix_all_surface_atom' : False, 23 | 'remove_bottom_atoms' : False, 24 | 'save_trajectory' : False, 25 | 'partial_fix_adsorbate': True, 26 | 'adsorbates' : ['H'], 27 | 'sites' : ['ontop'], 28 | 'dist_from_surf' : 1.7, 29 | 'using_template_bulk_structure': False, 30 | 'graph_build_scheme_dir': os.path.join('dataset'), 31 | 'device': 'cuda' # in our test results, the A6000 is about * times faster than EPYC 7763. 32 | } 33 | 34 | 35 | ha = HtAds(**high_throughput_config) 36 | ha.run(formula='NiCoFePdPt') 37 | ``` 38 | 39 | **See [default_high_throughput_config](https://jzhang-github.github.io/AGAT/Default%20parameters.html#default-high-throughput-config) to know how to use the parameter settings.** 40 | 41 | 42 | ### Output 43 | 44 | ``` 45 | . 46 | ├── ads_surf_energy_H_0.txt 47 | └── POSCAR_surf_opt_0.gat 48 | ``` 49 | 50 | | File name | Explanation | 51 | | --------- | ----------- | 52 | |`ads_surf_energy_H_0.txt` | Predicted total energies. First column: Total energies of adsorption structure. Second column: Total energy of clean surface. Third column: convergence code: `1` for converge; `0` for ill converge. | 53 | | `POSCAR_surf_opt_0.gat` | Optimized structure of clean surface. | -------------------------------------------------------------------------------- /docs/sphinx/source/conf - Copy.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | sys.path.insert(0, os.path.abspath('../../')) 16 | 17 | # -- Project information ----------------------------------------------------- 18 | 19 | project = 'AGAT' 20 | copyright = '2023, ZHANG Jun, ZHAO Shijun' 21 | author = 'ZHANG Jun, ZHAO Shijun' 22 | 23 | # The full version, including alpha/beta/rc tags 24 | release = '2022.10.04' 25 | 26 | 27 | # -- General configuration --------------------------------------------------- 28 | 29 | # Add any Sphinx extension module names here, as strings. They can be 30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 31 | # ones. 32 | extensions = ['recommonmark', 'sphinx_markdown_tables' 33 | ] 34 | source_suffix = {'.rst': 'restructuredtext','.md': 'markdown'} 35 | 36 | # Add any paths that contain templates here, relative to this directory. 37 | templates_path = ['_templates'] 38 | 39 | # List of patterns, relative to source directory, that match files and 40 | # directories to ignore when looking for source files. 41 | # This pattern also affects html_static_path and html_extra_path. 42 | exclude_patterns = [] 43 | 44 | 45 | # -- Options for HTML output ------------------------------------------------- 46 | 47 | # The theme to use for HTML and HTML Help pages. See the documentation for 48 | # a list of builtin themes. 49 | # 50 | html_theme = "sphinx_rtd_theme" 51 | 52 | # Add any paths that contain custom static files (such as style sheets) here, 53 | # relative to this directory. They are copied after the builtin static files, 54 | # so a file named "default.css" will overwrite the builtin "default.css". 55 | html_static_path = ['_static'] 56 | html_logo = 'logo.svg' -------------------------------------------------------------------------------- /agat/app/ensembles.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Thu Jan 4 22:37:52 2024 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | from typing import IO, Optional, Tuple, Union 9 | import numpy as np 10 | 11 | from ase import Atoms 12 | from ase.md.npt import NPT 13 | 14 | class ModifiedNPT(NPT): 15 | classname = 'ModifiedNPT' 16 | 17 | def __init__( 18 | self, 19 | atoms: Atoms, 20 | timestep: float, 21 | temperature: Optional[float] = None, 22 | externalstress: Optional[float] = None, 23 | ttime: Optional[float] = None, 24 | pfactor: Optional[float] = None, 25 | *arg, 26 | temperature_K: Optional[float] = None, 27 | mask: Optional[Union[Tuple[int], np.ndarray]] = None, 28 | trajectory: Optional[str] = None, 29 | logfile: Optional[Union[IO, str]] = None, 30 | loginterval: int = 1, 31 | append_trajectory: bool = False, 32 | 33 | # max_collected_snapshot_num = 500 34 | ): 35 | 36 | super(ModifiedNPT, self).__init__( 37 | atoms, 38 | timestep, 39 | temperature, 40 | externalstress, 41 | ttime, 42 | pfactor, 43 | *arg, 44 | temperature_K=temperature_K, 45 | mask=mask, 46 | trajectory=trajectory, 47 | logfile=logfile, 48 | loginterval=loginterval, 49 | append_trajectory=append_trajectory) 50 | 51 | 52 | # self.max_collected_snapshot_num = max_collected_snapshot_num 53 | 54 | def run(self, steps): 55 | """Perform a number of time steps.""" 56 | if not self.initialized: 57 | self.initialize() 58 | else: 59 | if self.have_the_atoms_been_changed(): 60 | raise NotImplementedError( 61 | "You have modified the atoms since the last timestep.") 62 | 63 | for i in range(steps): 64 | self.step() 65 | self.nsteps += 1 66 | self.call_observers() 67 | 68 | # if self.atoms.calc.collected_snapshot_num > self.max_collected_snapshot_num: 69 | # return i 70 | else: 71 | return i 72 | -------------------------------------------------------------------------------- /docs/sphinx/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | sys.path.insert(0, os.path.abspath('../../')) 16 | 17 | # -- Project information ----------------------------------------------------- 18 | 19 | project = 'AGAT' 20 | copyright = '2023, ZHANG Jun, ZHAO Shijun' 21 | author = 'ZHANG Jun, ZHAO Shijun' 22 | 23 | # The full version, including alpha/beta/rc tags 24 | release = '2022.10.04' 25 | 26 | 27 | # -- General configuration --------------------------------------------------- 28 | 29 | # Add any Sphinx extension module names here, as strings. They can be 30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 31 | # ones. 32 | extensions = [ 33 | 'myst_parser', # 支持 Markdown 34 | # 'sphinx.ext.autodoc', # 自动文档 35 | 'sphinx.ext.viewcode', # 显示源码 36 | ] 37 | source_suffix = {'.rst': 'restructuredtext','.md': 'markdown'} 38 | 39 | # Add any paths that contain templates here, relative to this directory. 40 | templates_path = ['_templates'] 41 | 42 | # List of patterns, relative to source directory, that match files and 43 | # directories to ignore when looking for source files. 44 | # This pattern also affects html_static_path and html_extra_path. 45 | exclude_patterns = [] 46 | 47 | 48 | # -- Options for HTML output ------------------------------------------------- 49 | 50 | # The theme to use for HTML and HTML Help pages. See the documentation for 51 | # a list of builtin themes. 52 | # 53 | html_theme = "sphinx_rtd_theme" 54 | 55 | # Add any paths that contain custom static files (such as style sheets) here, 56 | # relative to this directory. They are copied after the builtin static files, 57 | # so a file named "default.css" will overwrite the builtin "default.css". 58 | html_static_path = ['_static'] 59 | html_logo = 'logo.svg' -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/lib/high_throughput_lib.rst: -------------------------------------------------------------------------------- 1 | high_throughput_lib 2 | ################### 3 | 4 | 5 | 6 | 7 | .. function:: perturb_positions(atoms, amplitude=0.1) 8 | 9 | Perturbate atomic positions. This method will not change positions of fixed atoms. 10 | 11 | :param ase.atoms atoms: input atoms structure. 12 | :param float amplitude: Perturbate amplitude. 13 | :returns: new atoms. 14 | 15 | 16 | .. function:: scale_atoms(atoms, scale_factor=1.0) 17 | 18 | Scale cell volume and atomic positions. 19 | 20 | :param ase.atoms atoms: input atoms structure. 21 | :param float scale_factor: scale factor. 22 | :returns: new atoms. 23 | 24 | 25 | .. function:: get_concentration_from_ase_formula(formula) 26 | 27 | Calculate elemental concentrations of given chemical formula. 28 | 29 | :param str formula: chemical formula. 30 | :returns: a dictionary of concentrations of all elements. 31 | 32 | 33 | .. function:: get_v_per_atom(chemical_formula) 34 | 35 | Get volume per atom of Ni-Co-Fe-Pd-Pt system. 36 | 37 | .. Note: v_per_atom = -282.7957531391954 * c_NiCoFe(sum) - 278.79605077419797 * C_Pd - -278.6228860885035 * C_Pt + 293.66128761358624 38 | 39 | :param str chemical_formula: chemical formula. 40 | :return: volume per atom of given chemical formula. 41 | 42 | 43 | .. function:: get_ase_atom_from_formula(chemical_formula, v_per_atom=None) 44 | 45 | Build bulk structure according to given chemical formula. 46 | 47 | .. Note:: Cell orientation: 48 | 49 | - ``x``: <1 -1 0> 50 | - ``y``: <1 1 -2> 51 | - ``z``: <1 1 1> 52 | 53 | :param str chemical_formula: chemical formula 54 | :param float v_per_atom: volume per atom 55 | :returns: bulk structure of a ``ase.atoms`` object. 56 | 57 | 58 | .. function:: get_ase_atom_from_formula_template(chemical_formula, v_per_atom=None, template_file='POSCAR_temp') 59 | 60 | Build structure based on a template file. 61 | 62 | :param str chemical_formula: chemical formula 63 | :param v_per_atom float/NoneType/int/bool: volume per atom. Scale the template structure to fit the given volume per atom. 64 | :param str template_file: file name of the template structure. 65 | :returns: bulk structure of a ``ase.atoms`` object. 66 | 67 | 68 | 69 | .. function:: run_vasp() 70 | 71 | :raises ValueError: VASP can only run on a Linux platform 72 | 73 | 74 | .. warning:: Setup your own VAPS package and Intel libraries before using this function. 75 | -------------------------------------------------------------------------------- /test/tesor_computation_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sun Oct 1 01:33:11 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import torch 9 | import time 10 | 11 | @torch.jit.script 12 | def PearsonRjit(y_true, y_pred): 13 | ave_y_true = torch.mean(y_true) 14 | ave_y_pred = torch.mean(y_pred) 15 | 16 | y_true_diff = y_true - ave_y_true 17 | y_pred_diff = y_pred - ave_y_pred 18 | 19 | above = torch.sum(torch.mul(y_true_diff, y_pred_diff)) 20 | below = torch.mul(torch.sqrt(torch.sum(torch.square(y_true_diff))), 21 | torch.sqrt(torch.sum(torch.square(y_pred_diff)))) 22 | return torch.divide(above, below) 23 | 24 | def PearsonR(y_true, y_pred): 25 | ave_y_true = torch.mean(y_true) 26 | ave_y_pred = torch.mean(y_pred) 27 | 28 | y_true_diff = y_true - ave_y_true 29 | y_pred_diff = y_pred - ave_y_pred 30 | 31 | above = torch.sum(torch.mul(y_true_diff, y_pred_diff)) 32 | below = torch.mul(torch.sqrt(torch.sum(torch.square(y_true_diff))), 33 | torch.sqrt(torch.sum(torch.square(y_pred_diff)))) 34 | return torch.divide(above, below) 35 | 36 | if __name__ == '__main__': 37 | y_true = torch.randn(100000) 38 | y_pred = torch.randn(100000) 39 | start = time.time() 40 | for _ in range(10000): 41 | PearsonRjit(y_true, y_pred) 42 | print(time.time()-start) 43 | 44 | start = time.time() 45 | for _ in range(10000): 46 | PearsonR(y_true, y_pred) 47 | print(time.time()-start) 48 | y_true = torch.randn(100000, device='cuda') 49 | y_pred = torch.randn(100000, device='cuda') 50 | start = time.time() 51 | for _ in range(10000): 52 | PearsonRjit(y_true, y_pred) 53 | print(time.time()-start) 54 | 55 | start = time.time() 56 | for _ in range(10000): 57 | PearsonR(y_true, y_pred) 58 | print(time.time()-start) 59 | print('==================') 60 | 61 | """ 62 | The output:: 63 | 15.30269169807434 64 | 2.988755464553833 65 | 2.4554362297058105 66 | 1.8777987957000732 67 | ================== 68 | """ 69 | 70 | y_true_numpy = y_true.cpu().numpy() 71 | y_pred_numpy = y_pred.cpu().numpy() 72 | start = time.time() 73 | for _ in range(10000): 74 | y_diff = y_true_numpy - y_pred_numpy 75 | y_div = y_true_numpy / y_pred_numpy 76 | y_mul = y_true_numpy * y_pred_numpy 77 | print(time.time()-start) 78 | print('==================') 79 | -------------------------------------------------------------------------------- /test/dgl_bug_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sun Sep 24 22:01:12 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import dgl 9 | import dgl.function as fn 10 | import tensorflow as tf 11 | 12 | if __name__ == '__main__': 13 | # Source nodes for edges (2, 1), (3, 2), (4, 3) 14 | src_ids = tf.constant([2, 3, 4]) 15 | # Destination nodes for edges (2, 1), (3, 2), (4, 3) 16 | dst_ids = tf.constant([1, 2, 3]) 17 | g = dgl.graph((src_ids, dst_ids)) 18 | # g_test = ... # create a DGLGraph 19 | g.ndata['h'] = tf.random.uniform((g.num_nodes(), 10)) # each node has feature size 10 20 | g.edata['w'] = tf.random.uniform((g.num_edges(), 1)) # each edge has feature size 1 21 | # collect features from source nodes and aggregate them in destination nodes 22 | g.update_all(fn.copy_u('h', 'm'), fn.sum('m', 'h_sum')) 23 | # multiply source node features with edge weights and aggregate them in destination nodes 24 | g.update_all(fn.u_mul_e('h', 'w', 'm'), fn.max('m', 'h_max')) 25 | # compute edge embedding by multiplying source and destination node embeddings 26 | 27 | for i in range(20): 28 | g.apply_edges(fn.u_mul_v('h', 'h', 'w_new')) 29 | print('========================') 30 | print(g.edata['w_new']) 31 | 32 | ''' 33 | I raise this issue on: https://github.com/dmlc/dgl/issues/6378 34 | ''' 35 | 36 | ############################################################################### 37 | import torch 38 | 39 | if __name__ == '__main__': 40 | # Source nodes for edges (2, 1), (3, 2), (4, 3) 41 | src_ids = torch.tensor([2, 3, 4]) 42 | # Destination nodes for edges (2, 1), (3, 2), (4, 3) 43 | dst_ids = torch.tensor([1, 2, 3]) 44 | g = dgl.graph((src_ids, dst_ids)) 45 | # g_test = ... # create a DGLGraph 46 | g.ndata['h'] = torch.randn((g.num_nodes(), 10)) # each node has feature size 10 47 | g.edata['w'] = torch.randn((g.num_edges(), 1)) # each edge has feature size 1 48 | # collect features from source nodes and aggregate them in destination nodes 49 | g.update_all(fn.copy_u('h', 'm'), fn.sum('m', 'h_sum')) 50 | # multiply source node features with edge weights and aggregate them in destination nodes 51 | g.update_all(fn.u_mul_e('h', 'w', 'm'), fn.max('m', 'h_max')) 52 | # compute edge embedding by multiplying source and destination node embeddings 53 | 54 | for i in range(20): 55 | g.apply_edges(fn.u_mul_v('h', 'h', 'w_new')) 56 | print('========================') 57 | print(g.edata['w_new']) 58 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/data/load_dataset.rst: -------------------------------------------------------------------------------- 1 | ############# 2 | load_dataset 3 | ############# 4 | 5 | 6 | .. Warning:: This page exists for compatibility with earlier versions. In the future, all manipulations of a dataset should by ``atoms.data.Dataset`` 7 | 8 | 9 | .. py:class:: LoadDataset(Dataset) 10 | 11 | Load the binary graphs. 12 | 13 | Example:: 14 | 15 | import os 16 | from agat.data import LoadDataset 17 | dataset=LoadDataset(os.path.join('dataset', 'all_graphs.bin')) 18 | 19 | # you can index or slice the dataset. 20 | g0, props0 = dataset[0] 21 | g_batch, props = dataset[0:100] # the g_batch is a batch collection of graphs. See https://docs.dgl.ai/en/1.1.x/generated/dgl.batch.html 22 | 23 | 24 | .. py:method:: __init__(self, dataset_path) 25 | :no-index: 26 | 27 | :param dataset_path: A paths leads to the binary DGL graph file. 28 | :type dataset_path: str 29 | :return: a graph dataset. 30 | :rtype: list 31 | 32 | 33 | .. py:method:: __getitem__(self, index) 34 | 35 | Index or slice the dataset. 36 | 37 | :param index: list index or slice 38 | :type index: int/slice 39 | :return: graph or graph batch 40 | :rtype: dgl graph 41 | :return: props. Graph labels 42 | :rtype: A dict of torch.tensor 43 | 44 | 45 | .. py:method:: __len__(self) 46 | 47 | Get the length of the dataset. 48 | 49 | :return: the length of the dataset 50 | :rtype: int 51 | 52 | 53 | .. py:class:: Collater(object) 54 | :no-index: 55 | 56 | The collate function used in torch.utils.data.DataLoader: https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader 57 | 58 | The collate function determines how to merge the batch data. 59 | 60 | Example:: 61 | 62 | import os 63 | from agat.data import LoadDataset, Collater 64 | from torch.utils.data import DataLoader 65 | 66 | dataset=LoadDataset(os.path.join('dataset', 'all_graphs.bin')) 67 | collate_fn = Collater(device='cuda') 68 | data_loader = DataLoader(dataset, batch_size=64, shuffle=True, collate_fn=collate_fn) 69 | 70 | 71 | .. py:method:: __init__(self, device='cuda') 72 | :no-index: 73 | 74 | :param device: device to store the merged data, defaults to 'cuda' 75 | :type device: str, optional 76 | 77 | .. py:method:: __call__(self, data) 78 | :no-index: 79 | 80 | Collate the data into batches. 81 | 82 | :param data: the output of :py:class:`LoadDataset` 83 | :type data: tuple 84 | :return: dgl batch graphs. See https://docs.dgl.ai/en/1.1.x/generated/dgl.batch.html 85 | :rtype: DGLGraph 86 | :return: Graph labels 87 | :rtype: A dict of torch.tensor 88 | -------------------------------------------------------------------------------- /docs/_static/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/sphinx/source/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/sphinx/source/logo FuHaijun.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/app_deprecated.rst: -------------------------------------------------------------------------------- 1 | ############### 2 | app_deprecated 3 | ############### 4 | 5 | .. Warning :: This object will be deprecated in the near future. The ``AgatCalculator`` is moved to https://github.com/jzhang-github/AGAT/blob/main/agat/app/calculators.py 6 | 7 | AGAT model applications 8 | 9 | .. class:: AgatCalculator_deprecat(Calculator) 10 | 11 | Deploy AGAT model on ``ase.calculators``, which can relax and find the ground state energy of a structure. 12 | 13 | 14 | .. Note:: Go to https://wiki.fysik.dtu.dk/ase/development/calculators.html#adding-new-calculators for more information about ``ase.calculators`` 15 | 16 | .. attribute:: implemented_properties 17 | 18 | .. code-block:: 19 | 20 | ['energy', 'forces'] 21 | 22 | .. attribute:: default_parameters 23 | 24 | .. code-block:: 25 | 26 | {} 27 | 28 | 29 | .. method:: __init__(self, model_save_dir, graph_build_scheme_dir, device = 'cuda', \**kwargs) 30 | 31 | :param model_save_dir: Directory storing the well-trained model. 32 | :type model_save_dir: str 33 | :param graph_build_scheme_dir: Direcotry storing the ``graph_build_scheme.json`` file. 34 | :type graph_build_scheme_dir: str 35 | :param device: model device, defaults to 'cuda' 36 | :type device: str, optional 37 | :param \**kwargs: other input arguments 38 | :type \**kwargs: dict 39 | :return: Calculated properties. 40 | :rtype: dict 41 | 42 | Example:: 43 | 44 | model_save_dir = 'agat_model' 45 | graph_build_scheme_dir = 'dataset' 46 | atoms = read('CONTCAR') 47 | calculator=AgatCalculator(model_save_dir, 48 | graph_build_scheme_dir) 49 | atoms = Atoms(atoms, calculator=calculator) 50 | dyn = BFGS(atoms, trajectory='test.traj') 51 | dyn.run(fmax=0.005) 52 | 53 | traj = read('test.traj', index=':') 54 | write("XDATCAR.gat", traj) 55 | 56 | .. method:: load_graph_build_scheme(self, path) 57 | 58 | Load graph building scheme. 59 | 60 | .. note:: This file is normally saved to the disk when you build your dataset, under the same directory containing ``all_graphs.bin``. 61 | 62 | :param path: Directory for storing ``graph_build_scheme.json`` file. 63 | :type path: str 64 | :return: A dict denotes how to build the graph. 65 | :rtype: dict 66 | 67 | .. method:: calculate(self, atoms=None, properties=None, system_changes=['positions', 'numbers', 'cell', 'pbc']) 68 | 69 | :param atoms: ase.atoms object, defaults to None 70 | :type atoms: ase.atoms, optional 71 | :param properties: calculated properties, defaults to None 72 | :type properties: none, optional 73 | :param system_changes: DESCRIPTION, defaults to ['positions', 'numbers', 'cell', 'pbc'] 74 | :type system_changes: TYPE, optional 75 | :return: calculated results 76 | :rtype: dict -------------------------------------------------------------------------------- /docs/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px} -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/high_throughput_dft_calculation.rst: -------------------------------------------------------------------------------- 1 | ####################################### 2 | high_throughput_dft_calculation 3 | ####################################### 4 | 5 | 6 | .. py:class:: HtDftAds 7 | 8 | High-throughput DFT calculations for adsorption. 9 | 10 | .. code-block:: 11 | 12 | HT = HtDftAds(calculation_index=0) 13 | HT.run('NiCoFePdPt') 14 | 15 | .. py:property:: root_dir 16 | 17 | The root working directory of this object. 18 | 19 | .. py:method:: __init__(self, **hp_config) 20 | 21 | :param \*\*hp_config: Configurations to control the process. 22 | :type \*\*hp_config: dict 23 | 24 | Example:: 25 | 26 | HA = HpDftAds(calculation_index=0) 27 | HA.run('NiCoFePdPt') 28 | 29 | .. py:method:: bulk_opt(self, formula) 30 | 31 | Structural optimization of the bulk structure with VASP. 32 | 33 | :param formula: Chemical formula 34 | :type formula: str 35 | 36 | .. py:method:: surf_opt(self, bulk_structural_file='CONTCAR_bulk_opt') 37 | 38 | Structural optimization of the surface slab with VASP. 39 | 40 | :param bulk_structural_file: optimized bulk structure, defaults to 'CONTCAR_bulk_opt' 41 | :type bulk_structural_file: str, optional 42 | 43 | 44 | .. py:method:: ads_opt(self, structural_file='CONTCAR_surf_opt', random_samples=5) 45 | 46 | Structural optimization of the adsorption with VASP. 47 | 48 | :param structural_file: Structural file name of optimized clean surface, defaults to 'CONTCAR_surf_opt' 49 | :type structural_file: str, optional 50 | :param random_samples: On one surface, many surface sites can be detected, this number controls how many individual calculations will be performed on this surface, defaults to 5 51 | :type random_samples: int, optional 52 | 53 | .. Note:: 54 | ``random_samples`` cannot be larger than the number of detected surface sites. 55 | 56 | .. py:method:: bulk_aimd(self, formula) 57 | 58 | AIMD simulation for a bulk structure of given chemical formula 59 | 60 | :param formula: The given chemical formula. 61 | :type formula: str 62 | 63 | 64 | .. py:method:: surface_aimd(self, bulk_structural_file='CONTCAR_bulk_opt') 65 | 66 | AIMD simulation for the clean surface. 67 | 68 | :param bulk_structural_file: File name of the bulk structure, defaults to 'CONTCAR_bulk_opt' 69 | :type bulk_structural_file: str, optional 70 | 71 | .. py:method:: ads_aimd(self, structural_file='CONTCAR_surf_opt', random_samples=2) 72 | 73 | AIMD simulation for the adsorption. 74 | 75 | :param structural_file: File name of the clean surface, defaults to 'CONTCAR_surf_opt' 76 | :type structural_file: str, optional 77 | :param random_samples: Randomly select surface sites for the simulation, defaults to 2 78 | :type random_samples: int, optional 79 | 80 | .. Note:: 81 | ``random_samples`` cannot be larger than the number of detected surface sites. 82 | 83 | .. py:method:: run(self, formula, **kwargs) 84 | 85 | :param formula: Chemical formula. 86 | :type formula: str 87 | :param \*\*kwargs: Configurations to control the process. 88 | :type \*\*kwargs: dict 89 | 90 | -------------------------------------------------------------------------------- /agat/app/cata/volcano_2e.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Jul 5 22:24:24 2022 4 | 5 | @author: 18326 6 | """ 7 | import numpy as np 8 | 9 | def volcano_2e(): 10 | 11 | k = 8.617333262e-5 # unit: eV/K 12 | T = 300.0 # unit K 13 | k0 = 200.0 # unit: S^-1*site^-1 14 | vi = 21362619.98986784 15 | h = 4.1357 * 10**-15 # unit: eV * s 16 | vi = k*T/h # This value will not affect the trend. 17 | 18 | # dissociative mechanism (2 e transfer) 19 | intervals = 201 20 | A_list, arg_list = np.zeros((intervals, intervals)), np.zeros((intervals, intervals)) 21 | y_list = np.linspace(-2, 3.0, intervals) 22 | x_list = np.linspace(-1.5, 2.0, intervals) 23 | for i, O in enumerate(y_list): 24 | for j, OH in enumerate(x_list): 25 | 26 | g1 = 2.46 - 2 * 1.23 27 | g2 = O - 2 * 1.23 28 | g3 = OH - 1.23 29 | g4 = 0.0 30 | 31 | Ea = 1.8*O-2.95 32 | 33 | G1 = g2 - g1 # ΔG1 34 | G2 = g3 - g2 # ΔG2 35 | G3 = g4 - g3 # ΔG3 36 | 37 | eta = max([G1,G2,G3]) 38 | 39 | k1 = vi*np.exp(-Ea/(k*T)) 40 | k2 = vi*np.exp(-G1/(k*T)) 41 | k3 = vi*np.exp(-G2/(k*T)) 42 | k4 = vi*np.exp(-G3/(k*T)) 43 | 44 | A1 = k*T*np.log10(k1/k0) 45 | A2 = k*T*np.log10(k2/k0) 46 | A3 = k*T*np.log10(k3/k0) 47 | A4 = k*T*np.log10(k4/k0) 48 | 49 | A = min(A1,A2,A3,A4) 50 | A_list[i,j] = A 51 | arg = np.argmax([A1,A2, A3]) 52 | arg_list[i,j] = arg 53 | arg_list += 1 54 | 55 | A_list = np.vstack((x_list, A_list)) 56 | A_list = np.hstack((np.vstack(([[0.0]], 57 | y_list.reshape(-1,1))), 58 | A_list)) 59 | arg_list = np.vstack((x_list, arg_list)) 60 | arg_list = np.hstack((np.vstack(([[0.0]], 61 | y_list.reshape(-1,1))), 62 | arg_list)) 63 | 64 | np.savetxt('A_O_vs_OH_2e.txt', A_list, fmt='%f') 65 | np.savetxt('arg_O_vs_OH_2e.txt', arg_list, fmt='%f') 66 | 67 | # repeat the paper: J. Phys. Chem. B, Vol. 108, No. 46, 2004 68 | intervals = 201 69 | A_list, arg_list = np.zeros((intervals, intervals)), np.zeros((intervals, intervals)) 70 | y_list = np.linspace(-2, 3.0, intervals) 71 | x_list = np.linspace(-1.5, 2.0, intervals) 72 | for i, O in enumerate(y_list): 73 | for j, OH in enumerate(x_list): 74 | 75 | Ea = 1.8*O-2.89 # From table 2 76 | 77 | G0 = O - 2.45 # From table 2 78 | G1 = OH - O + 0.97 # ΔG1 From table 2 79 | G2 = -OH + 1.48 # ΔG2 From table 2 80 | 81 | k1 = vi*np.exp(-Ea/(k*T)) 82 | k2 = vi*np.exp(-G1/(k*T)) 83 | k3 = vi*np.exp(-G2/(k*T)) 84 | 85 | A1 = k*T*np.log10(k1/k0) 86 | A2 = k*T*np.log10(k2/k0) 87 | A3 = k*T*np.log10(k3/k0) 88 | 89 | A = min(A1,A2,A3) 90 | A_list[i,j] = A 91 | 92 | A_list = np.vstack((x_list, A_list)) 93 | A_list = np.hstack((np.vstack(([[0.0]], 94 | y_list.reshape(-1,1))), 95 | A_list)) 96 | 97 | np.savetxt('A_O_vs_OH_2e.txt', A_list, fmt='%f') 98 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/Build_database.md: -------------------------------------------------------------------------------- 1 | # Build database 2 | 3 | ### Collect paths of VASP calculations 4 | 5 | 6 | - Find all directories containing `OUTCAR` file: 7 | ``` 8 | find . -name OUTCAR > paths.log 9 | ``` 10 | - Remove the string 'OUTCAR' in `paths.log`. 11 | ``` 12 | sed -i 's/OUTCAR$//g' paths.log 13 | ``` 14 | - Specify the absolute paths in `paths.log`. 15 | ``` 16 | sed -i "s#^.#${PWD}#g" paths.log 17 | ``` 18 | 19 | You may want to remove lines with `string`: `sed -i '/string/d' paths.log` 20 | 21 | ### Python script 22 | Modify `data_config` for your own purposes. **See [default_data_config](https://jzhang-github.github.io/AGAT/Default%20parameters.html#default-data-config) to know how to use the parameter settings.** 23 | 24 | ```python 25 | from agat.data import BuildDatabase 26 | data_config = { 27 | 'species': ['H', 'Ni', 'Co', 'Fe', 'Pd', 'Pt'], 28 | 'path_file': 'paths.log', # A file of absolute paths where OUTCAR and XDATCAR files exist. 29 | 'build_properties': {'energy': True, 30 | 'forces': True, 31 | 'cell': True, 32 | 'cart_coords': False, 33 | 'frac_coords': True, 34 | 'constraints': True, 35 | 'stress': True, 36 | 'distance': True, 37 | 'direction': True, 38 | 'path': False}, # Properties needed to be built into graph. 39 | 'dataset_path': 'dataset', # Path where the collected data to save. 40 | 'mode_of_NN': 'ase_dist', # How to identify connections between atoms. 'ase_natural_cutoffs', 'pymatgen_dist', 'ase_dist', 'voronoi'. Note that pymatgen is much faster than ase. 41 | 'cutoff': 5.0, # Cutoff distance to identify connections between atoms. Deprecated if ``mode_of_NN`` is ``'ase_natural_cutoffs'`` 42 | 'load_from_binary': False, # Read graphs from binary graphs that are constructed before. If this variable is ``True``, these above variables will be depressed. 43 | 'num_of_cores': 8, 44 | 'super_cell': False, 45 | 'has_adsorbate': False, 46 | 'keep_readable_structural_files': False, 47 | 'mask_similar_frames': False, 48 | 'mask_reversed_magnetic_moments': False, # or -0.5 # Frames with atomic magnetic moments lower than this value will be masked. 49 | 'energy_stride': 0.05, 50 | 'scale_prop': False 51 | } 52 | 53 | if __name__ == '__main__': # encapsulate the following line in '__main__' because of the `multiprocessing` 54 | database = BuildDatabase(**data_config) 55 | database.build() 56 | ``` 57 | 58 | ### Outputs 59 | A new folder is created, which is defined by the `data_config['dataset_path']`. The structure of this folder is: 60 | 61 | ```console 62 | dataset 63 | ├── all_graphs.bin 64 | ├── fname_prop.csv 65 | └── graph_build_scheme.json 66 | ``` 67 | 68 | | File name | Explanation | 69 | | --------- | ----------- | 70 | |`all_graphs.bin` | Binary file of the DGL graphs | 71 | | `fname_prop.csv` | A file storing the structural file name, properties, and paths. This file will not be used in the training, but is useful for checking the raw data. | 72 | | `graph_build_scheme.json` | An information file tells you how to build the database. When deploying the well-trained model, this file is useful to construct new graphs. | 73 | -------------------------------------------------------------------------------- /docs/sphinx/source/Quick start.md: -------------------------------------------------------------------------------- 1 | # Quick start 2 | ### Prepare VASP calculations 3 | Run VASP calculations at this step. 4 | 5 | ### Collect paths of VASP calculations 6 | - We provided examples of VASP outputs at [VASP_calculations_example](https://github.com/jzhang-github/AGAT/tree/v1.0.0/files/VASP_calculations_example). 7 | - Find all directories containing `OUTCAR` file: 8 | ``` 9 | find . -name OUTCAR > paths.log 10 | ``` 11 | - Remove the string 'OUTCAR' in `paths.log`. 12 | ``` 13 | sed -i 's/OUTCAR$//g' paths.log 14 | ``` 15 | - Specify the absolute paths in `paths.log`. 16 | ``` 17 | sed -i "s#^.#${PWD}#g" paths.log 18 | ``` 19 | 20 | ### Build database 21 | ```python 22 | from agat.data import BuildDatabase 23 | if __name__ == '__main__': 24 | database = BuildDatabase(mode_of_NN='ase_dist', num_of_cores=16) 25 | dataset = database.build() 26 | ``` 27 | 28 | ### Train AGAT model 29 | ```python 30 | from agat.model import Fit 31 | f = Fit() 32 | f.fit() 33 | ``` 34 | 35 | ### Application (geometry optimization) 36 | ```python 37 | from ase.optimize import BFGS 38 | from ase.io import read 39 | from agat.app import AgatCalculator 40 | 41 | model_save_dir = 'agat_model' 42 | graph_build_scheme_dir = 'dataset' 43 | 44 | atoms = read('POSCAR') 45 | calculator=AgatCalculator(model_save_dir, 46 | graph_build_scheme_dir) 47 | atoms = Atoms(atoms, calculator=calculator) 48 | dyn = BFGS(atoms, trajectory='test.traj') 49 | dyn.run(fmax=0.05) 50 | ``` 51 | ### Application (high-throughput prediction) 52 | ```python 53 | from agat.app.cata import HtAds 54 | 55 | model_save_dir = 'agat_model' 56 | graph_build_scheme_dir = 'dataset' 57 | formula='NiCoFePdPt' 58 | 59 | ha = HtAds(model_save_dir=model_save_dir, graph_build_scheme_dir=graph_build_scheme_dir) 60 | ha.run(formula=formula) 61 | ``` 62 | 63 | ### Application (MD simulation, NPT) 64 | 65 | ```python 66 | from ase.io import read 67 | from ase import units 68 | from ase import Atoms 69 | from ase.md import MDLogger 70 | from agat.app import AgatCalculator 71 | from agat.app.ensembles import ModifiedNPT 72 | 73 | model_save_dir = 'agat_model' 74 | graph_build_scheme_dir = '.' # location where you can find `graph_build_scheme.json` file. 75 | 76 | atoms = read('POSCAR') 77 | calculator=AgatCalculator(model_save_dir, 78 | graph_build_scheme_dir, device='cpu') 79 | atoms = Atoms(atoms, calculator=calculator) 80 | dyn = ModifiedNPT(atoms, 81 | timestep=1.0 * units.fs, 82 | temperature_K=300, 83 | ttime = 25 * units.fs, 84 | pfactor = 75 * units.fs, 85 | externalstress = [0.0] * 6, 86 | mask=[[1,0,0], 87 | [0,1,0], 88 | [0,0,1]], 89 | trajectory='md_NPT.traj') 90 | 91 | dyn.attach(MDLogger(dyn, atoms, 'md_NPT.log', 92 | header=True, 93 | stress=True, 94 | peratom=False, 95 | mode="a"), 96 | interval=1) 97 | 98 | dyn.run(200) 99 | ``` 100 | 101 | 102 | 103 | ### Tips: 104 | 105 | See [API doc](https://jzhang-github.github.io/AGAT/API_Docs.html) for more details. For example: 106 | 107 | - Manipulating `agat.dataset`: 108 | - AGAT molecular dynamics simulations: 109 | - More options for controlling the AGAT training process. 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /docs/sphinx/source/Installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ### 1. Install with [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) environment configuration file 4 | 5 | - Download the [`agat_linux_gpu_cu124.yml`](https://github.com/jzhang-github/AGAT/blob/main/agat_linux_gpu_cu124.yml) or [`agat_win_cpu.yml`](https://github.com/jzhang-github/AGAT/blob/main/agat_win_cpu.yml) file. 6 | 7 | - Run 8 | 9 | ```shell 10 | conda env create -f agat_linux_gpu_cu124.yml 11 | ``` 12 | 13 | 14 | 15 | - Run `conda env list` to check installed environments. 16 | 17 | 18 | 19 | ### 2. Install manually with [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) 20 | 21 | 22 | 23 | Examined dependency compatibility: 24 | 25 | | OS | Python | DGL | PyTorch | numpy | ASE | CUDA | 26 | | ----------- | ------ | ----- | ------- | ----- | ------ | ---- | 27 | | Windows CPU | 3.10 | 2.2.1 | 2.3.0 | 2.0.1 | 3.23.0 | - | 28 | | Linux GPU | 3.12 | 2.4.0 | 2.4 | 2.0.1 | 3.23.0 | 12.4 | 29 | 30 | 31 | 32 | 33 | 34 | ## 3. Install with [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) environment on Linux. 35 | 36 | - Create a new environment 37 | 38 | ``` 39 | conda create -n agat python==3.12 40 | ``` 41 | 42 | - Activate the environment 43 | 44 | ``` 45 | conda activate agat 46 | ``` 47 | 48 | - Install [PyTorch](https://pytorch.org/), 49 | Navigate to the [installation page](https://pytorch.org/get-started/locally/#start-locally) and choose your platform. For example (GPU): 50 | 51 | ``` 52 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126 53 | ``` 54 | 55 | - Install [dgl](https://www.dgl.ai/). 56 | Please navigate to the [Get Started](https://www.dgl.ai/pages/start.html) page of [dgl](https://www.dgl.ai/). For example (GPU): 57 | 58 | ``` 59 | pip install dgl -f https://data.dgl.ai/wheels/cu124/repo.html 60 | ``` 61 | 62 | - Install AGAT package 63 | 64 | ``` 65 | pip install agat 66 | ``` 67 | 68 | - Install CUDA and CUDNN [**Optional**]. 69 | 70 | - For HPC with Linux OS, you may load CUDA by checking `module av`, or you can contact your administrator for help. 71 | - Or download manually: 72 | - [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) 73 | - [cuDNN](https://developer.nvidia.com/cudnn) 74 | 75 | 76 | 77 | 78 | 79 | ### 4. Install with [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) environment on Windows. 80 | 81 | The `DGL` package has limited compatibility with Windows, particularly for CUDA versions. You are highly recommended to use the CPU version on Windows. 82 | 83 | - Create a new environment 84 | 85 | ```console 86 | conda create -n agat python==3.10 87 | ``` 88 | 89 | - Activate the environment 90 | 91 | ```console 92 | conda activate agat 93 | ``` 94 | 95 | - Install [PyTorch](https://pytorch.org/), 96 | Navigate to the [installation page](https://pytorch.org/get-started/locally/#start-locally) and choose your platform. 97 | For example (GPU): 98 | 99 | ```console 100 | conda install pytorch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 cpuonly -c pytorch 101 | ``` 102 | 103 | - Install packaging: `pip install packaging` 104 | 105 | - Install [dgl](https://www.dgl.ai/). 106 | 107 | ```console 108 | 109 | ``` 110 | 111 | - Install ASE: `pip install ase`. 112 | 113 | - Install AGAT package 114 | 115 | ```console 116 | pip install agat 117 | ``` 118 | 119 | -------------------------------------------------------------------------------- /agat_win_cpu.yml: -------------------------------------------------------------------------------- 1 | name: agat_win_cpu 2 | channels: 3 | - defaults 4 | dependencies: 5 | - blas=1.0=mkl 6 | - brotli-python=1.0.9=py312h5da7b33_9 7 | - bzip2=1.0.8=h2bbff1b_6 8 | - ca-certificates=2025.9.9=haa95532_0 9 | - cairo=1.18.4=he9e932c_0 10 | - certifi=2025.8.3=py312haa95532_0 11 | - expat=2.7.1=h8ddb27b_0 12 | - fontconfig=2.14.1=hb33846d_3 13 | - freetype=2.13.3=h0620614_0 14 | - graphite2=1.3.14=hd77b12b_1 15 | - harfbuzz=10.2.0=he2f9f60_1 16 | - icu=73.1=h6c2663c_0 17 | - jpeg=9f=ha349fce_0 18 | - lcms2=2.16=hb4a4139_0 19 | - lerc=3.0=hd77b12b_0 20 | - libdeflate=1.17=h2bbff1b_1 21 | - libffi=3.4.4=hd77b12b_1 22 | - libglib=2.84.2=h405b238_0 23 | - libiconv=1.16=h2bbff1b_3 24 | - libkrb5=1.21.3=h885b0b7_4 25 | - libpng=1.6.39=h8cc25b3_0 26 | - libpq=17.4=h4a159e6_2 27 | - libtiff=4.5.1=hd77b12b_0 28 | - libwebp-base=1.3.2=h3d04722_1 29 | - libxml2=2.13.8=h866ff63_0 30 | - libzlib=1.3.1=h02ab6af_0 31 | - lz4-c=1.9.4=h2bbff1b_1 32 | - matplotlib=3.10.6=py312haa95532_0 33 | - matplotlib-base=3.10.6=py312h43afe63_0 34 | - mkl-service=2.4.0=py312h827c3e9_2 35 | - mkl_fft=1.3.11=py312h827c3e9_0 36 | - mkl_random=1.2.8=py312h0158946_0 37 | - mysql-common=9.3.0=hf582a5b_3 38 | - mysql-libs=9.3.0=hc0ebf12_3 39 | - numpy=2.0.1=py312hfd52020_1 40 | - numpy-base=2.0.1=py312h4dde369_1 41 | - openjpeg=2.5.2=hae555c5_0 42 | - openssl=3.0.17=h35632f6_0 43 | - packaging=25.0=py312haa95532_0 44 | - pcre2=10.42=h0ff8eda_1 45 | - pillow=11.1.0=py312h096bfcc_0 46 | - pip=25.2=pyhc872135_0 47 | - pixman=0.46.4=h4043f72_0 48 | - pyqt=6.9.1=py312h12ec796_0 49 | - pyqt6-sip=13.10.2=py312h630b2a1_0 50 | - python=3.12.11=h716150d_0 51 | - python-dateutil=2.9.0post0=py312haa95532_2 52 | - pyyaml=6.0.2=py312h827c3e9_0 53 | - qtbase=6.9.2=hd965823_0 54 | - qtdeclarative=6.9.2=h88b4c33_0 55 | - qtsvg=6.9.2=h30ace32_0 56 | - qttools=6.9.2=h7e7b719_0 57 | - qtwebchannel=6.9.2=heb02b0b_0 58 | - qtwebsockets=6.9.2=heb02b0b_0 59 | - setuptools=78.1.1=py312haa95532_0 60 | - sip=6.12.0=py312h706e071_0 61 | - six=1.17.0=py312haa95532_0 62 | - sqlite=3.50.2=hda9a48d_1 63 | - tk=8.6.15=hf199647_0 64 | - tornado=6.5.1=py312h827c3e9_0 65 | - ucrt=10.0.22621.0=haa95532_0 66 | - unicodedata2=15.1.0=py312h827c3e9_1 67 | - vc=14.3=h2df5915_10 68 | - vc14_runtime=14.44.35208=h4927774_10 69 | - vs2015_runtime=14.44.35208=ha6b5a95_10 70 | - wheel=0.45.1=py312haa95532_0 71 | - xz=5.6.4=h4754444_1 72 | - yaml=0.2.5=he774522_0 73 | - zlib=1.3.1=h02ab6af_0 74 | - zstd=1.5.7=h56299aa_0 75 | - pip: 76 | - annotated-types==0.7.0 77 | - ase==3.26.0 78 | - charset-normalizer==3.4.3 79 | - colorama==0.4.6 80 | - contourpy==1.3.3 81 | - cycler==0.12.1 82 | - dgl==2.2.1 83 | - filelock==3.19.1 84 | - fonttools==4.60.0 85 | - fsspec==2025.9.0 86 | - idna==3.10 87 | - intel-openmp==2021.4.0 88 | - jinja2==3.1.6 89 | - kiwisolver==1.4.9 90 | - markupsafe==3.0.2 91 | - mkl==2021.4.0 92 | - mpmath==1.3.0 93 | - networkx==3.5 94 | - pandas==2.3.2 95 | - psutil==7.1.0 96 | - pydantic==2.11.9 97 | - pydantic-core==2.33.2 98 | - pyparsing==3.2.4 99 | - pytz==2025.2 100 | - requests==2.32.5 101 | - scipy==1.16.2 102 | - sympy==1.14.0 103 | - tbb==2021.13.1 104 | - torch==2.3.0 105 | - torchdata==0.7.1 106 | - tqdm==4.67.1 107 | - typing-extensions==4.15.0 108 | - typing-inspection==0.4.1 109 | - tzdata==2025.2 110 | - urllib3==2.5.0 111 | - agat 112 | 113 | -------------------------------------------------------------------------------- /agat_linux_gpu_cu124_py312.yml: -------------------------------------------------------------------------------- 1 | name: agat 2 | channels: 3 | - dglteam/label/th24_cu124 4 | - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 5 | - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro 6 | - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r 7 | - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 8 | - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main 9 | - defaults 10 | dependencies: 11 | - _libgcc_mutex=0.1=main 12 | - _openmp_mutex=5.1=1_gnu 13 | - blas=1.0=mkl 14 | - brotlicffi=1.0.9.2=py312h6a678d5_1 15 | - bzip2=1.0.8=h5eee18b_6 16 | - ca-certificates=2025.9.9=h06a4308_0 17 | - certifi=2025.10.5=py312h06a4308_0 18 | - cffi=2.0.0=py312h4eded50_0 19 | - charset-normalizer=3.3.2=pyhd3eb1b0_0 20 | - dgl=2.4.0.th24.cu124=py312_0 21 | - expat=2.7.1=h6a678d5_0 22 | - idna=3.7=py312h06a4308_0 23 | - intel-openmp=2023.0.0=h9e868ea_25371 24 | - ld_impl_linux-64=2.44=h153f514_2 25 | - libffi=3.4.4=h6a678d5_1 26 | - libgcc-ng=11.2.0=h1234567_1 27 | - libgfortran-ng=11.2.0=h00389a5_1 28 | - libgfortran5=11.2.0=h1234567_1 29 | - libgomp=11.2.0=h1234567_1 30 | - libstdcxx-ng=11.2.0=h1234567_1 31 | - libuuid=1.41.5=h5eee18b_0 32 | - libxcb=1.17.0=h9b100fa_0 33 | - libzlib=1.3.1=hb25bd0a_0 34 | - mkl=2023.1.0=h213fc3f_46344 35 | - mkl-service=2.4.0=py312h5eee18b_2 36 | - mkl_fft=1.3.11=py312h5eee18b_0 37 | - mkl_random=1.2.8=py312h526ad5a_0 38 | - ncurses=6.5=h7934f7d_0 39 | - networkx=3.5=py312h06a4308_0 40 | - numpy-base=2.0.1=py312h0da6c21_1 41 | - openssl=3.0.18=hd6dcaed_0 42 | - pip=25.2=pyhc872135_0 43 | - psutil=7.0.0=py312hee96239_0 44 | - pthread-stubs=0.3=h0ce48e5_1 45 | - pycparser=2.23=py312h06a4308_0 46 | - pysocks=1.7.1=py312h06a4308_0 47 | - python=3.12.0=h996f2a0_0 48 | - readline=8.3=hc2a1206_0 49 | - requests=2.32.5=py312h06a4308_0 50 | - scipy=1.16.0=py312h0cc6016_0 51 | - setuptools=80.9.0=py312h06a4308_0 52 | - sqlite=3.50.2=hb25bd0a_1 53 | - tbb=2021.8.0=hdb19cb5_0 54 | - tk=8.6.15=h54e0aa7_0 55 | - tqdm=4.67.1=py312he106c6f_0 56 | - urllib3=2.5.0=py312h06a4308_0 57 | - wheel=0.45.1=py312h06a4308_0 58 | - xorg-libx11=1.8.12=h9b100fa_1 59 | - xorg-libxau=1.0.12=h9b100fa_0 60 | - xorg-libxdmcp=1.1.5=h9b100fa_0 61 | - xorg-xorgproto=2024.1=h5eee18b_1 62 | - xz=5.6.4=h5eee18b_1 63 | - zlib=1.3.1=hb25bd0a_0 64 | - pip: 65 | - --extra-index-url https://download.pytorch.org/whl/cu124 66 | - annotated-types==0.7.0 67 | - ase==3.23.0 68 | - contourpy==1.3.3 69 | - cycler==0.12.1 70 | - filelock==3.19.1 71 | - fonttools==4.60.1 72 | - fsspec==2025.9.0 73 | - jinja2==3.1.6 74 | - kiwisolver==1.4.9 75 | - markupsafe==2.1.5 76 | - matplotlib==3.10.7 77 | - mpmath==1.3.0 78 | - numpy==2.3.3 79 | - nvidia-cublas-cu12==12.4.2.65 80 | - nvidia-cuda-cupti-cu12==12.4.99 81 | - nvidia-cuda-nvrtc-cu12==12.4.99 82 | - nvidia-cuda-runtime-cu12==12.4.99 83 | - nvidia-cudnn-cu12==9.1.0.70 84 | - nvidia-cufft-cu12==11.2.0.44 85 | - nvidia-curand-cu12==10.3.5.119 86 | - nvidia-cusolver-cu12==11.6.0.99 87 | - nvidia-cusparse-cu12==12.3.0.142 88 | - nvidia-nccl-cu12==2.20.5 89 | - nvidia-nvjitlink-cu12==12.4.99 90 | - nvidia-nvtx-cu12==12.4.99 91 | - packaging==25.0 92 | - pandas==2.3.3 93 | - pillow==11.3.0 94 | - pydantic==2.12.2 95 | - pydantic-core==2.41.4 96 | - pyparsing==3.2.5 97 | - python-dateutil==2.9.0.post0 98 | - pytz==2025.2 99 | - pyyaml==6.0.3 100 | - six==1.17.0 101 | - sympy==1.14.0 102 | - torch==2.4.1+cu124 103 | - torchaudio==2.4.1+cu124 104 | - torchvision==0.19.1+cu124 105 | - triton==3.0.0 106 | - typing-extensions==4.15.0 107 | - typing-inspection==0.4.2 108 | - tzdata==2025.2 109 | - agat 110 | -------------------------------------------------------------------------------- /agat/lib/file_lib.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sat Aug 12 16:08:41 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import sys 9 | import platform 10 | import os 11 | from .exceptions import FileExit 12 | from .incar_tag import INCAR_TAG 13 | import shutil 14 | 15 | def generate_file_name(fname): 16 | while os.path.exists(fname): 17 | fname = fname + '_new' 18 | return fname 19 | 20 | def file_exit(): 21 | if os.path.exists('StopPython'): 22 | os.remove('StopPython') 23 | raise FileExit('Exit because `StopPython` file is found.') 24 | 25 | def modify_INCAR(working_dir='.', key='NSW', value='300', s=''): 26 | """Modify the INCAR file. 27 | 28 | :param key: The INCAR tag, defaults to 'NSW' 29 | :type key: str, optional 30 | :param value: Value of the INCAR tag, defaults to '300' 31 | :type value: str, optional 32 | :param s: Comment string, defaults to '' 33 | :type s: str, optional 34 | :return: Modified INCAR file 35 | 36 | """ 37 | 38 | if not key in INCAR_TAG: 39 | print('Input key not avaliable, please check.') 40 | return 1 41 | 42 | new_incar, discover_code = [], False 43 | with open(os.path.join(working_dir, 'INCAR'), 'r') as f: 44 | for line in f: 45 | str_list = line.split() 46 | if len(str_list) == 0: 47 | new_incar.append('\n') 48 | elif str_list[0] == key: 49 | str_list[2] = value 50 | new_incar.append(f' {str_list[0]} = {str_list[2]}\n') 51 | discover_code = True 52 | else: 53 | new_incar.append(line) 54 | 55 | if s: 56 | new_incar.append(f'\n{s}\n') 57 | 58 | if not discover_code: 59 | new_incar.append(f' {key} = {value}\n') 60 | 61 | with open(os.path.join(working_dir, 'INCAR'), 'w') as f: 62 | for line in new_incar: 63 | f.write(line) 64 | return 0 65 | 66 | def modify_KPOINTS(working_dir='.', k='3 3 3'): 67 | with open(os.path.join(working_dir, 'KPOINTS'), 'r') as f: 68 | lines = f.readlines() 69 | 70 | lines[3] = k 71 | 72 | with open(os.path.join(working_dir, 'KPOINTS'), 'r') as f: 73 | for l in f: 74 | f.write(l) 75 | 76 | def get_INCAR(src='INCAR', dst='INCAR'): 77 | # path = dst 78 | if not os.path.exists(dst): 79 | shutil.copy(src, dst) 80 | else: 81 | print(f'INCAR file already exists in {dst}. Skipping ...') 82 | 83 | def get_KPOINTS(src='KPOINTS', dst='KPOINTS'): 84 | if not os.path.exists(dst): 85 | shutil.copy(src, dst) 86 | else: 87 | print(f'KPOINTS file already exists in {dst}. Skipping ...') 88 | 89 | def get_KPOINTS_gamma(dst='KPOINTS'): 90 | 91 | with open(dst, 'w') as f: 92 | f.write('''Automatic mesh 93 | 0 94 | Gamma 95 | 1 1 1 96 | 0.0 0.0 0.0 97 | ''') 98 | 99 | def get_POTCAR(cmd='getpotential.sh', line=1, working_dir='.'): 100 | if sys.platform != 'linux': 101 | print('The POTCAR file can only be generated on a Linux OS.') 102 | return None 103 | path = os.path.join(working_dir, 'POTCAR') 104 | if not os.path.exists(path): 105 | curdir = os.getcwd() 106 | os.chdir(working_dir) 107 | os.system(f"{cmd} {str(line)}") 108 | os.chdir(curdir) 109 | else: 110 | print(f'POTCAR file already exists in {path}. Skipping ...') 111 | 112 | def run_vasp(cmd='vasp_run.sh'): 113 | assert platform.system() == 'Linux', 'The VASP code can only be executed on a Linux OS.' 114 | # The POSCAR file should exist already. 115 | r = os.system(f'bash {cmd}') 116 | return r # `0` for good; `1` for bad execution. 117 | 118 | def file_force_action(func, src, dst): 119 | if os.path.exists(dst): 120 | if os.path.isdir(dst): 121 | shutil.rmtree(dst) 122 | else: 123 | os.remove(dst) 124 | func(src, dst) 125 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial.rst: -------------------------------------------------------------------------------- 1 | Brief 2 | ================== 3 | 4 | Take a look at the default parameters 5 | ------------------------------------- 6 | 7 | .. toctree:: 8 | :maxdepth: 6 9 | 10 | Default parameters 11 | 12 | 13 | 14 | 15 | Easy usage 16 | --------------- 17 | 18 | By default, the database construction, model training, and model application are controled by the `Default parameters `_ . 19 | 20 | 21 | For example: 22 | 23 | .. code-block:: python 24 | 25 | # Build database 26 | from agat.data import BuildDatabase 27 | if __name__ == '__main__': 28 | database = BuildDatabase() 29 | database.build() 30 | 31 | # Train AGAT model 32 | from agat.model import Fit 33 | f = Fit() 34 | f.fit() 35 | 36 | # Application (high-throughput prediction) 37 | from agat.app.cata import HtAds 38 | ha = HtAds() 39 | ha.run(formula='NiCoFePdPt') 40 | 41 | 42 | As you can see, you only need to provide very few input arguments to instantiate the imported objects. 43 | 44 | 45 | Customized usage 46 | -------------------- 47 | 48 | There are generally two ways to customize your AGAT training and deployment. Taking the training as an example: 49 | 50 | Customized keyword arguements 51 | ***************************** 52 | 53 | 54 | .. code-block:: python 55 | 56 | from agat.model import Fit 57 | f = Fit(verbose=2, gat_node_dim_list=[6, 10, 10], b=10.0) 58 | f.fit() 59 | 60 | 61 | 62 | This will replace the settings for ``verbose``, ``gat_node_dim_list``, ``b``. Other parameters are still controled by the `Default parameters `_ . 63 | 64 | 65 | Customized input dict 66 | **************************** 67 | 68 | 69 | .. code-block:: python 70 | 71 | import os 72 | import torch.nn as nn 73 | from agat.model import Fit 74 | train_config = { 75 | 'verbose': 1, # `0`: no train and validation output; `1`: Validation and test output; `2`: train, validation, and test output. 76 | 'dataset_path': os.path.join('dataset', 'all_graphs.bin'), 77 | 'model_save_dir': 'agat_model', 78 | 'epochs': 1000, 79 | 'output_files': 'out_file', 80 | 'device': 'cuda:0', 81 | 'validation_size': 0.15, 82 | 'test_size': 0.15, 83 | 'early_stop': True, 84 | 'stop_patience': 300, 85 | 'gat_node_dim_list': [6, 100, 100, 100], 86 | 'head_list': ['mul', 'div', 'free'], 87 | 'energy_readout_node_list': [300, 300, 100, 50, 30, 10, 3, 1], 88 | 'force_readout_node_list': [300, 300, 100, 50, 30, 10, 3], 89 | 'stress_readout_node_list': [300, 300, 6], 90 | 'bias': True, 91 | 'negative_slope': 0.2, 92 | 'criterion': nn.MSELoss(), 93 | 'a': 1.0, 94 | 'b': 1.0, 95 | 'c': 0.0, 96 | 'optimizer': 'adam', # Fix to sgd. 97 | 'learning_rate': 0.0001, 98 | 'weight_decay': 0.0, # weight decay (L2 penalty) 99 | 'batch_size': 64, 100 | 'val_batch_size': 400, 101 | 'transfer_learning': False, 102 | 'trainable_layers': -4, 103 | 'mask_fixed': False, 104 | 'tail_readout_no_act': [3,3,3], 105 | 'adsorbate_coeff': 20.0 # indentify and specify the importance of adsorbate atoms with respective to surface atoms. zero for equal importance. 106 | } 107 | f = Fit(**train_config) 108 | f.fit() 109 | 110 | 111 | 112 | The input ``train_config`` has higher priority than the `Default parameters `_ . 113 | 114 | More tutorials 115 | ================== 116 | 117 | .. toctree:: 118 | :maxdepth: 6 119 | 120 | Tutorial/VASP_calculations 121 | Tutorial/Build_graph 122 | Tutorial/Build_database 123 | Tutorial/Train_AGAT_model 124 | Tutorial/Predict_structural_file 125 | Tutorial/Structural_optimization 126 | Tutorial/High_throughput_prediction 127 | 128 | 129 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/data/atomic_feature.rst: -------------------------------------------------------------------------------- 1 | ################### 2 | atomic_feature 3 | ################### 4 | 5 | Atomic features are one-hot codes. 6 | 7 | .. py:data:: all_elements 8 | 9 | All element symbols in the periodic table. Some radioactive elements are not included:: 10 | 11 | ['Ac', 'Ag', 'Al', 'Am', 'Ar', 'As', 'At', 'Au', 'B', 'Ba', 12 | 'Be', 'Bh', 'Bi', 'Bk', 'Br', 'C', 'Ca', 'Cd', 'Ce', 'Cf', 13 | 'Cl', 'Cm', 'Cn', 'Co', 'Cr', 'Cs', 'Cu', 'Db', 'Ds', 'Dy', 14 | 'Er', 'Es', 'Eu', 'F', 'Fe', 'Fl', 'Fm', 'Fr', 'Ga', 'Gd', 15 | 'Ge', 'H', 'He', 'Hf', 'Hg', 'Ho', 'Hs', 'I', 'In', 'Ir', 16 | 'K', 'Kr', 'La', 'Li', 'Lr', 'Lu', 'Lv', 'Mc', 'Md', 'Mg', 17 | 'Mn', 'Mo', 'Mt', 'N', 'Na', 'Nb', 'Nd', 'Ne', 'Nh', 'Ni', 18 | 'No', 'Np', 'O', 'Og', 'Os', 'P', 'Pa', 'Pb', 'Pd', 'Pm', 19 | 'Po', 'Pr', 'Pt', 'Pu', 'Ra', 'Rb', 'Re', 'Rf', 'Rg', 'Rh', 20 | 'Rn', 'Ru', 'S', 'Sb', 'Sc', 'Se', 'Sg', 'Si', 'Sm', 'Sn', 21 | 'Sr', 'Ta', 'Tb', 'Tc', 'Te', 'Th', 'Ti', 'Tl', 'Tm', 'Ts', 22 | 'U', 'V', 'W', 'Xe', 'Y', 'Yb', 'Zn', 'Zr'] 23 | 24 | .. py:data:: elements 25 | 26 | Common elements:: 27 | 28 | ['Ac', 'Ag', 'Al', 'Am', 'As', 'Au', 'B', 'Ba', 'Be', 29 | 'Bi', 'Br', 'C', 'Ca', 'Cd', 'Ce', 'Cl', 'Co', 'Cr', 'Cs', 30 | 'Cu', 'Dy', 'Er', 'Eu', 'F', 'Fe', 'Ga', 'Gd', 'Ge', 'H', 31 | 'Hf', 'Hg', 'Ho', 'I', 'In', 'Ir', 'K', 'La', 'Li', 'Lu', 32 | 'Mg', 'Mn', 'Mo', 'N', 'Na', 'Nb', 'Nd', 'Ni', 'Np', 'O', 33 | 'Os', 'P', 'Pb', 'Pd', 'Pm', 'Po', 'Pr', 'Pt', 'Pu', 'Ra', 34 | 'Rb', 'Re', 'Rh', 'Ru', 'S', 'Sb', 'Sc', 'Se', 'Si', 'Sm', 35 | 'Sn', 'Sr', 'Ta', 'Tb', 'Tc', 'Te', 'Th', 'Ti', 'Tl', 'Tm', 36 | 'U', 'V', 'W', 'Y', 'Yb', 'Zn', 'Zr'] 37 | 38 | 39 | .. py:data:: selected_elements 40 | 41 | Selected elements for a specific system. For example:: 42 | 43 | ['H', 'He', 'Li', 'Be', 'B'] 44 | 45 | 46 | .. py:data:: Elements_used 47 | 48 | Elements used for one-hot coding. 49 | 50 | .. Important:: This variable defines the elements used for a well-trained model. Make sure the atomistic representation for the training and prediction are same. Normally, ``Elements_used = elements`` is robust. 51 | 52 | 53 | .. py:function:: get_atomic_features() 54 | 55 | Encode atomistic features with physical properties. For more input features, please refer to: https://pymatgen.org/pymatgen.core.periodic_table.html. For now, the following properties are included. 56 | 57 | .. note:: This function will be deprecated in the short future. 58 | 59 | ==================== ============= 60 | Property Code Property 61 | ==================== ============= 62 | Z atomic number 63 | atomic_radius atomic radius 64 | molar_volume molar volume 65 | atomic_mass atomic mass 66 | mendeleev_no mendeleev number 67 | X electronegativity 68 | boiling_point boiling point 69 | melting_point melting point 70 | row row number in the periodic table 71 | group group number in the periodic table 72 | max_oxidation_state maximum oxidation state 73 | min_oxidation_state minimum oxidation state 74 | ==================== ============= 75 | 76 | 77 | :Returns: atom_feat: atomic features of all elements. 78 | 79 | 80 | .. py:function:: get_atomic_feature_onehot(Elements_used) 81 | 82 | Get the one-hot code of all considered elements. The elements are sorted by their atomic number:: 83 | 84 | atomic_number = [atomic_numbers[x] for x in Elements_used] 85 | atoms_dict = dict(zip(atomic_number, Elements_used)) 86 | 87 | atomic_number.sort() 88 | 89 | Elements_sorted = [atoms_dict[x] for x in atomic_number] 90 | 91 | :param list Elements_used: Elements used to encode atomic representations. 92 | 93 | :Returns: atom_feat: one-hot code representation of all considered elements. 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /agat/bin/agat_bayesian_opt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Aug 22 11:56:42 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import os 9 | 10 | from bayes_opt import BayesianOptimization 11 | from bayes_opt.logger import JSONLogger 12 | from bayes_opt.event import Events 13 | from bayes_opt.util import load_logs 14 | 15 | from agat.model import Fit 16 | 17 | def train(head1, head2, head3, 18 | GAT_out1, GAT_out2, GAT_out3, 19 | ereadout2, ereadout3, ereadout4, ereadout5, ereadout6, 20 | freadout2, freadout3, freadout4, freadout5, freadout6): 21 | 22 | all_heads = ['mul', 'div', 'free'] 23 | 24 | f = Fit(epochs=100, device='cuda', c=0.0, learning_rate=0.0001, tail_readout_no_act=[3,3,1], 25 | gat_node_dim_list=[6, 26 | round(GAT_out1), 27 | round(GAT_out2), 28 | round(GAT_out3)], 29 | energy_readout_node_list=[3*round(GAT_out3), 30 | round(ereadout2), 31 | round(ereadout3), 32 | round(ereadout4), 33 | round(ereadout5), 34 | round(ereadout6), 35 | 1], 36 | force_readout_node_list=[3*round(GAT_out3), 37 | round(freadout2), 38 | round(freadout3), 39 | round(freadout4), 40 | round(freadout5), 41 | round(freadout6), 42 | 3], 43 | stress_readout_node_list=[3*round(GAT_out3),6], 44 | head_list=[all_heads[round(head1)], 45 | all_heads[round(head2)], 46 | all_heads[round(head3)]] 47 | ) 48 | 49 | loss = f.fit() 50 | loss = loss.item() 51 | 52 | with open('parameters_force.txt', mode='a') as f: 53 | print(loss, 54 | head1, head2, head3, 55 | GAT_out1, GAT_out2, GAT_out3, 56 | ereadout2, ereadout3, ereadout4, ereadout5, ereadout6, 57 | freadout2, freadout3, freadout4, freadout5, freadout6, 58 | file=f) 59 | return -loss 60 | 61 | if __name__ == '__main__': 62 | pbounds = { 63 | 'head1':(0,2), 64 | 'head2':(0,2), 65 | 'head3':(0,2), 66 | 'GAT_out1': (10,200), 67 | 'GAT_out2': (10,200), 68 | 'GAT_out3': (10,200), 69 | 'ereadout2': (50,400), 70 | 'ereadout3': (50,400), 71 | 'ereadout4': (50,400), 72 | 'ereadout5': (50,400), 73 | 'ereadout6': (50,400), 74 | 'freadout2': (50,400), 75 | 'freadout3': (50,400), 76 | 'freadout4': (50,400), 77 | 'freadout5': (50,400), 78 | 'freadout6': (50,400), 79 | } 80 | 81 | optimizer = BayesianOptimization( 82 | f=train, 83 | # constraint=constraint, 84 | pbounds=pbounds, 85 | verbose=2, # verbose = 1 prints only when a maximum is observed, verbose = 0 is silent 86 | random_state=1, 87 | ) 88 | 89 | # load model if necessary 90 | if os.path.exists('logs.log.json'): 91 | load_logs(optimizer, logs=["./logs.log"]) 92 | print('Bayesian progress loaded.') 93 | else: 94 | print('Bayesian not detected.') 95 | 96 | # save model 97 | logger = JSONLogger(path="./logs.log") 98 | optimizer.subscribe(Events.OPTIMIZATION_STEP, logger) 99 | 100 | optimizer.maximize( 101 | init_points=30, # How many steps of **random** exploration you want to perform. Random exploration can help by diversifying the exploration space. 102 | n_iter=1000, # How many steps of bayesian optimization you want to perform. The more steps the more likely to find a good maximum you are. 103 | ) 104 | 105 | print(optimizer.max) 106 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/cata/high_throughput_predict.rst: -------------------------------------------------------------------------------- 1 | ############################## 2 | high_throughput_predict 3 | ############################## 4 | 5 | 6 | .. class:: HtAds(object) 7 | 8 | High-throughput predictions. 9 | 10 | .. function:: __init__(self, \*\*hp_config) 11 | 12 | See https://jzhang-github.github.io/AGAT/Default%20parameters.html#default-high-throughput-config for more details. 13 | 14 | 15 | .. function:: geo_opt(atoms_with_calculator, **kwargs) 16 | 17 | Geometrical optimization of given structure. 18 | 19 | .. Note:: `BFGS`_ optimizer is adopted. 20 | 21 | :param ase.atoms atoms_with_calculator: structure with ``ase.calculators`` attribute. 22 | :param dict/args \*\*kwargs: relaxation configuration. 23 | 24 | .. Hint:: You can find detailed settings of `BFGS`_. Here is the summary: 25 | 26 | ================= ============ ============ 27 | Setting Default Description 28 | ================= ============ ============ 29 | fmax 0.05 Maximum force acting on every atom should be lower than this. 30 | steps 200 Stop optimization if iteration step is reached. 31 | maxstep 0.1 Used to set the maximum distance an atom can move per iteration 32 | restart None Pickle file used to store hessian matrix. If set, file with such a name will be searched and hessian matrix stored will be used, if the file exists. 33 | restart_steps 5 In some cases, it can be difficult for `BFGS`_ to converge. If `BFGS`_ cannot coverge after ``steps``, this code halves ``maxstep`` and rerun. But this code will not rerun more than ``restart_steps`` times. 34 | perturb_steps 0 Defines how many perturbated structures (perturb free atoms only) are optimized. Only structure with lowest energy is adopted. 35 | perturb_amplitude 0.05 perturbation amplitude 36 | ================= ============ ============ 37 | 38 | :Returns: - energy: energy after relaxation 39 | - force: atomic forces after relaxation. 40 | - force_max: max atomic force after relaxation. 41 | 42 | 43 | .. function:: ads_calc(formula, calculator, **kwargs) 44 | 45 | `BFGS`_ calculations including geometrical optimizations of bulk, clean surface, and adsorption strucures. 46 | 47 | :param str formula: chemical formula. 48 | :param ase.calculators calculator: calculator. 49 | :param dict/args \*\*kwargs: relaxation configuration. 50 | 51 | .. Hint:: Details of relaxation configuration: 52 | 53 | ===================== ================================== ============ 54 | Setting Default Description 55 | ===================== ================================== ============ 56 | calculation_index None Calculation index. You can use this parameter to differentiate multiple calculations. 57 | fix_surface_atom False Fix all surface atoms if this is True. 58 | remove_bottom_atoms False Remove the bottom atomic plane if this is True. 59 | save_trajectory False Save relaxation trajectory or not. 60 | partial_fix_adsorbate False Partially fix adsorbate positions. 61 | adsorbates ['O', 'OH', 'OOH'] Adsorbates placed on the surface. 62 | sites ['ontop', 'bridge', 'hollow'] Sites for placing adsorbates. 63 | fmax 0.1 Maximum force acting on every atom should be lower than this. 64 | dist_from_surf 2.0 Distance between adsorbate and surface. 65 | ===================== ================================== ============ 66 | 67 | .. function:: run(self, formula, **kwargs) 68 | 69 | :param formula: Input chemical formula 70 | :type formula: str 71 | 72 | 73 | .. _BFGS: https://wiki.fysik.dtu.dk/ase/ase/optimize.html#bfgs 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /docs/sphinx/source/Tutorial/Train_AGAT_model.md: -------------------------------------------------------------------------------- 1 | # Train AGAT model 2 | 3 | ### Python script 4 | ```python 5 | import os 6 | import torch.nn as nn 7 | from agat.model import Fit 8 | 9 | train_config = { 10 | 'verbose': 1, # `0`: no train and validation output; `1`: Validation and test output; `2`: train, validation, and test output. 11 | 'dataset_path': os.path.join('dataset', 'all_graphs.bin'), 12 | 'model_save_dir': 'agat_model', 13 | 'epochs': 1000, 14 | 'output_files': 'out_file', 15 | 'device': 'cuda:0', 16 | 'validation_size': 0.15, 17 | 'test_size': 0.15, 18 | 'early_stop': True, 19 | 'stop_patience': 300, 20 | 'head_list': ['mul', 'div', 'free'], 21 | 'gat_node_dim_list': [len(default_elements), 100, 100, 100], 22 | 'energy_readout_node_list': [len(head_list)*gat_node_dim_list[-1], 100, 50, 30, 10, 3, FIX_VALUE[0]], 23 | 'force_readout_node_list': [len(head_list)*gat_node_dim_list[-1], 100, 50, 30, 10, FIX_VALUE[1]], 24 | 'stress_readout_node_list': [len(head_list)*gat_node_dim_list[-1], 100, 50, 30, 10, FIX_VALUE[2]], 25 | 'bias': True, 26 | 'negative_slope': 0.2, 27 | 'criterion': nn.MSELoss(), 28 | 'a': 1.0, 29 | 'b': 1.0, 30 | 'c': 0.0, 31 | # 'optimizer': 'adam', 32 | 'learning_rate': 0.0001, 33 | 'weight_decay': 0.0, # weight decay (L2 penalty) 34 | 'batch_size': 64, 35 | 'val_batch_size': 400, 36 | 'transfer_learning': False, 37 | 'trainable_layers': -4, 38 | 'mask_fixed': False, 39 | 'tail_readout_no_act': [3,3,3], 40 | # 'adsorbate': False, # or not when building graphs. 41 | 'adsorbate_coeff': 20.0 # indentify and specify the importance of adsorbate atoms with respective to surface atoms. zero for equal importance. 42 | } 43 | 44 | f = Fit(**train_config) 45 | f.fit() 46 | ``` 47 | 48 | **See [default_train_config](https://jzhang-github.github.io/AGAT/Default%20parameters.html#default-train-config) to know how to use the parameter settings.** 49 | 50 | ### Output 51 | 52 | The file structure: 53 | 54 | ```console 55 | . 56 | ├── agat_model 57 | │   ├── agat_model.json 58 | │   ├── agat.pth 59 | │   └── agat_state_dict.pth 60 | ├── dataset 61 | │   ├── all_graphs.bin 62 | │   ├── fname_prop.csv 63 | │   └── graph_build_scheme.json 64 | ├── fit.log 65 | ├── out_file 66 | │   ├── energy_test_pred_true.txt 67 | │   ├── energy_val_pred_true.txt 68 | │   ├── force_test_pred_true.txt 69 | │   ├── force_val_pred_true.txt 70 | │   ├── stress_test_pred_true.txt 71 | │   └── stress_val_pred_true.txt 72 | └── train.py 73 | ``` 74 | 75 | | Folder/File | File | Explanation | 76 | | ------ | ---- | ----------- | 77 | | `agat_model` | ─── | A directory for saving well-trained model. | 78 | | ├── | `agat_model.json` | An information file tells you how to build an AGAT model. | 79 | | ├── | `agat.pth` | The saved AGAT model including model structure and parameters. | 80 | | └── | `agat_state_dict.pth` | Model and optimizer state dict file including model parameters only. You will need to construct a model or optimizer before using this file. | 81 | | `dataset` | ─── | A directory for the database. | 82 | | ├── | `all_graphs.bin` | Binary file of the DGL graphs | 83 | | ├── | `fname_prop.csv` | A file storing the structural file name, properties, and paths. This file will not be used in the training, but is useful for checking the raw data. | 84 | | └── | `graph_build_scheme.json` | An information file tells you how to build the database. When deploying the well-trained model, this file is useful to construct new graphs. | 85 | | `fit.log` | | The training log file. The `train_config['verbose']` controls the verbosity. | 86 | | `out_file` | ─── | A directory to store ouputs of true and predicted properties. Folder name specified by `train_config['output_files']`. | 87 | | ├── | `energy_test_pred_true.txt` | Predicted and true energy on the test dataset. | 88 | | ├── | `energy_val_pred_true.txt` | Predicted and true energy on the validation dataset. | 89 | | ├── | `force_test_pred_true.txt` | Predicted and true force on the test dataset. | 90 | | ├── | `force_val_pred_true.txt` | Predicted and true force on the validation dataset. | 91 | | ├── | `stress_test_pred_true.txt` | Predicted and true stress on the test dataset. | 92 | | └── | `stress_val_pred_true.txt` | Predicted and true stress on the validation dataset. | 93 | | `train.py` | | The training script. | 94 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/model/model.rst: -------------------------------------------------------------------------------- 1 | ############## 2 | model 3 | ############## 4 | 5 | .. Note:: You can customize the :class:`PotentialModel` to train and predict atom and bond related properties. You need to store the labels on graph edges if you want to do so. This model has multiple attention heads. 6 | 7 | .. py:class:: PotentialModel(nn.Module) 8 | 9 | A GAT model with multiple gat layers for predicting atomic energies, forces, and stress tensors. 10 | 11 | 12 | .. Important:: 13 | 14 | The first value of ``gat_node_dim_list`` is the depth of atomic representation. 15 | 16 | The first value of ``energy_readout_node_list``, ``force_readout_node_list``, ``stress_readout_node_list`` is the input dimension and equals to last value of ``gat_node_list * num_heads``. 17 | 18 | The last values of ``energy_readout_node_list``, ``force_readout_node_list``, ``stress_readout_node_list`` are ``1``, ``3``, and ``6``, respectively. 19 | 20 | 21 | 22 | .. py:method:: __init__(self, gat_node_dim_list, energy_readout_node_list, force_readout_node_list, stress_readout_node_list, head_list=['div'], bias=True, negative_slope=0.2, device = 'cuda', tail_readout_no_act=[3,3,3]) 23 | 24 | :param gat_node_dim_list: A list of node dimensions of the AGAT ``Layer``. 25 | :type gat_node_dim_list: list 26 | :param energy_readout_node_list: A list of node dimensions of the energy readout layers. 27 | :type energy_readout_node_list: list 28 | :param force_readout_node_list: A list of node dimensions of the force readout layers. 29 | :type force_readout_node_list: list 30 | :param stress_readout_node_list: A list of node dimensions of the stress readout layers. 31 | :type stress_readout_node_list: list 32 | :param head_list: A list of attention head names, defaults to ['div'] 33 | :type head_list: list, optional 34 | :param bias: Add bias or not to the neural networks., defaults to True 35 | :type bias: TYPE, bool 36 | :param negative_slope: This specifies the negative slope of the LeakyReLU (see https://pytorch.org/docs/stable/generated/torch.nn.LeakyReLU.html) activation function., defaults to 0.2 37 | :type negative_slope: float, optional 38 | :param device: Device to train the model. Use GPU cards to accerelate training., defaults to 'cuda' 39 | :type device: str, optional 40 | :param tail_readout_no_act: The tail ``tail_readout_no_act`` layers will have no activation functions. The first, second, and third elements are for energy, force, and stress readout layers, respectively., defaults to [3,3,3] 41 | :type tail_readout_no_act: list, optional 42 | :return: An AGAT model 43 | :rtype: agat.model.PotentialModel 44 | 45 | .. py:method:: mul(self, TorchTensor) 46 | 47 | Multiply head. 48 | 49 | :param TorchTensor: Input tensor 50 | :type TorchTensor: torch.tensor 51 | :return: Ouput tensor 52 | :rtype: torch.tensor 53 | 54 | 55 | 56 | .. py:method:: div(self, TorchTensor) 57 | 58 | Division head. 59 | 60 | :param TorchTensor: Input tensor 61 | :type TorchTensor: torch.tensor 62 | :return: Ouput tensor 63 | :rtype: torch.tensor 64 | 65 | 66 | 67 | .. py:method:: div(self, TorchTensor) 68 | :no-index: 69 | 70 | Free head. 71 | 72 | :param TorchTensor: Input tensor 73 | :type TorchTensor: torch.tensor 74 | :return: Ouput tensor all ones 75 | :rtype: torch.tensor 76 | 77 | 78 | 79 | 80 | 81 | .. py:method:: get_head_mechanism(self, fn_list, TorchTensor) 82 | 83 | Get attention heads 84 | 85 | :param fn_list: A list of head mechanisms. For example: ['mul', 'div', 'free'] 86 | :type fn_list: list 87 | :param TorchTensor: A PyTorch tensor 88 | :type TorchTensor: torch.Tensor 89 | :return: A new tensor after the transformation. 90 | :rtype: torch.Tensor 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | .. py:method:: forward(self, graph) 100 | 101 | The ``forward`` function of PotentialModel model. 102 | 103 | :param graph: ``DGL.Graph`` 104 | :type graph: ``DGL.Graph`` 105 | :return: 106 | - energy: atomic energy 107 | - force: atomic force 108 | - stress: cell stress tensor 109 | 110 | :rtype: tuple of torch.tensors 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /agat_linux_gpu_cu124.yml: -------------------------------------------------------------------------------- 1 | name: agat 2 | channels: 3 | - pytorch 4 | - dglteam/label/th24_cu124 5 | - nvidia 6 | - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main 7 | - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ 8 | - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 9 | - defaults 10 | dependencies: 11 | - _libgcc_mutex=0.1=main 12 | - _openmp_mutex=5.1=1_gnu 13 | - blas=1.0=mkl 14 | - bottleneck=1.4.2=py311hf4808d0_0 15 | - brotli-python=1.0.9=py311h6a678d5_8 16 | - bzip2=1.0.8=h5eee18b_6 17 | - ca-certificates=2024.11.26=h06a4308_0 18 | - certifi=2024.8.30=py311h06a4308_0 19 | - charset-normalizer=3.3.2=pyhd3eb1b0_0 20 | - cuda-cudart=12.4.127=0 21 | - cuda-cupti=12.4.127=0 22 | - cuda-libraries=12.4.1=0 23 | - cuda-nvrtc=12.4.127=0 24 | - cuda-nvtx=12.4.127=0 25 | - cuda-opencl=12.6.77=0 26 | - cuda-runtime=12.4.1=0 27 | - cuda-version=12.6=3 28 | - dgl=2.4.0.th24.cu124=py311_0 29 | - ffmpeg=4.3=hf484d3e_0 30 | - filelock=3.13.1=py311h06a4308_0 31 | - freetype=2.12.1=h4a9f257_0 32 | - giflib=5.2.2=h5eee18b_0 33 | - gmp=6.2.1=h295c915_3 34 | - gmpy2=2.1.2=py311hc9b5ff0_0 35 | - gnutls=3.6.15=he1e5248_0 36 | - idna=3.7=py311h06a4308_0 37 | - intel-openmp=2023.1.0=hdb19cb5_46306 38 | - jinja2=3.1.4=py311h06a4308_0 39 | - jpeg=9e=h5eee18b_3 40 | - lame=3.100=h7b6447c_0 41 | - lcms2=2.12=h3be6417_0 42 | - ld_impl_linux-64=2.40=h12ee557_0 43 | - lerc=3.0=h295c915_0 44 | - libcublas=12.4.5.8=0 45 | - libcufft=11.2.1.3=0 46 | - libcufile=1.11.1.6=0 47 | - libcurand=10.3.7.77=0 48 | - libcusolver=11.6.1.9=0 49 | - libcusparse=12.3.1.170=0 50 | - libdeflate=1.17=h5eee18b_1 51 | - libffi=3.4.4=h6a678d5_1 52 | - libgcc-ng=11.2.0=h1234567_1 53 | - libgfortran-ng=11.2.0=h00389a5_1 54 | - libgfortran5=11.2.0=h1234567_1 55 | - libgomp=11.2.0=h1234567_1 56 | - libiconv=1.16=h5eee18b_3 57 | - libidn2=2.3.4=h5eee18b_0 58 | - libjpeg-turbo=2.0.0=h9bf148f_0 59 | - libnpp=12.2.5.30=0 60 | - libnvfatbin=12.6.77=0 61 | - libnvjitlink=12.4.127=0 62 | - libnvjpeg=12.3.1.117=0 63 | - libpng=1.6.39=h5eee18b_0 64 | - libstdcxx-ng=11.2.0=h1234567_1 65 | - libtasn1=4.19.0=h5eee18b_0 66 | - libtiff=4.5.1=h6a678d5_0 67 | - libunistring=0.9.10=h27cfd23_0 68 | - libuuid=1.41.5=h5eee18b_0 69 | - libwebp=1.3.2=h11a3e52_0 70 | - libwebp-base=1.3.2=h5eee18b_1 71 | - llvm-openmp=14.0.6=h9e868ea_0 72 | - lz4-c=1.9.4=h6a678d5_1 73 | - markupsafe=2.1.3=py311h5eee18b_0 74 | - mkl=2023.1.0=h213fc3f_46344 75 | - mkl-service=2.4.0=py311h5eee18b_1 76 | - mkl_fft=1.3.10=py311h5eee18b_0 77 | - mkl_random=1.2.7=py311ha02d727_0 78 | - mpc=1.1.0=h10f8cd9_1 79 | - mpfr=4.0.2=hb69a4c5_1 80 | - mpmath=1.3.0=py311h06a4308_0 81 | - ncurses=6.4=h6a678d5_0 82 | - nettle=3.7.3=hbbd107a_1 83 | - networkx=3.3=py311h06a4308_0 84 | - numexpr=2.10.1=py311h3c60e43_0 85 | - numpy=1.26.4=py311h08b1b3b_0 86 | - numpy-base=1.26.4=py311hf175353_0 87 | - openh264=2.1.1=h4ff587b_0 88 | - openjpeg=2.5.2=he7f1fd0_0 89 | - openssl=3.0.15=h5eee18b_0 90 | - pandas=2.2.3=py311h6a678d5_0 91 | - pillow=10.4.0=py311h5eee18b_0 92 | - pip=24.2=py311h06a4308_0 93 | - psutil=5.9.0=py311h5eee18b_0 94 | - pybind11-abi=4=hd3eb1b0_1 95 | - pysocks=1.7.1=py311h06a4308_0 96 | - python=3.11.10=he870216_0 97 | - python-dateutil=2.9.0post0=py311h06a4308_2 98 | - python-tzdata=2023.3=pyhd3eb1b0_0 99 | - pytorch=2.5.0=py3.11_cuda12.4_cudnn9.1.0_0 100 | - pytorch-cuda=12.4=hc786d27_7 101 | - pytorch-mutex=1.0=cuda 102 | - pytz=2024.1=py311h06a4308_0 103 | - pyyaml=6.0.2=py311h5eee18b_0 104 | - readline=8.2=h5eee18b_0 105 | - requests=2.32.3=py311h06a4308_0 106 | - scipy=1.13.1=py311h08b1b3b_0 107 | - setuptools=75.1.0=py311h06a4308_0 108 | - six=1.16.0=pyhd3eb1b0_1 109 | - sqlite=3.45.3=h5eee18b_0 110 | - sympy=1.13.2=py311h06a4308_0 111 | - tbb=2021.8.0=hdb19cb5_0 112 | - tk=8.6.14=h39e8969_0 113 | - torchaudio=2.5.0=py311_cu124 114 | - torchtriton=3.1.0=py311 115 | - torchvision=0.20.0=py311_cu124 116 | - tqdm=4.66.5=py311h92b7b1e_0 117 | - typing_extensions=4.11.0=py311h06a4308_0 118 | - tzdata=2024b=h04d1e81_0 119 | - urllib3=2.2.3=py311h06a4308_0 120 | - wheel=0.44.0=py311h06a4308_0 121 | - xz=5.4.6=h5eee18b_1 122 | - yaml=0.2.5=h7b6447c_0 123 | - zlib=1.2.13=h5eee18b_1 124 | - zstd=1.5.6=hc292b87_0 125 | - pip: 126 | - ase==3.23.0 127 | - contourpy==1.3.0 128 | - cycler==0.12.1 129 | - fonttools==4.54.1 130 | - kiwisolver==1.4.7 131 | - matplotlib==3.9.2 132 | - packaging==24.1 133 | - pyparsing==3.2.0 134 | - agat 135 | 136 | -------------------------------------------------------------------------------- /docs/_static/js/theme.js: -------------------------------------------------------------------------------- 1 | !function(n){var e={};function t(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return n[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=n,t.c=e,t.d=function(n,e,i){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:i})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(i,o,function(e){return n[e]}.bind(null,o));return i},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=0)}([function(n,e,t){t(1),n.exports=t(3)},function(n,e,t){(function(){var e="undefined"!=typeof window?window.jQuery:t(2);n.exports.ThemeNav={navBar:null,win:null,winScroll:!1,winResize:!1,linkScroll:!1,winPosition:0,winHeight:null,docHeight:null,isRunning:!1,enable:function(n){var t=this;void 0===n&&(n=!0),t.isRunning||(t.isRunning=!0,e((function(e){t.init(e),t.reset(),t.win.on("hashchange",t.reset),n&&t.win.on("scroll",(function(){t.linkScroll||t.winScroll||(t.winScroll=!0,requestAnimationFrame((function(){t.onScroll()})))})),t.win.on("resize",(function(){t.winResize||(t.winResize=!0,requestAnimationFrame((function(){t.onResize()})))})),t.onResize()})))},enableSticky:function(){this.enable(!0)},init:function(n){n(document);var e=this;this.navBar=n("div.wy-side-scroll:first"),this.win=n(window),n(document).on("click","[data-toggle='wy-nav-top']",(function(){n("[data-toggle='wy-nav-shift']").toggleClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift")})).on("click",".wy-menu-vertical .current ul li a",(function(){var t=n(this);n("[data-toggle='wy-nav-shift']").removeClass("shift"),n("[data-toggle='rst-versions']").toggleClass("shift"),e.toggleCurrent(t),e.hashChange()})).on("click","[data-toggle='rst-current-version']",(function(){n("[data-toggle='rst-versions']").toggleClass("shift-up")})),n("table.docutils:not(.field-list,.footnote,.citation)").wrap("
"),n("table.docutils.footnote").wrap("
"),n("table.docutils.citation").wrap("
"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each((function(){var t=n(this);expand=n(''),expand.on("click",(function(n){return e.toggleCurrent(t),n.stopPropagation(),!1})),t.prepend(expand)}))},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),t=e.find('[href="'+n+'"]');if(0===t.length){var i=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(t=e.find('[href="#'+i.attr("id")+'"]')).length&&(t=e.find('[href="#"]'))}if(t.length>0){$(".wy-menu-vertical .current").removeClass("current").attr("aria-expanded","false"),t.addClass("current").attr("aria-expanded","true"),t.closest("li.toctree-l1").parent().addClass("current").attr("aria-expanded","true");for(let n=1;n<=10;n++)t.closest("li.toctree-l"+n).addClass("current").attr("aria-expanded","true");t[0].scrollIntoView()}}catch(n){console.log("Error expanding nav for anchor",n)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,t=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(t),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",(function(){this.linkScroll=!1}))},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current").attr("aria-expanded","false"),e.siblings().find("li.current").removeClass("current").attr("aria-expanded","false");var t=e.find("> ul li");t.length&&(t.removeClass("current").attr("aria-expanded","false"),e.toggleClass("current").attr("aria-expanded",(function(n,e){return"true"==e?"false":"true"})))}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:n.exports.ThemeNav,StickyNav:n.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],t=0;t= 0 && 56 | !jQuery(node.parentNode).hasClass(className) && 57 | !jQuery(node.parentNode).hasClass("nohighlight")) { 58 | var span; 59 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); 60 | if (isInSVG) { 61 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); 62 | } else { 63 | span = document.createElement("span"); 64 | span.className = className; 65 | } 66 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 67 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 68 | document.createTextNode(val.substr(pos + text.length)), 69 | node.nextSibling)); 70 | node.nodeValue = val.substr(0, pos); 71 | if (isInSVG) { 72 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); 73 | var bbox = node.parentElement.getBBox(); 74 | rect.x.baseVal.value = bbox.x; 75 | rect.y.baseVal.value = bbox.y; 76 | rect.width.baseVal.value = bbox.width; 77 | rect.height.baseVal.value = bbox.height; 78 | rect.setAttribute('class', className); 79 | addItems.push({ 80 | "parent": node.parentNode, 81 | "target": rect}); 82 | } 83 | } 84 | } 85 | else if (!jQuery(node).is("button, select, textarea")) { 86 | jQuery.each(node.childNodes, function() { 87 | highlight(this, addItems); 88 | }); 89 | } 90 | } 91 | var addItems = []; 92 | var result = this.each(function() { 93 | highlight(this, addItems); 94 | }); 95 | for (var i = 0; i < addItems.length; ++i) { 96 | jQuery(addItems[i].parent).before(addItems[i].target); 97 | } 98 | return result; 99 | }; 100 | 101 | /* 102 | * backward compatibility for jQuery.browser 103 | * This will be supported until firefox bug is fixed. 104 | */ 105 | if (!jQuery.browser) { 106 | jQuery.uaMatch = function(ua) { 107 | ua = ua.toLowerCase(); 108 | 109 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 110 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 111 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 112 | /(msie) ([\w.]+)/.exec(ua) || 113 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 114 | []; 115 | 116 | return { 117 | browser: match[ 1 ] || "", 118 | version: match[ 2 ] || "0" 119 | }; 120 | }; 121 | jQuery.browser = {}; 122 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 123 | } 124 | -------------------------------------------------------------------------------- /docs/sphinx/source/API_Docs/app/ensembles.rst: -------------------------------------------------------------------------------- 1 | ######### 2 | ensembles 3 | ######### 4 | 5 | .. Note:: Modified ``ase.md`` ensembles to deploy the AGAT model. 6 | 7 | Examples of using ensembles: 8 | 9 | .. code-block:: python 10 | 11 | ############################################################################### 12 | # Detect GPU card 13 | ############################################################################### 14 | import torch 15 | if torch.cuda.is_available(): 16 | device='cuda' 17 | print("CUDA is available.") 18 | print(f"Number of GPUs: {torch.cuda.device_count()}") 19 | print(f"GPU Name: {torch.cuda.get_device_name(0)}") 20 | else: 21 | device='cpu' 22 | print("CUDA is NOT available.") 23 | 24 | ############################################################################### 25 | # Modified ASE ensembles for AGAT 26 | ############################################################################### 27 | import dgl 28 | u, v = torch.tensor([0, 0, 0, 1], device=device), torch.tensor([1, 2, 3, 3], 29 | device=device) 30 | g = dgl.graph((u, v), device=device) 31 | print(f'DGL graph device: {g.device}') 32 | 33 | import os 34 | from ase.io import read 35 | from ase import units 36 | from ase.md.npt import NPT 37 | from ase.md import MDLogger 38 | from agat.app.ensembles import ModifiedNPT 39 | from agat.app.calculators import AgatEnsembleCalculator 40 | model_ensemble_dir = os.path.join('potential_models') 41 | graph_build_scheme_dir = os.path.join('potential_models') 42 | atoms = read(os.path.join('potential_models', 'POSCAR')) 43 | calculator=AgatEnsembleCalculator(model_ensemble_dir, graph_build_scheme_dir, 44 | device=device) 45 | atoms.set_calculator(calculator) 46 | 47 | dyn = ModifiedNPT(atoms, 48 | timestep=1.0 * units.fs, 49 | temperature_K=300, 50 | ttime = 25 * units.fs, 51 | pfactor = 75 * units.fs, 52 | externalstress = [0.0] * 6, 53 | mask=[[1,0,0], 54 | [0,1,0], 55 | [0,0,1]], 56 | trajectory=os.path.join('md_NPT.traj')) 57 | 58 | dyn.attach(MDLogger(dyn, atoms, os.path.join('md_NPT.log'), 59 | header=True, 60 | stress=True, 61 | peratom=False, 62 | mode="a"), 63 | interval=1) 64 | 65 | dyn.run(200) 66 | 67 | .. code-block:: python 68 | 69 | 70 | from ase.io import read 71 | from ase import units 72 | from ase import Atoms 73 | from ase.md import MDLogger 74 | from agat.app import AgatCalculator 75 | from agat.app.ensembles import ModifiedNPT 76 | 77 | model_save_dir = 'agat_model' 78 | graph_build_scheme_dir = '.' # location where you can find `graph_build_scheme.json` file. 79 | 80 | atoms = read('POSCAR') 81 | calculator=AgatCalculator(model_save_dir, 82 | graph_build_scheme_dir, device='cpu') 83 | atoms = Atoms(atoms, calculator=calculator) 84 | dyn = ModifiedNPT(atoms, 85 | timestep=1.0 * units.fs, 86 | temperature_K=300, 87 | ttime = 25 * units.fs, 88 | pfactor = 75 * units.fs, 89 | externalstress = [0.0] * 6, 90 | mask=[[1,0,0], 91 | [0,1,0], 92 | [0,0,1]], 93 | trajectory='md_NPT.traj') 94 | 95 | dyn.attach(MDLogger(dyn, atoms, 'md_NPT.log', 96 | header=True, 97 | stress=True, 98 | peratom=False, 99 | mode="a"), 100 | interval=1) 101 | 102 | dyn.run(200) 103 | 104 | 105 | 106 | .. class:: ModifiedNPT(NPT) 107 | 108 | Modified ``ase.md.npt.NPT`` ensemble, which is used for the on-the-fly training of a AGAT ``PotentialModel``. 109 | 110 | 111 | .. Note:: Go to https://ase-lib.org/ase/md.html for more information. 112 | 113 | .. attribute:: classname 114 | 115 | .. code-block:: 116 | 117 | 'ModifiedNPT' 118 | 119 | 120 | .. method:: __init__(self, atoms, timestep, temperature, externalstress, ttime, pfactor, *arg, temperature_K, mask, trajectory, logfile, loginterval, append_trajectory, max_collected_snapshot_num = 500) 121 | 122 | Most arguments can be found at https://ase-lib.org/ase/md.html#constant-npt-simulations-the-isothermal-isobaric-ensemble 123 | 124 | : param max_collected_snapshot_num: The maximum number of collected snashots in a on-the-fly training. Defaults to ``500``. 125 | : type max_collected_snapshot_num: int 126 | 127 | .. method:: run(self, steps) 128 | 129 | Run NPT simulation. 130 | 131 | :param steps: Steps for the MD simulation. 132 | :type steps: int 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /agat/model/layer.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Sep 29 11:04:06 2023 4 | 5 | @author: ZHANG Jun 6 | """ 7 | 8 | import torch 9 | import torch.nn as nn 10 | from dgl import function as fn 11 | from dgl.ops import edge_softmax 12 | 13 | class Layer(nn.Module): 14 | """ 15 | Description: 16 | ---------- 17 | Single graph attention network for crystal. 18 | Parameters 19 | ---------- 20 | in_dim: int 21 | Depth of node representation in the input of each head of this `GAT` layer. 22 | out_dim: int 23 | Depth of node representation in the output of each head of this `GAT` layer. 24 | bias: Boolean 25 | Whether the dense layer uses a bias vector. 26 | negative_slope: float 27 | Negative slope coefficient 28 | 29 | 30 | Meaning of abbreviations: 31 | ---------- 32 | dist: 33 | distance matrix 34 | feat: 35 | features 36 | ft: 37 | features 38 | src: 39 | source node 40 | dst: 41 | destination node 42 | e: 43 | raw e_i_j: refer to: https://arxiv.org/abs/1710.10903 44 | a: 45 | alpha_i_j: refer to: https://arxiv.org/abs/1710.10903 46 | att: 47 | attention mechanism 48 | act: 49 | activation function 50 | """ 51 | 52 | def __init__(self, 53 | in_dim, 54 | out_dim, 55 | num_heads, 56 | device='cuda', 57 | bias=True, 58 | negative_slope=0.2): 59 | super(Layer, self).__init__() 60 | # input args 61 | self.in_dim = in_dim 62 | self.out_dim = out_dim 63 | self.num_heads = num_heads 64 | self.device = device 65 | self.bias = bias 66 | self.negative_slope = negative_slope 67 | 68 | # initialize trainable parameters 69 | self.w_att_src = nn.Parameter(torch.randn(1, self.num_heads, self.out_dim, device=self.device)) 70 | self.w_att_dst = nn.Parameter(torch.randn(1, self.num_heads, self.out_dim, device=self.device)) 71 | 72 | # dense layers 73 | self.layer = nn.Linear(self.in_dim, self.out_dim*self.num_heads, bias=self.bias, device=self.device) 74 | self.leaky_relu1 = nn.LeakyReLU(negative_slope=self.negative_slope) 75 | 76 | # leaky relu function 77 | self.leaky_relu2 = nn.LeakyReLU(negative_slope=self.negative_slope) 78 | 79 | def forward(self, feat, dist, graph): # feat with shape of (number of nodes, number of features of each node). The graph can have no values of nodes. 80 | """ 81 | Description: 82 | ---------- 83 | Forward this `GAT` layer. 84 | Parameters 85 | ---------- 86 | feat: `torch.Tensor` 87 | Input features of all nodes (atoms). 88 | graph: `DGLGraph` 89 | A graph built with DGL. 90 | """ 91 | feat_src = feat_dst = self.leaky_relu1(self.layer(feat)) 92 | 93 | # attention 94 | feat_src = torch.reshape(feat_src, (-1, self.num_heads, self.out_dim)) # shape: (number of nodes, number of heads, num out) 95 | feat_dst = torch.reshape(feat_dst, (-1, self.num_heads, self.out_dim)) # shape: (number of nodes, number of heads, num out) 96 | 97 | # shape of e_src and e_dst after `torch.sum`: (number of nodes, number of heads, 1) 98 | e_src = torch.sum(feat_src * self.w_att_src, axis=-1, keepdim=True) 99 | e_dst = torch.sum(feat_dst * self.w_att_dst, axis=-1, keepdim=True) 100 | 101 | # save on nodes 102 | graph.srcdata.update({'ft': feat_src, 'e_src': e_src}) 103 | graph.dstdata.update({'e_dst': e_dst}) 104 | 105 | # save on edges 106 | graph.apply_edges(fn.u_add_v('e_src', 'e_dst', 'e')) # shape of e: (number of edges, number of heads, 1) # similar to the original paper, but feed to dense first, summation is the second. 107 | e = self.leaky_relu2(graph.edata.pop('e')) # shape of e: (number of edges, number of heads, 1) 108 | 109 | dist = torch.reshape(dist, (-1, self.num_heads, 1)) 110 | graph.edata['a'] = edge_softmax(graph, e) * dist # shape of a: (number of edges, number of heads, 1) # shape of dist: (number of edges, number of heads, 1) 111 | 112 | graph.update_all(fn.u_mul_e('ft', 'a', 'm'), fn.sum('m', 'ft')) # shape of ft: (number of nodes, number of heads, number of out) 113 | dst = torch.reshape(graph.ndata['ft'], (-1, self.num_heads * self.out_dim)) # shape of `en`: (number of nodes, number of heads * number of out) 114 | return dst # node_energy, node_force 115 | 116 | if __name__ == '__main__': 117 | import dgl 118 | g_list, l_list = dgl.load_graphs('all_graphs.bin') 119 | graph = g_list[1].to('cuda') 120 | feat = graph.ndata['h'] 121 | dist = graph.edata['dist'] 122 | 123 | GL = Layer(6, 10, 2, device='cuda') 124 | out = GL.forward(feat, dist, graph) 125 | -------------------------------------------------------------------------------- /docs/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Base JavaScript utilities for all Sphinx HTML documentation. 3 | */ 4 | "use strict"; 5 | 6 | const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ 7 | "TEXTAREA", 8 | "INPUT", 9 | "SELECT", 10 | "BUTTON", 11 | ]); 12 | 13 | const _ready = (callback) => { 14 | if (document.readyState !== "loading") { 15 | callback(); 16 | } else { 17 | document.addEventListener("DOMContentLoaded", callback); 18 | } 19 | }; 20 | 21 | /** 22 | * Small JavaScript module for the documentation. 23 | */ 24 | const Documentation = { 25 | init: () => { 26 | Documentation.initDomainIndexTable(); 27 | Documentation.initOnKeyListeners(); 28 | }, 29 | 30 | /** 31 | * i18n support 32 | */ 33 | TRANSLATIONS: {}, 34 | PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), 35 | LOCALE: "unknown", 36 | 37 | // gettext and ngettext don't access this so that the functions 38 | // can safely bound to a different name (_ = Documentation.gettext) 39 | gettext: (string) => { 40 | const translated = Documentation.TRANSLATIONS[string]; 41 | switch (typeof translated) { 42 | case "undefined": 43 | return string; // no translation 44 | case "string": 45 | return translated; // translation exists 46 | default: 47 | return translated[0]; // (singular, plural) translation tuple exists 48 | } 49 | }, 50 | 51 | ngettext: (singular, plural, n) => { 52 | const translated = Documentation.TRANSLATIONS[singular]; 53 | if (typeof translated !== "undefined") 54 | return translated[Documentation.PLURAL_EXPR(n)]; 55 | return n === 1 ? singular : plural; 56 | }, 57 | 58 | addTranslations: (catalog) => { 59 | Object.assign(Documentation.TRANSLATIONS, catalog.messages); 60 | Documentation.PLURAL_EXPR = new Function( 61 | "n", 62 | `return (${catalog.plural_expr})` 63 | ); 64 | Documentation.LOCALE = catalog.locale; 65 | }, 66 | 67 | /** 68 | * helper function to focus on search bar 69 | */ 70 | focusSearchBar: () => { 71 | document.querySelectorAll("input[name=q]")[0]?.focus(); 72 | }, 73 | 74 | /** 75 | * Initialise the domain index toggle buttons 76 | */ 77 | initDomainIndexTable: () => { 78 | const toggler = (el) => { 79 | const idNumber = el.id.substr(7); 80 | const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); 81 | if (el.src.substr(-9) === "minus.png") { 82 | el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; 83 | toggledRows.forEach((el) => (el.style.display = "none")); 84 | } else { 85 | el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; 86 | toggledRows.forEach((el) => (el.style.display = "")); 87 | } 88 | }; 89 | 90 | const togglerElements = document.querySelectorAll("img.toggler"); 91 | togglerElements.forEach((el) => 92 | el.addEventListener("click", (event) => toggler(event.currentTarget)) 93 | ); 94 | togglerElements.forEach((el) => (el.style.display = "")); 95 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); 96 | }, 97 | 98 | initOnKeyListeners: () => { 99 | // only install a listener if it is really needed 100 | if ( 101 | !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && 102 | !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS 103 | ) 104 | return; 105 | 106 | document.addEventListener("keydown", (event) => { 107 | // bail for input elements 108 | if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; 109 | // bail with special keys 110 | if (event.altKey || event.ctrlKey || event.metaKey) return; 111 | 112 | if (!event.shiftKey) { 113 | switch (event.key) { 114 | case "ArrowLeft": 115 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 116 | 117 | const prevLink = document.querySelector('link[rel="prev"]'); 118 | if (prevLink && prevLink.href) { 119 | window.location.href = prevLink.href; 120 | event.preventDefault(); 121 | } 122 | break; 123 | case "ArrowRight": 124 | if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; 125 | 126 | const nextLink = document.querySelector('link[rel="next"]'); 127 | if (nextLink && nextLink.href) { 128 | window.location.href = nextLink.href; 129 | event.preventDefault(); 130 | } 131 | break; 132 | } 133 | } 134 | 135 | // some keyboard layouts may need Shift to get / 136 | switch (event.key) { 137 | case "/": 138 | if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; 139 | Documentation.focusSearchBar(); 140 | event.preventDefault(); 141 | } 142 | }); 143 | }, 144 | }; 145 | 146 | // quick alias for translations 147 | const _ = Documentation.gettext; 148 | 149 | _ready(Documentation.init); 150 | -------------------------------------------------------------------------------- /Customized_installation.md: -------------------------------------------------------------------------------- 1 | 2 | # Customized installation of AGAT environment 3 | 4 | Examined dependency compatibility: 5 | 6 | | OS | Python | DGL | PyTorch | numpy | ASE | CUDA | MKL | 7 | | ----------- | --------- | ----- | ------- | ----- | ------ | ---- | ------ | 8 | | Windows CPU | 3.10/3.12 | 2.2.1 | 2.3.0 | 2.0.1 | 3.23.0 | - | | 9 | | Linux GPU | 3.12 | 2.4.0 | 2.4.1 | 2.1.3 | 3.23.0 | 12.4 | 2024.0 | 10 | 11 | 12 | 13 | ## Install with [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) environment on Linux. 14 | 15 | Environmental variables may lead to errors, check your `~/.bashrc` file first. 16 | 17 | - Create a new environment 18 | 19 | ```bash 20 | conda create -n agat python==3.12 21 | ``` 22 | 23 | 24 | 25 | - Activate the environment 26 | 27 | ```bash 28 | conda activate agat 29 | ``` 30 | 31 | 32 | 33 | - Install [PyTorch](https://pytorch.org/), 34 | Navigate to the [installation page](https://pytorch.org/get-started/locally/#start-locally) and choose your platform. You may need [previous versions](https://pytorch.org/get-started/previous-versions/). For example (GPU): 35 | 36 | ```bash 37 | pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu124 # recommended 38 | ``` 39 | 40 | or 41 | 42 | ```bash 43 | conda install pytorch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 pytorch-cuda=12.4 -c pytorch -c nvidia # not recommended. 44 | ``` 45 | 46 | 47 | 48 | - You may need to downgrade the `MKL` package [optional]: 49 | 50 | ```bash 51 | conda install -c https://software.repos.intel.com/python/conda/ -c conda-forge mkl==2024.0 52 | ``` 53 | 54 | 55 | 56 | - Install [dgl](https://www.dgl.ai/). 57 | Please navigate to the [Get Started](https://www.dgl.ai/pages/start.html) page of [dgl](https://www.dgl.ai/). For example (GPU): 58 | 59 | ```bash 60 | conda install -c dglteam/label/th24_cu124 dgl # recommended 61 | ``` 62 | 63 | or 64 | 65 | ```bash 66 | pip install dgl -f https://data.dgl.ai/wheels/cu124/repo.html 67 | ``` 68 | 69 | **Note:** `DGL` requires these packages: `pip install packaging pandas pydantic pyyaml` 70 | 71 | 72 | 73 | - Install AGAT package 74 | 75 | ```bash 76 | pip install agat 77 | ``` 78 | 79 | 80 | 81 | - Install CUDA and CUDNN [**Optional**]. 82 | 83 | - For HPC with Linux OS, you may load CUDA by checking `module av`, or you can contact your administrator for help. 84 | - Or download manually: 85 | - [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) 86 | - [cuDNN](https://developer.nvidia.com/cudnn) 87 | 88 | 89 | 90 | - Install other dependencies, such as `pandas`. 91 | 92 | 93 | 94 | ### Install with [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) environment on Windows. 95 | 96 | The `DGL` package has limited compatibility with Windows, particularly for CUDA versions. You are highly recommended to use the CPU version on Windows. 97 | 98 | - Create a new environment 99 | ```console 100 | conda create -n agat python==3.10 101 | ``` 102 | 103 | - Activate the environment 104 | ```console 105 | conda activate agat 106 | ``` 107 | 108 | - Install [PyTorch](https://pytorch.org/), 109 | Navigate to the [installation page](https://pytorch.org/get-started/locally/#start-locally) and choose your platform. 110 | For example (GPU): 111 | 112 | ```console 113 | conda install pytorch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 cpuonly -c pytorch 114 | ``` 115 | 116 | - Install packaging: `pip install packaging` 117 | 118 | - Install [dgl](https://www.dgl.ai/). 119 | 120 | ```console 121 | 122 | ``` 123 | 124 | - Install ASE: `pip install ase`. 125 | 126 | - Install AGAT package 127 | 128 | ```console 129 | pip install agat 130 | ``` 131 | 132 | 133 | 134 | ### Check installation 135 | 136 | ```python 137 | import torch 138 | print('GPU avaliability:', torch.cuda.is_available()) 139 | print('Number of GPU cards:', torch.cuda.device_count()) 140 | if torch.cuda.is_available(): 141 | print('Current GPU device:', torch.cuda.current_device()) 142 | print('First device localtion:', torch.cuda.device(0)) 143 | print('First device name:', torch.cuda.get_device_name(0)) 144 | 145 | import dgl 146 | if torch.cuda.is_available(): 147 | device = torch.device('cuda') 148 | else: 149 | device = torch.device('cpu') 150 | u, v = torch.tensor([0, 1, 2]), torch.tensor([2, 3, 4]) 151 | g = dgl.graph((u, v)) 152 | g.ndata['x'] = torch.randn(5, 3) # original feature is on CPU 153 | print(g.device) 154 | cuda_g = g.to(device) # accepts any device objects from backend framework 155 | print(cuda_g.device) 156 | print(cuda_g.ndata['x'].device) # feature data is copied to GPU too 157 | 158 | # A graph constructed from GPU tensors is also on GPU 159 | u, v = u.to(device), v.to(device) 160 | g = dgl.graph((u, v)) 161 | print(g.device) 162 | ``` 163 | 164 | -------------------------------------------------------------------------------- /docs/_static/pygments.css: -------------------------------------------------------------------------------- 1 | pre { line-height: 125%; } 2 | td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 3 | span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 4 | td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 5 | span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 6 | .highlight .hll { background-color: #ffffcc } 7 | .highlight { background: #f8f8f8; } 8 | .highlight .c { color: #3D7B7B; font-style: italic } /* Comment */ 9 | .highlight .err { border: 1px solid #F00 } /* Error */ 10 | .highlight .k { color: #008000; font-weight: bold } /* Keyword */ 11 | .highlight .o { color: #666 } /* Operator */ 12 | .highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #9C6500 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ 18 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 19 | .highlight .ge { font-style: italic } /* Generic.Emph */ 20 | .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ 21 | .highlight .gr { color: #E40000 } /* Generic.Error */ 22 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 23 | .highlight .gi { color: #008400 } /* Generic.Inserted */ 24 | .highlight .go { color: #717171 } /* Generic.Output */ 25 | .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 26 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 27 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 28 | .highlight .gt { color: #04D } /* Generic.Traceback */ 29 | .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ 30 | .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ 31 | .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ 32 | .highlight .kp { color: #008000 } /* Keyword.Pseudo */ 33 | .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ 34 | .highlight .kt { color: #B00040 } /* Keyword.Type */ 35 | .highlight .m { color: #666 } /* Literal.Number */ 36 | .highlight .s { color: #BA2121 } /* Literal.String */ 37 | .highlight .na { color: #687822 } /* Name.Attribute */ 38 | .highlight .nb { color: #008000 } /* Name.Builtin */ 39 | .highlight .nc { color: #00F; font-weight: bold } /* Name.Class */ 40 | .highlight .no { color: #800 } /* Name.Constant */ 41 | .highlight .nd { color: #A2F } /* Name.Decorator */ 42 | .highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */ 43 | .highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */ 44 | .highlight .nf { color: #00F } /* Name.Function */ 45 | .highlight .nl { color: #767600 } /* Name.Label */ 46 | .highlight .nn { color: #00F; font-weight: bold } /* Name.Namespace */ 47 | .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ 48 | .highlight .nv { color: #19177C } /* Name.Variable */ 49 | .highlight .ow { color: #A2F; font-weight: bold } /* Operator.Word */ 50 | .highlight .w { color: #BBB } /* Text.Whitespace */ 51 | .highlight .mb { color: #666 } /* Literal.Number.Bin */ 52 | .highlight .mf { color: #666 } /* Literal.Number.Float */ 53 | .highlight .mh { color: #666 } /* Literal.Number.Hex */ 54 | .highlight .mi { color: #666 } /* Literal.Number.Integer */ 55 | .highlight .mo { color: #666 } /* Literal.Number.Oct */ 56 | .highlight .sa { color: #BA2121 } /* Literal.String.Affix */ 57 | .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ 58 | .highlight .sc { color: #BA2121 } /* Literal.String.Char */ 59 | .highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */ 60 | .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ 61 | .highlight .s2 { color: #BA2121 } /* Literal.String.Double */ 62 | .highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */ 63 | .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ 64 | .highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */ 65 | .highlight .sx { color: #008000 } /* Literal.String.Other */ 66 | .highlight .sr { color: #A45A77 } /* Literal.String.Regex */ 67 | .highlight .s1 { color: #BA2121 } /* Literal.String.Single */ 68 | .highlight .ss { color: #19177C } /* Literal.String.Symbol */ 69 | .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ 70 | .highlight .fm { color: #00F } /* Name.Function.Magic */ 71 | .highlight .vc { color: #19177C } /* Name.Variable.Class */ 72 | .highlight .vg { color: #19177C } /* Name.Variable.Global */ 73 | .highlight .vi { color: #19177C } /* Name.Variable.Instance */ 74 | .highlight .vm { color: #19177C } /* Name.Variable.Magic */ 75 | .highlight .il { color: #666 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/_static/language_data.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This script contains the language-specific data used by searchtools.js, 3 | * namely the list of stopwords, stemmer, scorer and splitter. 4 | */ 5 | 6 | var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; 7 | 8 | 9 | /* Non-minified version is copied as a separate JS file, if available */ 10 | 11 | /** 12 | * Porter Stemmer 13 | */ 14 | var Stemmer = function() { 15 | 16 | var step2list = { 17 | ational: 'ate', 18 | tional: 'tion', 19 | enci: 'ence', 20 | anci: 'ance', 21 | izer: 'ize', 22 | bli: 'ble', 23 | alli: 'al', 24 | entli: 'ent', 25 | eli: 'e', 26 | ousli: 'ous', 27 | ization: 'ize', 28 | ation: 'ate', 29 | ator: 'ate', 30 | alism: 'al', 31 | iveness: 'ive', 32 | fulness: 'ful', 33 | ousness: 'ous', 34 | aliti: 'al', 35 | iviti: 'ive', 36 | biliti: 'ble', 37 | logi: 'log' 38 | }; 39 | 40 | var step3list = { 41 | icate: 'ic', 42 | ative: '', 43 | alize: 'al', 44 | iciti: 'ic', 45 | ical: 'ic', 46 | ful: '', 47 | ness: '' 48 | }; 49 | 50 | var c = "[^aeiou]"; // consonant 51 | var v = "[aeiouy]"; // vowel 52 | var C = c + "[^aeiouy]*"; // consonant sequence 53 | var V = v + "[aeiou]*"; // vowel sequence 54 | 55 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 56 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 57 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 58 | var s_v = "^(" + C + ")?" + v; // vowel in stem 59 | 60 | this.stemWord = function (w) { 61 | var stem; 62 | var suffix; 63 | var firstch; 64 | var origword = w; 65 | 66 | if (w.length < 3) 67 | return w; 68 | 69 | var re; 70 | var re2; 71 | var re3; 72 | var re4; 73 | 74 | firstch = w.substr(0,1); 75 | if (firstch == "y") 76 | w = firstch.toUpperCase() + w.substr(1); 77 | 78 | // Step 1a 79 | re = /^(.+?)(ss|i)es$/; 80 | re2 = /^(.+?)([^s])s$/; 81 | 82 | if (re.test(w)) 83 | w = w.replace(re,"$1$2"); 84 | else if (re2.test(w)) 85 | w = w.replace(re2,"$1$2"); 86 | 87 | // Step 1b 88 | re = /^(.+?)eed$/; 89 | re2 = /^(.+?)(ed|ing)$/; 90 | if (re.test(w)) { 91 | var fp = re.exec(w); 92 | re = new RegExp(mgr0); 93 | if (re.test(fp[1])) { 94 | re = /.$/; 95 | w = w.replace(re,""); 96 | } 97 | } 98 | else if (re2.test(w)) { 99 | var fp = re2.exec(w); 100 | stem = fp[1]; 101 | re2 = new RegExp(s_v); 102 | if (re2.test(stem)) { 103 | w = stem; 104 | re2 = /(at|bl|iz)$/; 105 | re3 = new RegExp("([^aeiouylsz])\\1$"); 106 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 107 | if (re2.test(w)) 108 | w = w + "e"; 109 | else if (re3.test(w)) { 110 | re = /.$/; 111 | w = w.replace(re,""); 112 | } 113 | else if (re4.test(w)) 114 | w = w + "e"; 115 | } 116 | } 117 | 118 | // Step 1c 119 | re = /^(.+?)y$/; 120 | if (re.test(w)) { 121 | var fp = re.exec(w); 122 | stem = fp[1]; 123 | re = new RegExp(s_v); 124 | if (re.test(stem)) 125 | w = stem + "i"; 126 | } 127 | 128 | // Step 2 129 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 130 | if (re.test(w)) { 131 | var fp = re.exec(w); 132 | stem = fp[1]; 133 | suffix = fp[2]; 134 | re = new RegExp(mgr0); 135 | if (re.test(stem)) 136 | w = stem + step2list[suffix]; 137 | } 138 | 139 | // Step 3 140 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 141 | if (re.test(w)) { 142 | var fp = re.exec(w); 143 | stem = fp[1]; 144 | suffix = fp[2]; 145 | re = new RegExp(mgr0); 146 | if (re.test(stem)) 147 | w = stem + step3list[suffix]; 148 | } 149 | 150 | // Step 4 151 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 152 | re2 = /^(.+?)(s|t)(ion)$/; 153 | if (re.test(w)) { 154 | var fp = re.exec(w); 155 | stem = fp[1]; 156 | re = new RegExp(mgr1); 157 | if (re.test(stem)) 158 | w = stem; 159 | } 160 | else if (re2.test(w)) { 161 | var fp = re2.exec(w); 162 | stem = fp[1] + fp[2]; 163 | re2 = new RegExp(mgr1); 164 | if (re2.test(stem)) 165 | w = stem; 166 | } 167 | 168 | // Step 5 169 | re = /^(.+?)e$/; 170 | if (re.test(w)) { 171 | var fp = re.exec(w); 172 | stem = fp[1]; 173 | re = new RegExp(mgr1); 174 | re2 = new RegExp(meq1); 175 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 176 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 177 | w = stem; 178 | } 179 | re = /ll$/; 180 | re2 = new RegExp(mgr1); 181 | if (re.test(w) && re2.test(w)) { 182 | re = /.$/; 183 | w = w.replace(re,""); 184 | } 185 | 186 | // and turn initial Y back to y 187 | if (firstch == "y") 188 | w = firstch.toLowerCase() + w.substr(1); 189 | return w; 190 | } 191 | } 192 | 193 | --------------------------------------------------------------------------------