Popcornn 0.1.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 (57) hide show
  1. popcornn-0.1.0/LICENSE.md +310 -0
  2. popcornn-0.1.0/MANIFEST.in +1 -0
  3. popcornn-0.1.0/PKG-INFO +157 -0
  4. popcornn-0.1.0/README.md +112 -0
  5. popcornn-0.1.0/popcornn/__init__.py +5 -0
  6. popcornn-0.1.0/popcornn/optimization/__init__.py +3 -0
  7. popcornn-0.1.0/popcornn/optimization/initialize_path.py +169 -0
  8. popcornn-0.1.0/popcornn/optimization/path_optimizer.py +195 -0
  9. popcornn-0.1.0/popcornn/optimization/update_minima.py +38 -0
  10. popcornn-0.1.0/popcornn/paths/__init__.py +15 -0
  11. popcornn-0.1.0/popcornn/paths/base_path.py +534 -0
  12. popcornn-0.1.0/popcornn/paths/linear.py +24 -0
  13. popcornn-0.1.0/popcornn/paths/mlp.py +105 -0
  14. popcornn-0.1.0/popcornn/popcornn.py +205 -0
  15. popcornn-0.1.0/popcornn/potentials/__init__.py +54 -0
  16. popcornn-0.1.0/popcornn/potentials/ani.py +43 -0
  17. popcornn-0.1.0/popcornn/potentials/base_potential.py +75 -0
  18. popcornn-0.1.0/popcornn/potentials/chgnet.py +66 -0
  19. popcornn-0.1.0/popcornn/potentials/constant.py +13 -0
  20. popcornn-0.1.0/popcornn/potentials/escaip.py +55 -0
  21. popcornn-0.1.0/popcornn/potentials/harmonic.py +48 -0
  22. popcornn-0.1.0/popcornn/potentials/leftnet.py +57 -0
  23. popcornn-0.1.0/popcornn/potentials/lennard_jones.py +59 -0
  24. popcornn-0.1.0/popcornn/potentials/mace.py +68 -0
  25. popcornn-0.1.0/popcornn/potentials/morse.py +47 -0
  26. popcornn-0.1.0/popcornn/potentials/muller_brown.py +32 -0
  27. popcornn-0.1.0/popcornn/potentials/newtonnet.py +58 -0
  28. popcornn-0.1.0/popcornn/potentials/orb.py +83 -0
  29. popcornn-0.1.0/popcornn/potentials/repel.py +74 -0
  30. popcornn-0.1.0/popcornn/potentials/schwefel.py +23 -0
  31. popcornn-0.1.0/popcornn/potentials/sphere.py +15 -0
  32. popcornn-0.1.0/popcornn/potentials/uma.py +68 -0
  33. popcornn-0.1.0/popcornn/potentials/wolfe_schlegel.py +20 -0
  34. popcornn-0.1.0/popcornn/tools/__init__.py +7 -0
  35. popcornn-0.1.0/popcornn/tools/arg_parser.py +14 -0
  36. popcornn-0.1.0/popcornn/tools/ase.py +238 -0
  37. popcornn-0.1.0/popcornn/tools/configs.py +17 -0
  38. popcornn-0.1.0/popcornn/tools/images.py +163 -0
  39. popcornn-0.1.0/popcornn/tools/integrator.py +159 -0
  40. popcornn-0.1.0/popcornn/tools/logging.py +45 -0
  41. popcornn-0.1.0/popcornn/tools/metrics.py +520 -0
  42. popcornn-0.1.0/popcornn/tools/scheduler.py +61 -0
  43. popcornn-0.1.0/popcornn/tools/tests.py +249 -0
  44. popcornn-0.1.0/popcornn/tools/visualize.py +244 -0
  45. popcornn-0.1.0/popcornn.egg-info/PKG-INFO +157 -0
  46. popcornn-0.1.0/popcornn.egg-info/SOURCES.txt +55 -0
  47. popcornn-0.1.0/popcornn.egg-info/dependency_links.txt +1 -0
  48. popcornn-0.1.0/popcornn.egg-info/requires.txt +24 -0
  49. popcornn-0.1.0/popcornn.egg-info/top_level.txt +1 -0
  50. popcornn-0.1.0/pyproject.toml +177 -0
  51. popcornn-0.1.0/setup.cfg +4 -0
  52. popcornn-0.1.0/tests/test_images.py +784 -0
  53. popcornn-0.1.0/tests/test_initialize_path.py +13 -0
  54. popcornn-0.1.0/tests/test_ode_functions.py +87 -0
  55. popcornn-0.1.0/tests/test_paths.py +375 -0
  56. popcornn-0.1.0/tests/test_potentials.py +428 -0
  57. popcornn-0.1.0/tests/test_ts_search.py +67 -0
@@ -0,0 +1,310 @@
1
+ # Creative Commons Attribution 4.0 International Public License
2
+
3
+ By exercising the Licensed Rights (defined below), You accept and agree
4
+ to be bound by the terms and conditions of this Creative Commons
5
+ Attribution 4.0 International Public License ("Public License"). To the
6
+ extent this Public License may be interpreted as a contract, You are
7
+ granted the Licensed Rights in consideration of Your acceptance of
8
+ these terms and conditions, and the Licensor grants You such rights in
9
+ consideration of benefits the Licensor receives from making the
10
+ Licensed Material available under these terms and conditions.
11
+
12
+
13
+ ## Section 1 -- Definitions.
14
+
15
+ a. <ins>Adapted Material</ins> means material subject to Copyright and Similar
16
+ Rights that is derived from or based upon the Licensed Material
17
+ and in which the Licensed Material is translated, altered,
18
+ arranged, transformed, or otherwise modified in a manner requiring
19
+ permission under the Copyright and Similar Rights held by the
20
+ Licensor. For purposes of this Public License, where the Licensed
21
+ Material is a musical work, performance, or sound recording,
22
+ Adapted Material is always produced where the Licensed Material is
23
+ synched in timed relation with a moving image.
24
+
25
+ b. <ins>Adapter's License</ins> means the license You apply to Your Copyright
26
+ and Similar Rights in Your contributions to Adapted Material in
27
+ accordance with the terms and conditions of this Public License.
28
+
29
+ c. <ins>Copyright and Similar Rights</ins> means copyright and/or similar rights
30
+ closely related to copyright including, without limitation,
31
+ performance, broadcast, sound recording, and Sui Generis Database
32
+ Rights, without regard to how the rights are labeled or
33
+ categorized. For purposes of this Public License, the rights
34
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
35
+ Rights.
36
+
37
+ d. <ins>Effective Technological Measures</ins> means those measures that, in the
38
+ absence of proper authority, may not be circumvented under laws
39
+ fulfilling obligations under Article 11 of the WIPO Copyright
40
+ Treaty adopted on December 20, 1996, and/or similar international
41
+ agreements.
42
+
43
+ e. <ins>Exceptions and Limitations</ins> means fair use, fair dealing, and/or
44
+ any other exception or limitation to Copyright and Similar Rights
45
+ that applies to Your use of the Licensed Material.
46
+
47
+ f. <ins>Licensed Material</ins> means the artistic or literary work, database,
48
+ or other material to which the Licensor applied this Public
49
+ License.
50
+
51
+ g. <ins>Licensed Rights</ins> means the rights granted to You subject to the
52
+ terms and conditions of this Public License, which are limited to
53
+ all Copyright and Similar Rights that apply to Your use of the
54
+ Licensed Material and that the Licensor has authority to license.
55
+
56
+ h. <ins>Licensor</ins> means the individual(s) or entity(ies) granting rights
57
+ under this Public License.
58
+
59
+ i. <ins>Share</ins> means to provide material to the public by any means or
60
+ process that requires permission under the Licensed Rights, such
61
+ as reproduction, public display, public performance, distribution,
62
+ dissemination, communication, or importation, and to make material
63
+ available to the public including in ways that members of the
64
+ public may access the material from a place and at a time
65
+ individually chosen by them.
66
+
67
+ j. <ins>Sui Generis Database Rights</ins> means rights other than copyright
68
+ resulting from Directive 96/9/EC of the European Parliament and of
69
+ the Council of 11 March 1996 on the legal protection of databases,
70
+ as amended and/or succeeded, as well as other essentially
71
+ equivalent rights anywhere in the world.
72
+
73
+ k. <ins>You</ins> means the individual or entity exercising the Licensed Rights
74
+ under this Public License. **Your** has a corresponding meaning.
75
+
76
+
77
+ ## Section 2 -- Scope.
78
+
79
+ a. **License grant.**
80
+
81
+ 1. Subject to the terms and conditions of this Public License,
82
+ the Licensor hereby grants You a worldwide, royalty-free,
83
+ non-sublicensable, non-exclusive, irrevocable license to
84
+ exercise the Licensed Rights in the Licensed Material to:
85
+
86
+ a. reproduce and Share the Licensed Material, in whole or
87
+ in part; and
88
+
89
+ b. produce, reproduce, and Share Adapted Material.
90
+
91
+ 2. **Exceptions and Limitations.** For the avoidance of doubt, where
92
+ Exceptions and Limitations apply to Your use, this Public
93
+ License does not apply, and You do not need to comply with
94
+ its terms and conditions.
95
+
96
+ 3. **Term.** The term of this Public License is specified in Section
97
+ 6(a).
98
+
99
+ 4. **Media and formats; technical modifications allowed.** The
100
+ Licensor authorizes You to exercise the Licensed Rights in
101
+ all media and formats whether now known or hereafter created,
102
+ and to make technical modifications necessary to do so. The
103
+ Licensor waives and/or agrees not to assert any right or
104
+ authority to forbid You from making technical modifications
105
+ necessary to exercise the Licensed Rights, including
106
+ technical modifications necessary to circumvent Effective
107
+ Technological Measures. For purposes of this Public License,
108
+ simply making modifications authorized by this Section 2(a)
109
+ (4) never produces Adapted Material.
110
+
111
+ 5. <ins>Downstream recipients.</ins>
112
+
113
+ a. <ins>Offer from the Licensor -- Licensed Material.</ins> Every
114
+ recipient of the Licensed Material automatically
115
+ receives an offer from the Licensor to exercise the
116
+ Licensed Rights under the terms and conditions of this
117
+ Public License.
118
+
119
+ b. <ins>No downstream restrictions.</ins> You may not offer or impose
120
+ any additional or different terms or conditions on, or
121
+ apply any Effective Technological Measures to, the
122
+ Licensed Material if doing so restricts exercise of the
123
+ Licensed Rights by any recipient of the Licensed
124
+ Material.
125
+
126
+ 6. <ins>No endorsement.</ins> Nothing in this Public License constitutes or
127
+ may be construed as permission to assert or imply that You
128
+ are, or that Your use of the Licensed Material is, connected
129
+ with, or sponsored, endorsed, or granted official status by,
130
+ the Licensor or others designated to receive attribution as
131
+ provided in Section 3(a)(1)(A)(i).
132
+
133
+ b. **Other rights.**
134
+
135
+ 1. Moral rights, such as the right of integrity, are not
136
+ licensed under this Public License, nor are publicity,
137
+ privacy, and/or other similar personality rights; however, to
138
+ the extent possible, the Licensor waives and/or agrees not to
139
+ assert any such rights held by the Licensor to the limited
140
+ extent necessary to allow You to exercise the Licensed
141
+ Rights, but not otherwise.
142
+
143
+ 2. Patent and trademark rights are not licensed under this
144
+ Public License.
145
+
146
+ 3. To the extent possible, the Licensor waives any right to
147
+ collect royalties from You for the exercise of the Licensed
148
+ Rights, whether directly or through a collecting society
149
+ under any voluntary or waivable statutory or compulsory
150
+ licensing scheme. In all other cases the Licensor expressly
151
+ reserves any right to collect such royalties.
152
+
153
+
154
+ ## Section 3 -- License Conditions.
155
+
156
+ Your exercise of the Licensed Rights is expressly made subject to the
157
+ following conditions.
158
+
159
+ a. **Attribution.**
160
+
161
+ 1. If You Share the Licensed Material (including in modified
162
+ form), You must:
163
+
164
+ a. retain the following if it is supplied by the Licensor with the Licensed Material:
165
+
166
+ &nbsp;&nbsp;&nbsp;&nbsp;i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
167
+
168
+ &nbsp;&nbsp;&nbsp;&nbsp;ii. a copyright notice;
169
+
170
+ &nbsp;&nbsp;&nbsp;&nbsp;iii. a notice that refers to this Public License;
171
+
172
+ &nbsp;&nbsp;&nbsp;&nbsp;iv. a notice that refers to the disclaimer of
173
+ warranties;
174
+
175
+ &nbsp;&nbsp;&nbsp;&nbsp;v. a URI or hyperlink to the Licensed Material to the
176
+ extent reasonably practicable;
177
+
178
+ b. indicate if You modified the Licensed Material and
179
+ retain an indication of any previous modifications; and
180
+
181
+ c. indicate the Licensed Material is licensed under this
182
+ Public License, and include the text of, or the URI or
183
+ hyperlink to, this Public License.
184
+
185
+ 3. You may satisfy the conditions in Section 3(a)(1) in any
186
+ reasonable manner based on the medium, means, and context in
187
+ which You Share the Licensed Material. For example, it may be
188
+ reasonable to satisfy the conditions by providing a URI or
189
+ hyperlink to a resource that includes the required
190
+ information.
191
+
192
+ 4. If requested by the Licensor, You must remove any of the
193
+ information required by Section 3(a)(1)(A) to the extent
194
+ reasonably practicable.
195
+
196
+ 5. If You Share Adapted Material You produce, the Adapter's
197
+ License You apply must not prevent recipients of the Adapted
198
+ Material from complying with this Public License.
199
+
200
+
201
+ ## Section 4 -- Sui Generis Database Rights.
202
+
203
+ Where the Licensed Rights include Sui Generis Database Rights that
204
+ apply to Your use of the Licensed Material:
205
+
206
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
207
+ to extract, reuse, reproduce, and Share all or a substantial
208
+ portion of the contents of the database;
209
+
210
+ b. if You include all or a substantial portion of the database
211
+ contents in a database in which You have Sui Generis Database
212
+ Rights, then the database in which You have Sui Generis Database
213
+ Rights (but not its individual contents) is Adapted Material; and
214
+
215
+ c. You must comply with the conditions in Section 3(a) if You Share
216
+ all or a substantial portion of the contents of the database.
217
+
218
+ For the avoidance of doubt, this Section 4 supplements and does not
219
+ replace Your obligations under this Public License where the Licensed
220
+ Rights include other Copyright and Similar Rights.
221
+
222
+
223
+ ## Section 5 -- Disclaimer of Warranties and Limitation of Liability.
224
+
225
+ **a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
226
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
227
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
228
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
229
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
230
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
231
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
232
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
233
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
234
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.**
235
+
236
+ **b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
237
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
238
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
239
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
240
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
241
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
242
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
243
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
244
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.**
245
+
246
+ c. The disclaimer of warranties and limitation of liability provided
247
+ above shall be interpreted in a manner that, to the extent
248
+ possible, most closely approximates an absolute disclaimer and
249
+ waiver of all liability.
250
+
251
+
252
+ ## Section 6 -- Term and Termination.
253
+
254
+ a. This Public License applies for the term of the Copyright and
255
+ Similar Rights licensed here. However, if You fail to comply with
256
+ this Public License, then Your rights under this Public License
257
+ terminate automatically.
258
+
259
+ b. Where Your right to use the Licensed Material has terminated under
260
+ Section 6(a), it reinstates:
261
+
262
+ 1. automatically as of the date the violation is cured, provided
263
+ it is cured within 30 days of Your discovery of the
264
+ violation; or
265
+
266
+ 2. upon express reinstatement by the Licensor.
267
+
268
+ &nbsp;&nbsp;&nbsp;&nbsp;For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
269
+
270
+ c. For the avoidance of doubt, the Licensor may also offer the
271
+ Licensed Material under separate terms or conditions or stop
272
+ distributing the Licensed Material at any time; however, doing so
273
+ will not terminate this Public License.
274
+
275
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
276
+ License.
277
+
278
+
279
+ ## Section 7 -- Other Terms and Conditions.
280
+
281
+ a. The Licensor shall not be bound by any additional or different
282
+ terms or conditions communicated by You unless expressly agreed.
283
+
284
+ b. Any arrangements, understandings, or agreements regarding the
285
+ Licensed Material not stated herein are separate from and
286
+ independent of the terms and conditions of this Public License.
287
+
288
+
289
+ ## Section 8 -- Interpretation.
290
+
291
+ a. For the avoidance of doubt, this Public License does not, and
292
+ shall not be interpreted to, reduce, limit, restrict, or impose
293
+ conditions on any use of the Licensed Material that could lawfully
294
+ be made without permission under this Public License.
295
+
296
+ b. To the extent possible, if any provision of this Public License is
297
+ deemed unenforceable, it shall be automatically reformed to the
298
+ minimum extent necessary to make it enforceable. If the provision
299
+ cannot be reformed, it shall be severed from this Public License
300
+ without affecting the enforceability of the remaining terms and
301
+ conditions.
302
+
303
+ c. No term or condition of this Public License will be waived and no
304
+ failure to comply consented to unless expressly agreed to by the
305
+ Licensor.
306
+
307
+ d. Nothing in this Public License constitutes or may be interpreted
308
+ as a limitation upon, or waiver of, any privileges and immunities
309
+ that apply to the Licensor or You, including from the legal
310
+ processes of any jurisdiction or authority.
@@ -0,0 +1 @@
1
+ graft popcornn
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: popcornn
3
+ Version: 0.1.0
4
+ Summary: Path Optimization with a Continuous Representation Neural Network (popcornn) optimizes molecular reaction paths along analytic and MLIP potentials.
5
+ Author-email: Kareem Hegazy <khegazy@berkeley.edu>, "Eric C.-Y. Yuan" <ericyuan@berkeley.edu>, Anup Kumar <anukumar94663@gmail.com>, Dmitriy Morozov <dmitriy@mrzv.org>, Michael Mahoney <mmahoney@stat.berkeley.edu>, Teresa Head-Gordon <thg@berkeley.edu>, "Samuel M. Blau" <smblau@lbl.gov>
6
+ License: CC-BY 4.0
7
+ Project-URL: repository, https://github.com/khegazy/popcornn
8
+ Project-URL: documentation, https://khegazy.github.io/popcornn/
9
+ Project-URL: changelog, https://github.com/khegazy/popcornn/blob/main/CHANGELOG.md
10
+ Keywords: Chemistry,Transition State,Reaction path,Minimum Energy Path,Geodesic
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: Unix
18
+ Classifier: Operating System :: MacOS
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.md
22
+ Requires-Dist: numpy
23
+ Requires-Dist: torch
24
+ Requires-Dist: torch_geometric
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: ase
27
+ Requires-Dist: tqdm
28
+ Requires-Dist: pytest
29
+ Requires-Dist: pytest-cov
30
+ Requires-Dist: PyYAML
31
+ Requires-Dist: torchpathdiffeq
32
+ Requires-Dist: fairchem-core>=2.4.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
36
+ Requires-Dist: ruff>=0.0.285; extra == "dev"
37
+ Provides-Extra: docs
38
+ Requires-Dist: mkdocs-material>=9.4.0; extra == "docs"
39
+ Requires-Dist: mkdocstrings[python]>=0.22.0; extra == "docs"
40
+ Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "docs"
41
+ Requires-Dist: mkdocs-literate-nav>=0.6.0; extra == "docs"
42
+ Requires-Dist: pillow>=10.0.0; extra == "docs"
43
+ Requires-Dist: cairosvg>=2.7.1; extra == "docs"
44
+ Dynamic: license-file
45
+
46
+ # Popcornn
47
+ Path Optimization with a Continuous Representation Neural Network for reaction path with machine learning interatomic potentials
48
+
49
+ ## Installation and Dependencies
50
+ We recommend using conda environment to install dependencies of this library. Please install (or load) conda and then proceed with the following commands:
51
+ ```
52
+ conda create --name popcornn python=3.12
53
+ conda activate popcornn
54
+ ```
55
+
56
+ Now, you can install Popcornn in the conda environment by cloning this repository:
57
+ ```
58
+ git clone https://github.com/khegazy/popcornn.git
59
+
60
+ pip install -e ./popcornn
61
+ ```
62
+ Several machine learning potentials have been interfaced with Popcornn, such as CHGNet, EScAIP, LEFTNet, MACE, [NewtonNet](https://github.com/THGLab/NewtonNet), Orb, [UMA](https://github.com/facebookresearch/fairchem), etc. Please refer to the respective codespaces for the installation guides. To run the latest UMA model, you'll also have to set it up through [HuggingFace](https://rowansci.com/blog/how-to-run-open-molecules-2025).
63
+
64
+ ## Quick Start
65
+ You can find several run files inside the `examples` directory that rely on the implemented modules in the Popcornn library. We provide a simple run script, which needs to be accompanied with a yaml config file. You can run an example optimization script with the following command in the `examples` directory:
66
+ ```
67
+ cd popcornn/examples
68
+
69
+ python run.py --config configs/rxn0003.yaml
70
+ ```
71
+ All Popcornn parameters are specified in the config file. This example should complete in under an hour. Please note that we are still developing the convergence criteria, so you may adjust the number of optimization iterations to balance accuracy and speed.
72
+
73
+ For fast development and playing around with popcornn we offer two examples based on the the Wolfe potential
74
+ ```
75
+ python run.py --config configs/wolfe.yaml
76
+ ```
77
+ will run the fast Wolfe example and
78
+ ```
79
+ python run.py --config configs/loss_example.yaml
80
+ ```
81
+ will run the fast Wolfe example with more advanced loss capabilities. We note that values in the `loss_example.yaml` files are chosen to demonstrate the capabilities of popcornn and are not optimal values for either Wolfe or other systems.
82
+
83
+ ## Set up your own Popcornn
84
+ The config file is read in the run script as a dictionary, so you can also directly specify the configs in your own python script, giving you more handles on the inputs and outputs.
85
+
86
+ ### Initialize the path
87
+ The first step for you would be to specify the endpoints of the reaction you are working on:
88
+ ```
89
+ from ase.io import read
90
+
91
+ images = read('configs/rxn0003.xyz', index=':')
92
+ for image in images:
93
+ image.info = {"charge": 0, "spin": 1} # if required by the MLIP, set the total charge and multiplicity
94
+ ```
95
+ It can be a list of ASE Atoms, or if it's a string, we can also read `xyz` or `traj` files. If there are more than 2 frames provided, the path will be first fitted to go through the intermediate frames, but they are not fixed. Note that the reactant and product should be index-mapped, rotationally/translationally aligned, and ideally unwrapped if periodic. By default, if the periodic boundary conditions are applied, we unwrap the product according to the minimum image convention with respect to the reactant; however, if the cell is small and some atoms are expected to move more than half a cell, you should unwrap the frames manually and disable `unwrap_positions` in `path_params` (see below).
96
+
97
+ Next, you can set up the path using the images:
98
+ ```
99
+ from popcornn import Popcornn
100
+
101
+ path = Popcornn(images=images, path_params={'name': 'mlp', 'n_embed': 1, 'depth': 2})
102
+ ```
103
+ Optional initialization parameters for Popcornn include `num_record_points` for the number of frames to be recorded after optimization, `output_dir` for optional debug outputs, `device`, `dtype`, and `seed`. For simpler reactions, `depth` of 2 helps limit the complexity of the reaction, while more complicated reactions may require a deeper path neural network.
104
+
105
+ ### Optimize the path
106
+ Machine learning potentials are vulnerable to unphysical, out-of-distribution configurations, and it's important to resolve atom clashing as an interpolation step. Luckily, you can do both the interpolation and the optimization with Popcornn. The state of the art regarding the interpolation is to optimize the path on a monotonic, repulsive potential with respect to the geodesic loss, or so-called [geodesic interpolation](https://pubs.aip.org/aip/jcp/article/150/16/164103/198363/Geodesic-interpolation-for-reaction-pathways). In general, therefore, you need multiple optimizations by providing multiple `optimization_params`, each with a different potential, integral loss, and optimizer:
107
+ ```
108
+ final_images, ts_image = path.optimize_path(
109
+ {
110
+ 'potential_params': {'potential': 'repel'},
111
+ 'integrator_params': {'path_ode_names': 'geodesic'},
112
+ 'optimizer_params': {'optimizer': {'name': 'adam', 'lr': 1.0e-1}},
113
+ 'num_optimizer_iterations': 1000,
114
+ },
115
+ {
116
+ 'potential_params': {'potential': 'uma', 'model_name': 'uma-s-1', 'task_name': 'omol'},
117
+ 'integrator_params': {'path_ode_names': 'projected_variational_reaction_energy', 'rtol': 1.0e-5, 'atol': 1.0e-7},
118
+ 'optimizer_params': {'optimizer': {'name': 'adam', 'lr': 1.0e-3}},
119
+ 'num_optimizer_iterations': 1000,
120
+ },
121
+ )
122
+ ```
123
+ Finally, after optimization, you can save the optimized path as a list of Atoms for visualization and further optimization:
124
+ ```
125
+ from ase.io import write
126
+
127
+ write('popcornn.xyz', final_images)
128
+ write('popcornn_ts.xyz', ts_image)
129
+ ```
130
+ In this example, you should get a barrier of ~3.6 eV. To be fully rigorous, we [suggest](https://www.nature.com/articles/s41467-024-52481-5) doing a subsequent saddle point optimization for the Popcornn transition state followed by forward/reverse intrisic reaction coordinate calculations, since Popcornn is not actually returning a minimum energy path but just targeting the transition state directly. Both saddle point optimization and intrisic reaction coordinate calculation are supported by [Sella](https://github.com/zadorlab/sella/tree/master) as ASE Optimizers.
131
+
132
+ ### Managing memory and handling potential OOM errors
133
+ Popcornn uses [torchpathdiffeq](https://github.com/khegazy/torchpathdiffeq/tree/main) to numerically calculate the path integral used in the loss. When calculating the path integral, torchpathdiffeq employs an adaptive evaluation mesh. This adaptive mesh results in varying batch sizes within a single torchpathdiffeq evaluation. The adaptive batch size may grow and can lead to out-of-memory errors (OOM). To avoid these OOM errors, torchpathdiffeq adaptively limits the batch size based on the cached and free GPU memory. While infrequent, it is possible for OOM errors to occur. There are two reasons for this, each with a solution. The user should apply these solutions in this order if an OOM error occurs.
134
+ 1. PyTorch memory management is optimized to run a single batch size many times, however, the adaptive path integration scheme in torchpathdiffeq varies the batch size. To allow PyTorch to resize the memory used for batch evaluations, the user must specify the following environment flag
135
+ ```
136
+ PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
137
+ ```
138
+ or in Python, place
139
+ ```
140
+ import os
141
+ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
142
+ ```
143
+ at the top of the first Python file being called. This will solve most OOM errors.
144
+
145
+ 2. If the OOM error persists, then torchpathdiffeq is struggling to calculate the memory footprint for your problem. To solve this, the user must limit the available GPU memory torchpathdiffeq is allowed to use via the `total_mem_usage` flag. `total_mem_usage` is a ratio between 0 and 1 that determines how much of the available GPU memory will be allocated for the next batch evaluation. `total_mem_usage` is set in the run config file, inside the `integration_params`, with a default value of 0.9.
146
+ ```
147
+ integrator_params:
148
+ path_ode_names: projected_variational_reaction_energy
149
+ rtol: 1.0e-5
150
+ atol: 1.0e-7
151
+ total_mem_usage: 0.75
152
+ ```
153
+
154
+
155
+ ## Support
156
+
157
+ Popcornn is still under active development, and we welcome any feedback or contributions. Please open a GitHub issue if any problems are encountered!
@@ -0,0 +1,112 @@
1
+ # Popcornn
2
+ Path Optimization with a Continuous Representation Neural Network for reaction path with machine learning interatomic potentials
3
+
4
+ ## Installation and Dependencies
5
+ We recommend using conda environment to install dependencies of this library. Please install (or load) conda and then proceed with the following commands:
6
+ ```
7
+ conda create --name popcornn python=3.12
8
+ conda activate popcornn
9
+ ```
10
+
11
+ Now, you can install Popcornn in the conda environment by cloning this repository:
12
+ ```
13
+ git clone https://github.com/khegazy/popcornn.git
14
+
15
+ pip install -e ./popcornn
16
+ ```
17
+ Several machine learning potentials have been interfaced with Popcornn, such as CHGNet, EScAIP, LEFTNet, MACE, [NewtonNet](https://github.com/THGLab/NewtonNet), Orb, [UMA](https://github.com/facebookresearch/fairchem), etc. Please refer to the respective codespaces for the installation guides. To run the latest UMA model, you'll also have to set it up through [HuggingFace](https://rowansci.com/blog/how-to-run-open-molecules-2025).
18
+
19
+ ## Quick Start
20
+ You can find several run files inside the `examples` directory that rely on the implemented modules in the Popcornn library. We provide a simple run script, which needs to be accompanied with a yaml config file. You can run an example optimization script with the following command in the `examples` directory:
21
+ ```
22
+ cd popcornn/examples
23
+
24
+ python run.py --config configs/rxn0003.yaml
25
+ ```
26
+ All Popcornn parameters are specified in the config file. This example should complete in under an hour. Please note that we are still developing the convergence criteria, so you may adjust the number of optimization iterations to balance accuracy and speed.
27
+
28
+ For fast development and playing around with popcornn we offer two examples based on the the Wolfe potential
29
+ ```
30
+ python run.py --config configs/wolfe.yaml
31
+ ```
32
+ will run the fast Wolfe example and
33
+ ```
34
+ python run.py --config configs/loss_example.yaml
35
+ ```
36
+ will run the fast Wolfe example with more advanced loss capabilities. We note that values in the `loss_example.yaml` files are chosen to demonstrate the capabilities of popcornn and are not optimal values for either Wolfe or other systems.
37
+
38
+ ## Set up your own Popcornn
39
+ The config file is read in the run script as a dictionary, so you can also directly specify the configs in your own python script, giving you more handles on the inputs and outputs.
40
+
41
+ ### Initialize the path
42
+ The first step for you would be to specify the endpoints of the reaction you are working on:
43
+ ```
44
+ from ase.io import read
45
+
46
+ images = read('configs/rxn0003.xyz', index=':')
47
+ for image in images:
48
+ image.info = {"charge": 0, "spin": 1} # if required by the MLIP, set the total charge and multiplicity
49
+ ```
50
+ It can be a list of ASE Atoms, or if it's a string, we can also read `xyz` or `traj` files. If there are more than 2 frames provided, the path will be first fitted to go through the intermediate frames, but they are not fixed. Note that the reactant and product should be index-mapped, rotationally/translationally aligned, and ideally unwrapped if periodic. By default, if the periodic boundary conditions are applied, we unwrap the product according to the minimum image convention with respect to the reactant; however, if the cell is small and some atoms are expected to move more than half a cell, you should unwrap the frames manually and disable `unwrap_positions` in `path_params` (see below).
51
+
52
+ Next, you can set up the path using the images:
53
+ ```
54
+ from popcornn import Popcornn
55
+
56
+ path = Popcornn(images=images, path_params={'name': 'mlp', 'n_embed': 1, 'depth': 2})
57
+ ```
58
+ Optional initialization parameters for Popcornn include `num_record_points` for the number of frames to be recorded after optimization, `output_dir` for optional debug outputs, `device`, `dtype`, and `seed`. For simpler reactions, `depth` of 2 helps limit the complexity of the reaction, while more complicated reactions may require a deeper path neural network.
59
+
60
+ ### Optimize the path
61
+ Machine learning potentials are vulnerable to unphysical, out-of-distribution configurations, and it's important to resolve atom clashing as an interpolation step. Luckily, you can do both the interpolation and the optimization with Popcornn. The state of the art regarding the interpolation is to optimize the path on a monotonic, repulsive potential with respect to the geodesic loss, or so-called [geodesic interpolation](https://pubs.aip.org/aip/jcp/article/150/16/164103/198363/Geodesic-interpolation-for-reaction-pathways). In general, therefore, you need multiple optimizations by providing multiple `optimization_params`, each with a different potential, integral loss, and optimizer:
62
+ ```
63
+ final_images, ts_image = path.optimize_path(
64
+ {
65
+ 'potential_params': {'potential': 'repel'},
66
+ 'integrator_params': {'path_ode_names': 'geodesic'},
67
+ 'optimizer_params': {'optimizer': {'name': 'adam', 'lr': 1.0e-1}},
68
+ 'num_optimizer_iterations': 1000,
69
+ },
70
+ {
71
+ 'potential_params': {'potential': 'uma', 'model_name': 'uma-s-1', 'task_name': 'omol'},
72
+ 'integrator_params': {'path_ode_names': 'projected_variational_reaction_energy', 'rtol': 1.0e-5, 'atol': 1.0e-7},
73
+ 'optimizer_params': {'optimizer': {'name': 'adam', 'lr': 1.0e-3}},
74
+ 'num_optimizer_iterations': 1000,
75
+ },
76
+ )
77
+ ```
78
+ Finally, after optimization, you can save the optimized path as a list of Atoms for visualization and further optimization:
79
+ ```
80
+ from ase.io import write
81
+
82
+ write('popcornn.xyz', final_images)
83
+ write('popcornn_ts.xyz', ts_image)
84
+ ```
85
+ In this example, you should get a barrier of ~3.6 eV. To be fully rigorous, we [suggest](https://www.nature.com/articles/s41467-024-52481-5) doing a subsequent saddle point optimization for the Popcornn transition state followed by forward/reverse intrisic reaction coordinate calculations, since Popcornn is not actually returning a minimum energy path but just targeting the transition state directly. Both saddle point optimization and intrisic reaction coordinate calculation are supported by [Sella](https://github.com/zadorlab/sella/tree/master) as ASE Optimizers.
86
+
87
+ ### Managing memory and handling potential OOM errors
88
+ Popcornn uses [torchpathdiffeq](https://github.com/khegazy/torchpathdiffeq/tree/main) to numerically calculate the path integral used in the loss. When calculating the path integral, torchpathdiffeq employs an adaptive evaluation mesh. This adaptive mesh results in varying batch sizes within a single torchpathdiffeq evaluation. The adaptive batch size may grow and can lead to out-of-memory errors (OOM). To avoid these OOM errors, torchpathdiffeq adaptively limits the batch size based on the cached and free GPU memory. While infrequent, it is possible for OOM errors to occur. There are two reasons for this, each with a solution. The user should apply these solutions in this order if an OOM error occurs.
89
+ 1. PyTorch memory management is optimized to run a single batch size many times, however, the adaptive path integration scheme in torchpathdiffeq varies the batch size. To allow PyTorch to resize the memory used for batch evaluations, the user must specify the following environment flag
90
+ ```
91
+ PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
92
+ ```
93
+ or in Python, place
94
+ ```
95
+ import os
96
+ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
97
+ ```
98
+ at the top of the first Python file being called. This will solve most OOM errors.
99
+
100
+ 2. If the OOM error persists, then torchpathdiffeq is struggling to calculate the memory footprint for your problem. To solve this, the user must limit the available GPU memory torchpathdiffeq is allowed to use via the `total_mem_usage` flag. `total_mem_usage` is a ratio between 0 and 1 that determines how much of the available GPU memory will be allocated for the next batch evaluation. `total_mem_usage` is set in the run config file, inside the `integration_params`, with a default value of 0.9.
101
+ ```
102
+ integrator_params:
103
+ path_ode_names: projected_variational_reaction_energy
104
+ rtol: 1.0e-5
105
+ atol: 1.0e-7
106
+ total_mem_usage: 0.75
107
+ ```
108
+
109
+
110
+ ## Support
111
+
112
+ Popcornn is still under active development, and we welcome any feedback or contributions. Please open a GitHub issue if any problems are encountered!
@@ -0,0 +1,5 @@
1
+ from . import paths
2
+ from . import potentials
3
+ from . import tools
4
+ from . import optimization
5
+ from .popcornn import Popcornn
@@ -0,0 +1,3 @@
1
+ from .update_minima import MinimaUpdate
2
+ from .initialize_path import randomly_initialize_path, initialize_path
3
+ from .path_optimizer import PathOptimizer