mpdd-alignn 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. mpdd-alignn-1.0.0/.github/workflows/publishToPyPI.yaml +50 -0
  2. mpdd-alignn-1.0.0/.gitignore +135 -0
  3. mpdd-alignn-1.0.0/LICENSE.md +49 -0
  4. mpdd-alignn-1.0.0/MANIFEST.in +3 -0
  5. mpdd-alignn-1.0.0/PKG-INFO +114 -0
  6. mpdd-alignn-1.0.0/README.md +66 -0
  7. mpdd-alignn-1.0.0/alignn/__init__.py +2 -0
  8. mpdd-alignn-1.0.0/alignn/cli.py +73 -0
  9. mpdd-alignn-1.0.0/alignn/config.py +243 -0
  10. mpdd-alignn-1.0.0/alignn/config.yaml +29 -0
  11. mpdd-alignn-1.0.0/alignn/data.py +624 -0
  12. mpdd-alignn-1.0.0/alignn/examples/sample_data/POSCAR-JVASP-10.vasp +11 -0
  13. mpdd-alignn-1.0.0/alignn/ff/__init__.py +1 -0
  14. mpdd-alignn-1.0.0/alignn/ff/ff.py +1582 -0
  15. mpdd-alignn-1.0.0/alignn/graphs.py +957 -0
  16. mpdd-alignn-1.0.0/alignn/models/__init__.py +7 -0
  17. mpdd-alignn-1.0.0/alignn/models/alignn.py +352 -0
  18. mpdd-alignn-1.0.0/alignn/models/alignn_atomwise.py +552 -0
  19. mpdd-alignn-1.0.0/alignn/models/alignn_cgcnn.py +313 -0
  20. mpdd-alignn-1.0.0/alignn/models/alignn_layernorm.py +300 -0
  21. mpdd-alignn-1.0.0/alignn/models/dense_alignn.py +509 -0
  22. mpdd-alignn-1.0.0/alignn/models/densegcn.py +137 -0
  23. mpdd-alignn-1.0.0/alignn/models/gcn.py +64 -0
  24. mpdd-alignn-1.0.0/alignn/models/icgcnn.py +299 -0
  25. mpdd-alignn-1.0.0/alignn/models/modified_cgcnn.py +357 -0
  26. mpdd-alignn-1.0.0/alignn/models/utils.py +42 -0
  27. mpdd-alignn-1.0.0/alignn/pretrained.py +507 -0
  28. mpdd-alignn-1.0.0/alignn/profile.py +83 -0
  29. mpdd-alignn-1.0.0/alignn/run_alignn_ff.py +257 -0
  30. mpdd-alignn-1.0.0/alignn/scripts/__init__.py +1 -0
  31. mpdd-alignn-1.0.0/alignn/scripts/alignn_evac.py +137 -0
  32. mpdd-alignn-1.0.0/alignn/scripts/all_train_cgcnn.py +73 -0
  33. mpdd-alignn-1.0.0/alignn/scripts/compare_cfid.py +134 -0
  34. mpdd-alignn-1.0.0/alignn/scripts/cubic_mat_relax.py +55 -0
  35. mpdd-alignn-1.0.0/alignn/scripts/data_1.json +1 -0
  36. mpdd-alignn-1.0.0/alignn/scripts/dataset_props.json +44 -0
  37. mpdd-alignn-1.0.0/alignn/scripts/defect.py +74 -0
  38. mpdd-alignn-1.0.0/alignn/scripts/early_stopping_checker.py +50 -0
  39. mpdd-alignn-1.0.0/alignn/scripts/ev_curve.py +212 -0
  40. mpdd-alignn-1.0.0/alignn/scripts/ev_curve_comp.py +64 -0
  41. mpdd-alignn-1.0.0/alignn/scripts/final_model.py +58 -0
  42. mpdd-alignn-1.0.0/alignn/scripts/graph_viz.py +13 -0
  43. mpdd-alignn-1.0.0/alignn/scripts/make_test_split_cross_pred.py +75 -0
  44. mpdd-alignn-1.0.0/alignn/scripts/plot_ff_results.py +163 -0
  45. mpdd-alignn-1.0.0/alignn/scripts/plot_phonons_ff.py +61 -0
  46. mpdd-alignn-1.0.0/alignn/scripts/predict.py +52 -0
  47. mpdd-alignn-1.0.0/alignn/scripts/predict_db.py +83 -0
  48. mpdd-alignn-1.0.0/alignn/scripts/predict_db_all.py +111 -0
  49. mpdd-alignn-1.0.0/alignn/scripts/train_all_hmof.py +49 -0
  50. mpdd-alignn-1.0.0/alignn/scripts/train_all_hpov.py +49 -0
  51. mpdd-alignn-1.0.0/alignn/scripts/train_all_jv.py +71 -0
  52. mpdd-alignn-1.0.0/alignn/scripts/train_all_jv_class.py +70 -0
  53. mpdd-alignn-1.0.0/alignn/scripts/train_all_jv_dal.py +72 -0
  54. mpdd-alignn-1.0.0/alignn/scripts/train_all_mp.py +50 -0
  55. mpdd-alignn-1.0.0/alignn/scripts/train_all_oqmd.py +51 -0
  56. mpdd-alignn-1.0.0/alignn/scripts/train_all_pdbbind.py +44 -0
  57. mpdd-alignn-1.0.0/alignn/scripts/train_all_qetb.py +52 -0
  58. mpdd-alignn-1.0.0/alignn/scripts/train_all_qm9_jctc.py +56 -0
  59. mpdd-alignn-1.0.0/alignn/scripts/train_all_qmof.py +51 -0
  60. mpdd-alignn-1.0.0/alignn/scripts/train_cgcnn_repo.py +66 -0
  61. mpdd-alignn-1.0.0/alignn/scripts/train_edos_pdos.py +44 -0
  62. mpdd-alignn-1.0.0/alignn/scripts/train_megnet.py +150 -0
  63. mpdd-alignn-1.0.0/alignn/tests/test_alignn_ff.py +63 -0
  64. mpdd-alignn-1.0.0/alignn/tests/test_force_reduction.py +271 -0
  65. mpdd-alignn-1.0.0/alignn/tests/test_prop.py +319 -0
  66. mpdd-alignn-1.0.0/alignn/train.py +1290 -0
  67. mpdd-alignn-1.0.0/alignn/train_folder.py +244 -0
  68. mpdd-alignn-1.0.0/alignn/train_folder_ff.py +356 -0
  69. mpdd-alignn-1.0.0/alignn/train_props.py +181 -0
  70. mpdd-alignn-1.0.0/alignn/utils.py +44 -0
  71. mpdd-alignn-1.0.0/example.SigmaPhase/0-Cr8Fe18Ni4.POSCAR +38 -0
  72. mpdd-alignn-1.0.0/example.SigmaPhase/1-Cr16Fe8Ni6.POSCAR +38 -0
  73. mpdd-alignn-1.0.0/example.SigmaPhase/10-Ce4Ti4O12.POSCAR +28 -0
  74. mpdd-alignn-1.0.0/example.SigmaPhase/11-Fe10Ni20.POSCAR +38 -0
  75. mpdd-alignn-1.0.0/example.SigmaPhase/12-Gd4Cr4O12.POSCAR +28 -0
  76. mpdd-alignn-1.0.0/example.SigmaPhase/13-Fe16Ni14.POSCAR +38 -0
  77. mpdd-alignn-1.0.0/example.SigmaPhase/14-Fe24Ni6.POSCAR +38 -0
  78. mpdd-alignn-1.0.0/example.SigmaPhase/15-Ta4Tl4O12.POSCAR +28 -0
  79. mpdd-alignn-1.0.0/example.SigmaPhase/16-Fe18Ni12.POSCAR +38 -0
  80. mpdd-alignn-1.0.0/example.SigmaPhase/17-Pr4Ga4O12.POSCAR +28 -0
  81. mpdd-alignn-1.0.0/example.SigmaPhase/18-Fe28Ni2.POSCAR +38 -0
  82. mpdd-alignn-1.0.0/example.SigmaPhase/19-Fe4Ni26.POSCAR +38 -0
  83. mpdd-alignn-1.0.0/example.SigmaPhase/2-Fe8Ni22.POSCAR +38 -0
  84. mpdd-alignn-1.0.0/example.SigmaPhase/20-Fe8Ni22.POSCAR +38 -0
  85. mpdd-alignn-1.0.0/example.SigmaPhase/21-Fe10Ni20.POSCAR +38 -0
  86. mpdd-alignn-1.0.0/example.SigmaPhase/22-Fe10Ni20.POSCAR +38 -0
  87. mpdd-alignn-1.0.0/example.SigmaPhase/23-Fe12Ni18.POSCAR +38 -0
  88. mpdd-alignn-1.0.0/example.SigmaPhase/24-Fe16Ni14.POSCAR +38 -0
  89. mpdd-alignn-1.0.0/example.SigmaPhase/25-Fe12Ni18.POSCAR +38 -0
  90. mpdd-alignn-1.0.0/example.SigmaPhase/26-Fe8Ni22.POSCAR +38 -0
  91. mpdd-alignn-1.0.0/example.SigmaPhase/27-Cr28Fe2.POSCAR +38 -0
  92. mpdd-alignn-1.0.0/example.SigmaPhase/28-Fe26Ni4.POSCAR +38 -0
  93. mpdd-alignn-1.0.0/example.SigmaPhase/29-Fe12Ni18.POSCAR +38 -0
  94. mpdd-alignn-1.0.0/example.SigmaPhase/3-Cr18Fe12.POSCAR +38 -0
  95. mpdd-alignn-1.0.0/example.SigmaPhase/30-Cr26Fe4.POSCAR +38 -0
  96. mpdd-alignn-1.0.0/example.SigmaPhase/4-Fe30.POSCAR +38 -0
  97. mpdd-alignn-1.0.0/example.SigmaPhase/5-Cr22Fe8.POSCAR +38 -0
  98. mpdd-alignn-1.0.0/example.SigmaPhase/6-Fe2Ni28.POSCAR +38 -0
  99. mpdd-alignn-1.0.0/example.SigmaPhase/7-Cr18Fe12.POSCAR +38 -0
  100. mpdd-alignn-1.0.0/example.SigmaPhase/8-Cr2Fe16Ni12.POSCAR +38 -0
  101. mpdd-alignn-1.0.0/example.SigmaPhase/9-Pb8O12.POSCAR +28 -0
  102. mpdd-alignn-1.0.0/mpdd_alignn.egg-info/PKG-INFO +114 -0
  103. mpdd-alignn-1.0.0/mpdd_alignn.egg-info/SOURCES.txt +108 -0
  104. mpdd-alignn-1.0.0/mpdd_alignn.egg-info/dependency_links.txt +1 -0
  105. mpdd-alignn-1.0.0/mpdd_alignn.egg-info/requires.txt +22 -0
  106. mpdd-alignn-1.0.0/mpdd_alignn.egg-info/top_level.txt +1 -0
  107. mpdd-alignn-1.0.0/pyproject.toml +62 -0
  108. mpdd-alignn-1.0.0/quickstart.ipynb +442 -0
  109. mpdd-alignn-1.0.0/setup.cfg +4 -0
  110. mpdd-alignn-1.0.0/setup.py.backup +63 -0
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "**"
7
+
8
+ jobs:
9
+ release-build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-python@v4
16
+ with:
17
+ python-version: "3.10"
18
+
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install build
23
+
24
+ - name: build release distributions
25
+ run: |
26
+ python -m build
27
+
28
+ - name: upload dists
29
+ uses: actions/upload-artifact@v4
30
+ with:
31
+ name: release-dists
32
+ path: dist/
33
+
34
+ pypi-publish:
35
+ runs-on: ubuntu-latest
36
+ needs:
37
+ - release-build
38
+ permissions:
39
+ id-token: write
40
+
41
+ steps:
42
+ - name: Retrieve release distributions
43
+ uses: actions/download-artifact@v4
44
+ with:
45
+ name: release-dists
46
+ path: dist/
47
+
48
+ - name: Publish release distributions to PyPI
49
+ uses: pypa/gh-action-pypi-publish@release/v1
50
+
@@ -0,0 +1,135 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ graphs/**
7
+ mpddtest/**
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ pip-wheel-metadata/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+
126
+ # mypy
127
+ .mypy_cache/
128
+ .dmypy.json
129
+ dmypy.json
130
+
131
+ # Pyre type checker
132
+ .pyre/
133
+
134
+ # MacOS finder
135
+ .DS_Store
@@ -0,0 +1,49 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Adam M. Krajewski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Copyright (c) National Institute of Standards and Technology (NIST)
24
+
25
+ This software was developed by employees of the [National Institute of
26
+ Standards and Technology (NIST)](http://www.nist.gov/), an agency of the
27
+ Federal Government and is being made available as a public service. Pursuant
28
+ to [title 17 United States Code Section 105](https://www.copyright.gov/title17/92chap1.html#105),
29
+ works of [(NIST)](http://www.nist.gov/) employees are not subject to
30
+ copyright protection in the United States. This software may be subject to
31
+ foreign copyright. Permission in the United States and in foreign
32
+ countries, to the extent that [(NIST)](http://www.nist.gov/) may hold copyright, to use, copy,
33
+ modify, create derivative works, and distribute this software and its
34
+ documentation without fee is hereby granted on a non-exclusive basis,
35
+ provided that this notice and disclaimer of warranty appears in all copies.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER
38
+ EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY
39
+ WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED
40
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
41
+ FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL
42
+ CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR
43
+ FREE. IN NO EVENT SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT
44
+ LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT
45
+ OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR
46
+ NOT BASED UPON WARRANTY, CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT
47
+ INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR
48
+ NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE
49
+ SOFTWARE OR SERVICES PROVIDED HEREUNDER.
@@ -0,0 +1,3 @@
1
+ recursive-exclude alignn/examples *
2
+ recursive-exclude alignn/tex *
3
+ include alignn/examples/sample_data/POSCAR-JVASP-10.vasp
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.1
2
+ Name: mpdd-alignn
3
+ Version: 1.0.0
4
+ Summary: A version of the NIST-JARVIS ALIGNN optimized in terms of model performance and to some extent reliability, for large-scale deployments over the MPDD infrastructure by Phases Research Lab.
5
+ Author-email: Adam Krajewski <ak@psu.edu>
6
+ Project-URL: Research Page, https://phaseslab.com/mpdd
7
+ Project-URL: Homepage, https://phaseslab.org
8
+ Project-URL: OPTIMADE Access, https://optimade.mpdd.org
9
+ Project-URL: Simple GUI, http://mpdd.org
10
+ Project-URL: Bug Tracker, https://github.com/PhasesResearchLab/MPDD/issues
11
+ Project-URL: ALIGNN, https://github.com/usnistgov/alignn
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
23
+ Classifier: Topic :: Scientific/Engineering :: Physics
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE.md
27
+ Requires-Dist: numpy>=1.26.0
28
+ Requires-Dist: scipy>=1.11.0
29
+ Requires-Dist: jarvis-tools>=2021.07.19
30
+ Requires-Dist: torch==2.1.0
31
+ Requires-Dist: dgl>=1.1.3
32
+ Requires-Dist: spglib==2.0.2
33
+ Requires-Dist: scikit-learn>=1.3.1
34
+ Requires-Dist: matplotlib>=3.4.1
35
+ Requires-Dist: tqdm>=4.60.0
36
+ Requires-Dist: pandas>=1.2.3
37
+ Requires-Dist: pydantic==1.8.1
38
+ Requires-Dist: ruamel.yaml
39
+ Requires-Dist: pysmartdl2
40
+ Provides-Extra: full
41
+ Requires-Dist: pytorch-ignite>=0.5.0.dev20221024; extra == "full"
42
+ Requires-Dist: ase; extra == "full"
43
+ Requires-Dist: flake8>=3.9.1; extra == "full"
44
+ Requires-Dist: pycodestyle>=2.7.0; extra == "full"
45
+ Requires-Dist: pydocstyle>=6.0.0; extra == "full"
46
+ Requires-Dist: pyparsing<3,>=2.2.1; extra == "full"
47
+ Requires-Dist: accelerate>=0.20.3; extra == "full"
48
+
49
+ # MPDD - ALIGNN Calculator
50
+
51
+ This tool is a modified version of the **NIST-JARVIS** [**`ALIGNN`**](https://github.com/usnistgov/alignn) optimized in terms of model performance and to some extent reliability, for large-scale deployments over the [**`MPDD`**](https://phaseslab.org/mpdd) infrastructure by Phases Research Lab.
52
+
53
+ ## Critical Changes
54
+
55
+ Key modifications that were made here:
56
+ - A set of models of interest has been selected and defined in [**`config.yaml`**](alignn/config.yaml) for consistency, readability, and easy tracking. These are the models which will be populating MPDD.
57
+ - **Dependency optimizations for running models**, skipping by default installation of several packages needed only for training and auxiliary tasks. Full
58
+ set can still be installed by `pip install "mpdd-alignn[full]"`.
59
+ - The process of model fetching was far too slow using `pretrained.get_figshare_model()`; thus, we reimplemented it similar to [`pySIPFENN`](https://pysipfenn.org) by multi-threading connection to Figshare via `pysmartdl2` we maintain, and parallelize the process on per-model basis. **Model download is now 7 times faster**, fetching all 7 default models in 6.1 vs 41.4 seconds.
60
+ - Optimized what is included in the built package. Now, its **package size is reduced 33.5 times**, from 21.7MB to 0.65MB.
61
+ - Streamlined operation, where we can get results for a directory of POSCARS for all default models in just 3 quick lines
62
+ ```python
63
+ from alignn import pretrained
64
+ pretrained.download_default_models()
65
+ result = pretrained.run_models_from_directory('example.SigmaPhase', mode='serial')
66
+ ```
67
+
68
+ Which give us neat:
69
+
70
+ ```
71
+ [{
72
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 98.06883239746094,
73
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 101.71208190917969,
74
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': -1.1146986484527588,
75
+ 'ALIGNN-JARVIS MBJ Bandgap [eV]': 0.5845542550086975,
76
+ 'ALIGNN-JARVIS Shear Modulus [GPa]': 39.18968963623047,
77
+ 'ALIGNN-MP Formation Energy [eV/atom]': -1.4002774953842163,
78
+ 'ALIGNN-MP PBE Bandgap [eV]': 1.074204921722412,
79
+ 'name': '9-Pb8O12.POSCAR'
80
+ },
81
+ {
82
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 194.2947540283203,
83
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 362.1310729980469,
84
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': 0.010236039757728577,
85
+ 'ALIGNN-JARVIS MBJ Bandgap [eV]': 0.0064897798001766205,
86
+ 'ALIGNN-JARVIS Shear Modulus [GPa]': 85.74588775634766,
87
+ 'ALIGNN-MP Formation Energy [eV/atom]': -0.018119990825653076,
88
+ 'ALIGNN-MP PBE Bandgap [eV]': -0.00551827996969223,
89
+ 'name': '19-Fe4Ni26.POSCAR'
90
+ },
91
+ {
92
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 185.35687255859375,
93
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 379.46417236328125,
94
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': 0.10529126971960068,
95
+ ...
96
+ ```
97
+
98
+ ## ALIGNN Compatibility and Install
99
+
100
+ In general, we tried to retain full compatibility with the original `ALIGNN`, so this should be a drop-in replacement. You have to simply:
101
+
102
+ pip install mpdd-alignn
103
+
104
+ or (as recommended) clone this repository and
105
+
106
+ pip install -e .
107
+
108
+ ## Contributions
109
+
110
+ Please direct all contributions to [the ALIGNN repository](https://github.com/usnistgov/alignn). We will be synching our fork with them every once in a while and can do it quickly upon reasonable request.
111
+
112
+ The only contributions we will accept here are:
113
+ - Expanding the list of default models.
114
+ - Performance improvements to our section of the code.
@@ -0,0 +1,66 @@
1
+ # MPDD - ALIGNN Calculator
2
+
3
+ This tool is a modified version of the **NIST-JARVIS** [**`ALIGNN`**](https://github.com/usnistgov/alignn) optimized in terms of model performance and to some extent reliability, for large-scale deployments over the [**`MPDD`**](https://phaseslab.org/mpdd) infrastructure by Phases Research Lab.
4
+
5
+ ## Critical Changes
6
+
7
+ Key modifications that were made here:
8
+ - A set of models of interest has been selected and defined in [**`config.yaml`**](alignn/config.yaml) for consistency, readability, and easy tracking. These are the models which will be populating MPDD.
9
+ - **Dependency optimizations for running models**, skipping by default installation of several packages needed only for training and auxiliary tasks. Full
10
+ set can still be installed by `pip install "mpdd-alignn[full]"`.
11
+ - The process of model fetching was far too slow using `pretrained.get_figshare_model()`; thus, we reimplemented it similar to [`pySIPFENN`](https://pysipfenn.org) by multi-threading connection to Figshare via `pysmartdl2` we maintain, and parallelize the process on per-model basis. **Model download is now 7 times faster**, fetching all 7 default models in 6.1 vs 41.4 seconds.
12
+ - Optimized what is included in the built package. Now, its **package size is reduced 33.5 times**, from 21.7MB to 0.65MB.
13
+ - Streamlined operation, where we can get results for a directory of POSCARS for all default models in just 3 quick lines
14
+ ```python
15
+ from alignn import pretrained
16
+ pretrained.download_default_models()
17
+ result = pretrained.run_models_from_directory('example.SigmaPhase', mode='serial')
18
+ ```
19
+
20
+ Which give us neat:
21
+
22
+ ```
23
+ [{
24
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 98.06883239746094,
25
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 101.71208190917969,
26
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': -1.1146986484527588,
27
+ 'ALIGNN-JARVIS MBJ Bandgap [eV]': 0.5845542550086975,
28
+ 'ALIGNN-JARVIS Shear Modulus [GPa]': 39.18968963623047,
29
+ 'ALIGNN-MP Formation Energy [eV/atom]': -1.4002774953842163,
30
+ 'ALIGNN-MP PBE Bandgap [eV]': 1.074204921722412,
31
+ 'name': '9-Pb8O12.POSCAR'
32
+ },
33
+ {
34
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 194.2947540283203,
35
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 362.1310729980469,
36
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': 0.010236039757728577,
37
+ 'ALIGNN-JARVIS MBJ Bandgap [eV]': 0.0064897798001766205,
38
+ 'ALIGNN-JARVIS Shear Modulus [GPa]': 85.74588775634766,
39
+ 'ALIGNN-MP Formation Energy [eV/atom]': -0.018119990825653076,
40
+ 'ALIGNN-MP PBE Bandgap [eV]': -0.00551827996969223,
41
+ 'name': '19-Fe4Ni26.POSCAR'
42
+ },
43
+ {
44
+ 'ALIGNN-JARVIS Bulk Modulus [GPa]': 185.35687255859375,
45
+ 'ALIGNN-JARVIS Exfoliation Energy [meV/atom]': 379.46417236328125,
46
+ 'ALIGNN-JARVIS Formation Energy [eV/atom]': 0.10529126971960068,
47
+ ...
48
+ ```
49
+
50
+ ## ALIGNN Compatibility and Install
51
+
52
+ In general, we tried to retain full compatibility with the original `ALIGNN`, so this should be a drop-in replacement. You have to simply:
53
+
54
+ pip install mpdd-alignn
55
+
56
+ or (as recommended) clone this repository and
57
+
58
+ pip install -e .
59
+
60
+ ## Contributions
61
+
62
+ Please direct all contributions to [the ALIGNN repository](https://github.com/usnistgov/alignn). We will be synching our fork with them every once in a while and can do it quickly upon reasonable request.
63
+
64
+ The only contributions we will accept here are:
65
+ - Expanding the list of default models.
66
+ - Performance improvements to our section of the code.
@@ -0,0 +1,2 @@
1
+ """Version number."""
2
+ __version__ = "2024.2.4"
@@ -0,0 +1,73 @@
1
+ """Ignite training cli."""
2
+
3
+ import json
4
+ import os
5
+ import shutil
6
+ from pathlib import Path
7
+
8
+ # from typing import Any, Dict, Optional, Union
9
+ from typing import Optional
10
+
11
+ import torch
12
+ import typer
13
+
14
+ from alignn.config import TrainingConfig
15
+ from alignn.profile import profile_dgl
16
+ from alignn.train import train_dgl
17
+
18
+
19
+ def cli(
20
+ config: Optional[Path] = typer.Argument(None),
21
+ progress: bool = False,
22
+ checkpoint_dir: Path = Path("/tmp/models"),
23
+ store_outputs: bool = False,
24
+ tensorboard: bool = False,
25
+ profile: bool = False,
26
+ ):
27
+ """ALIGNN training cli.
28
+
29
+ config: path to json config file (conform to TrainingConfig)
30
+ progress: enable tqdm console logging
31
+ tensorboard: enable tensorboard logging
32
+ profile: run profiling script for one epoch instead of training
33
+ """
34
+ model_dir = config.parent
35
+
36
+ if config is None:
37
+ model_dir = os.getcwd()
38
+ config = TrainingConfig(epochs=10, n_train=32, n_val=32, batch_size=16)
39
+
40
+ elif config.is_file():
41
+ model_dir = config.parent
42
+ with open(config, "r") as f:
43
+ config = json.load(f)
44
+ config = TrainingConfig(**config)
45
+
46
+ if profile:
47
+ profile_dgl(config)
48
+ return
49
+
50
+ hist = train_dgl(
51
+ config,
52
+ progress=progress,
53
+ checkpoint_dir=checkpoint_dir,
54
+ store_outputs=store_outputs,
55
+ log_tensorboard=tensorboard,
56
+ )
57
+
58
+ # print(model_dir)
59
+ # with open(model_dir / "metrics.json", "w") as f:
60
+ # json.dump(hist, f)
61
+
62
+ torch.save(hist, model_dir / "metrics.pt")
63
+
64
+ with open(model_dir / "fullconfig.json", "w") as f:
65
+ json.dump(json.loads(config.json()), f, indent=2)
66
+
67
+ # move temporary checkpoint data into model_dir
68
+ for checkpoint in checkpoint_dir.glob("*.pt"):
69
+ shutil.copy(checkpoint, model_dir / checkpoint.name)
70
+
71
+
72
+ if __name__ == "__main__":
73
+ typer.run(cli)