Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added ase Nudged Elastic Band in the NewtonNet recipe #2176

Open
wants to merge 462 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
462 commits
Select commit Hold shift + click to select a range
6f92356
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 21, 2024
0314718
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
a4f684f
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 21, 2024
e7c0311
Added test for BFGSLinesearch exception.
kumaranu Jun 21, 2024
a31f20c
pre-commit auto-fixes
pre-commit-ci[bot] Jun 21, 2024
60050fb
added docstring to test_run_neb2
kumaranu Jun 21, 2024
c18f48b
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
027e759
pre-commit auto-fixes
pre-commit-ci[bot] Jun 21, 2024
0840c8c
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 21, 2024
c1427d8
Removed unused code from test_run_neb
kumaranu Jun 21, 2024
1646d42
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
bfc9ced
pre-commit auto-fixes
pre-commit-ci[bot] Jun 21, 2024
716e628
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 21, 2024
a9d5ff2
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
30d11dc
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
33b8d4e
pre-commit auto-fixes
pre-commit-ci[bot] Jun 21, 2024
f615130
Added docstrings to summarize_neb_run and summarize_neb_run2
kumaranu Jun 21, 2024
40c29ca
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 21, 2024
87a08ce
Got rid of random molecule and replaced it with C60.
kumaranu Jun 22, 2024
dc10ecc
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
4fea200
Added seed to test_ase for geodesic.
kumaranu Jun 22, 2024
6c6583b
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 22, 2024
f18ea76
pre-commit auto-fixes
pre-commit-ci[bot] Jun 22, 2024
f06ac43
Merge branch 'main' into neb_nn
Andrew-S-Rosen Jun 26, 2024
28ced33
pre-commit auto-fixes
pre-commit-ci[bot] Jun 26, 2024
b13b4aa
Added print statements for newtonnet model and config.
kumaranu Jun 26, 2024
953ec3a
pre-commit auto-fixes
pre-commit-ci[bot] Jun 26, 2024
b3c9c1a
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 26, 2024
04e92dc
pre-commit auto-fixes
pre-commit-ci[bot] Jun 26, 2024
411ac3c
Trying noqa to get rid of pre-commit warning for random seed.
kumaranu Jun 27, 2024
2acf47f
Moved optimizer import.
kumaranu Jun 27, 2024
695febf
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 27, 2024
f44380d
Merge branch 'main' into neb_nn
kumaranu Jun 27, 2024
dc124cc
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 27, 2024
d6f8b5f
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 27, 2024
62ab50a
pre-commit auto-fixes
pre-commit-ci[bot] Jun 27, 2024
fe98bce
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 27, 2024
92b10d3
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 27, 2024
9e76d64
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jun 27, 2024
1cadf16
pre-commit auto-fixes
pre-commit-ci[bot] Jun 27, 2024
f9c854b
Just trying to run the tests again.
kumaranu Jun 27, 2024
ad207b8
Added strip decorators to the ts_job calls inside neb_ts_job and geod…
kumaranu Jun 27, 2024
109c1d8
Added hess_method=None to avoid doing hessian calculations all the time.
kumaranu Jun 27, 2024
4143de1
Merge branch 'main' into neb_nn
kumaranu Jun 27, 2024
c79b2a1
Added opt_kwargs to the ts_job calls to allow hessian=True sella calc…
kumaranu Jun 28, 2024
2774be2
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 28, 2024
c85d539
pre-commit auto-fixes
pre-commit-ci[bot] Jun 28, 2024
70b43d3
Made tests more robust for newtonnet.
kumaranu Jun 28, 2024
bf0a280
Correct calc_kwargs and opt_kwargs to make sure hessians are calculat…
kumaranu Jun 28, 2024
c24cb76
Modified add hessian and std function to allow calc_kwargs.
kumaranu Jun 28, 2024
adc8396
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 28, 2024
a1c3c9f
pre-commit auto-fixes
pre-commit-ci[bot] Jun 28, 2024
09c9a4d
Changed ts_job call according to the requirements.
kumaranu Jun 28, 2024
dcd284a
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 28, 2024
01105ab
just corrected the newtonnet tests.
kumaranu Jun 28, 2024
0a0cff4
pre-commit auto-fixes
pre-commit-ci[bot] Jun 28, 2024
5400196
Changed opt_kwargs to ts_job_kwargs
kumaranu Jun 29, 2024
9575103
Updated newtonnet tests for ts_job_kwargs.
kumaranu Jun 29, 2024
9697a29
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 29, 2024
8c6b015
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jun 29, 2024
160fa21
Merge branch 'main' into neb_nn
Andrew-S-Rosen Jul 1, 2024
ca46eae
Merge remote-tracking branch 'origin/main' into neb_nn
kumaranu Jul 1, 2024
42d0da2
Merge branch 'Quantum-Accelerators:main' into neb_nn
kumaranu Jul 1, 2024
a7cdef2
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 1, 2024
91d556a
Auto stash before merge of "neb_nn" and "origin/neb_nn"
kumaranu Jul 2, 2024
c025d0d
Added additional fields to neb_summary.
kumaranu Jul 2, 2024
03e23a2
edited tests too. May be will change them later.
kumaranu Jul 2, 2024
045facb
pre-commit auto-fixes
pre-commit-ci[bot] Jul 2, 2024
191e3a8
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 2, 2024
9ff5d75
added geodesic_job the schemas are not added yet.
kumaranu Jul 2, 2024
b8d3f6a
added test for geodesic job
kumaranu Jul 2, 2024
d19ce44
pre-commit auto-fixes
pre-commit-ci[bot] Jul 2, 2024
fe3f2cf
Merge branch 'main' into neb_nn
kumaranu Jul 2, 2024
4254141
modified the schemas for neb_job to only contain n_images of the traj…
kumaranu Jul 2, 2024
ea6392f
Test updated for neb job to check for the length for neb_job.
kumaranu Jul 2, 2024
90943e0
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 2, 2024
fa830b1
pre-commit auto-fixes
pre-commit-ci[bot] Jul 2, 2024
363bd0c
Corrected the tests.
kumaranu Jul 3, 2024
ec3bfd8
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 3, 2024
20c3443
Merge branch 'main' into neb_nn
kumaranu Jul 3, 2024
9bb1c39
Corrected TSSchema and OptSchema in ts.py.
kumaranu Jul 3, 2024
2f5b531
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 3, 2024
f2ef51b
corrected OptSchema imports.
kumaranu Jul 3, 2024
f8b7438
Correct run_neb test.
kumaranu Jul 3, 2024
f88a6ba
pre-commit auto-fixes
pre-commit-ci[bot] Jul 3, 2024
4253d94
Edited runners/test_ase.py to pass the tests.
kumaranu Jul 3, 2024
df6c245
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 3, 2024
a0245c5
Added check environment to look for environment on quacc GitHub.
kumaranu Jul 3, 2024
273ba6b
Changed seed setting from session to module.
kumaranu Jul 3, 2024
741c780
Changed number according to GitHub tests on github.com.
kumaranu Jul 3, 2024
54312a7
Corrected numbers in the test_run_neb.
kumaranu Jul 3, 2024
994dd46
Corrected the value in pytest for run_neb.
kumaranu Jul 3, 2024
93e1356
Merge branch 'main' into neb_nn
kumaranu Jul 11, 2024
6533f83
Changed the scope of the random seed to module from session. It was s…
kumaranu Jul 11, 2024
d709cec
Added geodesic_path.xyz file to directly load the gedesic path for th…
kumaranu Jul 11, 2024
4c1b3a8
Removed unnecessary path of the code after replacing the geodesic pat…
kumaranu Jul 11, 2024
72b0134
pre-commit auto-fixes
pre-commit-ci[bot] Jul 11, 2024
1838b1c
Added n returns to neb test.
kumaranu Jul 12, 2024
13cdff4
Got rid of summar_neb_run2.
kumaranu Jul 12, 2024
59fc5e3
Added n_iter_return = -1 by default inside neb_job.
kumaranu Jul 12, 2024
b1ea1d2
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
b831ab8
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
35a13ae
Removed docstring from a test file.
kumaranu Jul 12, 2024
502253b
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
44d365a
Removed geodesic from tests/requirements.txt.
kumaranu Jul 12, 2024
7a8924b
Corrected the relative geodesic path for geodesic_path.xyz file in th…
kumaranu Jul 12, 2024
b870a7d
Added geodesic as a requirement inside the github actions job require…
kumaranu Jul 12, 2024
59ace9c
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
160b232
Added trajectory import.
kumaranu Jul 12, 2024
acce40e
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
c0c9655
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
8ae1bde
Reduced the relative threshold for error check for neb.
kumaranu Jul 12, 2024
18fd593
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
49da3eb
Changed a few numbers here to match the tests on GitHub.
kumaranu Jul 12, 2024
3120fae
swapped neb_kwargs with run_kwargs. Suggested by Andrew.
kumaranu Jul 12, 2024
dae5796
Added a dynamics object in the returned type hint.
kumaranu Jul 12, 2024
d2d8ffd
Update some loop related to periodic systems.
kumaranu Jul 12, 2024
9a6c9ca
Removed a stray comment.
kumaranu Jul 12, 2024
5ce7cd8
Cleaned up the traj file related things from run_neb.
kumaranu Jul 12, 2024
c38b6c8
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
11cd0b9
Corrected a docstring.
kumaranu Jul 12, 2024
905c906
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
cba79d3
Added sweep_cutoff_size and also change the "None" to "auto" in the g…
kumaranu Jul 12, 2024
01bfb17
Corrected the geodesic test to incorporate new tol args.
kumaranu Jul 12, 2024
979d193
Changed the geodesic test to directly put the variables inside the fu…
kumaranu Jul 12, 2024
0ff073c
Added tests for linear and idpp interpolation tests. Also edited the …
kumaranu Jul 12, 2024
d3eab91
Corrected the schema neb function to deal with the interpolate_flags …
kumaranu Jul 12, 2024
dc7c80b
Added interpolation methods from ase like linear and idpp in addition…
kumaranu Jul 12, 2024
bb58d2e
Removed has_geodesic_interpolate condition from neb_job.
kumaranu Jul 12, 2024
99bc8d5
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
39494c0
Changed geodesic_interpolate_flags to interpolate_flags inside runner…
kumaranu Jul 12, 2024
3468dcb
Increased the accuracy condition from 1e-2 to 1e-5 for geodesic neb t…
kumaranu Jul 12, 2024
6ba14ef
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
45c4070
Update test numbers in newtonnet tests.
kumaranu Jul 12, 2024
a12fad8
Corrected neb_ts_job function to have correct arguments getting passe…
kumaranu Jul 12, 2024
dd1c6cb
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
51aac67
Not sure why the geodesic numbers are not matching but updated them i…
kumaranu Jul 12, 2024
5990dfc
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 12, 2024
9c47266
Added paths to kwargs.
kumaranu Jul 12, 2024
da6c3af
Corrected neb_kwargs text in docstrings
kumaranu Jul 12, 2024
32ad251
Completely got rid of links for geodesic kwargs.
kumaranu Jul 12, 2024
6eb3582
Changed calc_kwargs to **calc_kwargs.
kumaranu Jul 12, 2024
bf752c4
Also changed the test calls to use **calc_kwargs instead of calc_kwar…
kumaranu Jul 12, 2024
b2b0466
pre-commit auto-fixes
pre-commit-ci[bot] Jul 12, 2024
d028529
Merge branch 'main' into neb_nn
Andrew-S-Rosen Jul 24, 2024
43d1504
Removed check_env.yml file.
kumaranu Jul 24, 2024
b9c8bd0
Modified _get_hessian to incorporate **calc_kwargs to allow used defi…
kumaranu Jul 24, 2024
2c46a94
pre-commit auto-fixes
pre-commit-ci[bot] Jul 24, 2024
b7cf522
Trying the resolve the issue with opt.traj's path.
kumaranu Jul 24, 2024
299c440
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 24, 2024
439de1e
Converted geodesic_path to string to have posix_path functions applie…
kumaranu Jul 24, 2024
1bd71bf
pre-commit auto-fixes
pre-commit-ci[bot] Jul 24, 2024
36d933e
Changed the posixpath to string in os.path.dirname(str(os.path.abspat…
kumaranu Jul 24, 2024
314851d
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 25, 2024
fa02d79
changed the posixpath inside os.path.dirname function.
kumaranu Jul 25, 2024
7db0b1f
pre-commit auto-fixes
pre-commit-ci[bot] Jul 25, 2024
d737a93
Merge branch 'main' into neb_nn
kumaranu Jul 25, 2024
0a40aa8
Trying to convert posixpath to str at: traj.filename = str(zpath(…
kumaranu Jul 25, 2024
81b05ce
Corrected the input with string inside zpath as suggested by Andrew.
kumaranu Jul 25, 2024
7187de3
Undid the changes in the test file for the posixpath to string conver…
kumaranu Jul 25, 2024
04bafa4
Moved custom type hints from ts.py to types.py
kumaranu Jul 25, 2024
2a7645a
pre-commit auto-fixes
pre-commit-ci[bot] Jul 25, 2024
6bea8a7
Imported the type-hints from types.py.
kumaranu Jul 25, 2024
9356e8b
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 25, 2024
e5c3aee
pre-commit auto-fixes
pre-commit-ci[bot] Jul 25, 2024
c1704a5
Merge branch 'main' into neb_nn
kumaranu Jul 27, 2024
d5b481e
Removed a comment about 5 images in the neb_job function.
kumaranu Jul 27, 2024
5689e2b
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
a673acd
Changed the key from geodesic_results to initial_images.
kumaranu Jul 27, 2024
afa79da
Again, changed the keys in the neb's returned schema from geodesic_re…
kumaranu Jul 27, 2024
c2605a5
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
c2d43f6
Changed a variable's name from i to result to make it more descriptive.
kumaranu Jul 27, 2024
9377a82
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
f9e4af6
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
326f925
Added typehints for geodesic jobs.
kumaranu Jul 27, 2024
6fa67ee
updated ts.py to have geodesic schemas instead of dicts.
kumaranu Jul 27, 2024
b88c40c
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
4b33856
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
58766ee
Removed an unnecessary check.
kumaranu Jul 27, 2024
ec95533
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
7adf08e
Moved geodesic_path.xyz file to a directory called test_files.
kumaranu Jul 27, 2024
50eaf8b
Updated tests to have correct path to the geodesic_path.xyz file.
kumaranu Jul 27, 2024
e446487
Got rid of tmp_path or unused/empty calc_kwargs from newtonnet's test…
kumaranu Jul 27, 2024
e263622
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
60b7aef
Removed neb_ts_job and geodesic_ts_job
kumaranu Jul 27, 2024
93cf42d
Removed tests for neb_ts_job and geodesic_ts_job and the respective i…
kumaranu Jul 27, 2024
003e056
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
ee28b48
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
a069d89
Removed tests for nen_ts_job and geodesic_ts_job.
kumaranu Jul 27, 2024
4c2d20f
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
24b04cd
Manually edited the recipes list in the docs. Not sure if this was th…
kumaranu Jul 27, 2024
5483d27
Not sure why this test failed. Trying the new value.
kumaranu Jul 27, 2024
79ec33d
Added a test to raise a value error in run_neb function when optimize…
kumaranu Jul 27, 2024
7da2d1d
Modified run_neb to have none as neb_kwargs.
kumaranu Jul 27, 2024
0130aa3
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
2ff1bef
Added Callable back in ase.py.
kumaranu Jul 27, 2024
0d79cbf
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
7b9a9e4
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
3c78709
Updated BFGSLineSearch check.
kumaranu Jul 27, 2024
8cab2cc
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
a41fb04
Removed underscore from geodesic because it is not private.
kumaranu Jul 27, 2024
0665ee6
Removed underscore from geodesic because it is not private.
kumaranu Jul 27, 2024
ad975ab
Removed underscore from geodesic because it is not private.
kumaranu Jul 27, 2024
e36c3ea
Changed tolerance variable names to redestribute_tol and smoother_tol.
kumaranu Jul 27, 2024
5a8b6f0
Changed tolerance variable names to redestribute_tol and smoother_tol.
kumaranu Jul 27, 2024
93a93b6
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
f6e789b
Changed the default number of n_images in geodesic to 10 instead of 20.
kumaranu Jul 27, 2024
f75f70a
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
00b0e63
corrected spelling for redistribute.
kumaranu Jul 27, 2024
7994881
Corrected assertion value.
kumaranu Jul 27, 2024
bf05f39
Moved geodesic wrapper function from ts ase to atoms directory. Also …
kumaranu Jul 27, 2024
eac9687
Removed the geodesic tests from test_ase.py and the relevant imports.
kumaranu Jul 27, 2024
d363d5e
test file for the geodesic wrapper.
kumaranu Jul 27, 2024
b47725a
getting rid of the geodesic wrapper from ase.
kumaranu Jul 27, 2024
25e79a0
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
d545f8b
Changed summarize_neb_run call.
kumaranu Jul 27, 2024
30a7dc6
Made n_images require argument in summarize_neb_run and n_iter_return…
kumaranu Jul 27, 2024
6023819
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 27, 2024
1a4b1a1
Updated run_neb test.
kumaranu Jul 27, 2024
dc4cd86
pre-commit auto-fixes
pre-commit-ci[bot] Jul 27, 2024
4e8a05c
Merge branch 'main' into neb_nn
Andrew-S-Rosen Jul 27, 2024
db157db
Update ts.py
Andrew-S-Rosen Jul 27, 2024
19685f1
Merge branch 'main' into neb_nn
kumaranu Jul 29, 2024
c2ef8cb
Removed calculator from the trajectory object in summarize neb run.
kumaranu Jul 29, 2024
f140801
Changed trajectory to atoms_trajectory in summarize_neb_run to avoid …
kumaranu Jul 29, 2024
18a58dc
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 29, 2024
05862d9
Changed i to result defined for a loop over trajectory_results.
kumaranu Jul 29, 2024
5465aa1
pre-commit auto-fixes
pre-commit-ci[bot] Jul 29, 2024
2c867db
Added typehints and docstrings to the function inside the summarize f…
kumaranu Jul 29, 2024
7c9e819
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 29, 2024
4d9dcc8
pre-commit auto-fixes
pre-commit-ci[bot] Jul 29, 2024
5d92bfa
edited docstring.
kumaranu Jul 29, 2024
c72b95a
Merge branch 'neb_nn' of https://github.com/kumaranu/quacc into neb_nn
kumaranu Jul 29, 2024
fe00971
pre-commit auto-fixes
pre-commit-ci[bot] Jul 29, 2024
9a43dff
Merge branch 'main' into neb_nn
kumaranu Jul 30, 2024
c5ddcfa
Merge branch 'main' into neb_nn
Andrew-S-Rosen Aug 13, 2024
7128288
Merge branch 'main' into neb_nn
Andrew-S-Rosen Aug 16, 2024
777160d
Merge branch 'main' into neb_nn
Andrew-S-Rosen Aug 22, 2024
68d7ec9
Update ase.py
Andrew-S-Rosen Aug 22, 2024
2ba31ad
Update ase.py
Andrew-S-Rosen Aug 22, 2024
fce697e
Merge branch 'Quantum-Accelerators:main' into neb_nn
kumaranu Aug 29, 2024
e35f912
Removed the directory paths from the log and the json files for the o…
kumaranu Aug 29, 2024
49a21db
pre-commit auto-fixes
pre-commit-ci[bot] Aug 29, 2024
fa3150f
Merge branch 'main' into neb_nn
Andrew-S-Rosen Sep 17, 2024
d65aef9
pre-commit auto-fixes
pre-commit-ci[bot] Sep 17, 2024
7bbff3b
Merge branch 'main' into neb_nn
Andrew-S-Rosen Sep 17, 2024
7c680a9
pre-commit auto-fixes
pre-commit-ci[bot] Sep 17, 2024
0f99a89
Remove unused code block
Andrew-S-Rosen Sep 19, 2024
6e374de
Merge branch 'main' into neb_nn
Andrew-S-Rosen Sep 19, 2024
c67c622
Merge branch 'main' into neb_nn
Andrew-S-Rosen Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defects = ["pymatgen-analysis-defects>=2023.8.22", "shakenbreak>=3.2.0"]
jobflow = ["jobflow[fireworks]>=0.1.14", "jobflow-remote>=0.1.0"]
mlp = ["matgl>=1.0.0", "chgnet>=0.3.3", "mace-torch>=0.3.3", "torch-dftd>=0.4.0"]
mp = ["atomate2>=0.0.14"]
newtonnet = ["newtonnet>=1.1"]
newtonnet = ["newtonnet>=1.1", "geodesic-interpolate @ git+https://github.com/virtualzx-nad/geodesic-interpolate.git"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't have direct git links in pyproject.toml (unfortunately) because PyPI does not allow us to upload new version of quacc with URLs. The best course of action here is to simply make it clear in the @requires decorator that this package should be installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Andrew-S-Rosen ,
I want to have tests that run for geodesic interpolate on GitHub. Is there a way you see to do that in case we are not able to put URLs?
Thanks.

Copy link
Member

@Andrew-S-Rosen Andrew-S-Rosen Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kumaranu: Simply remove the direct link from pyproject.toml. The requirements.txt files in the tests folder are what is used by CI.

parsl = ["parsl[monitoring]>=2023.10.23; platform_system!='Windows'"]
phonons = ["phonopy>=2.20.0", "seekpath>=2.1.0"]
prefect = ["prefect[dask]>=2.19.0", "dask-jobqueue>=0.8.2"]
Expand Down
263 changes: 262 additions & 1 deletion src/quacc/recipes/newtonnet/ts.py
Andrew-S-Rosen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

from __future__ import annotations

import os
from typing import TYPE_CHECKING

from ase import Atoms
from ase.atoms import Atoms
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
from ase.io import Trajectory, read, write
from ase.mep.neb import NEBOptimizer
from ase.neb import NEB
from geodesic_interpolate.fileio import write_xyz
from geodesic_interpolate.geodesic import Geodesic
from geodesic_interpolate.interpolation import redistribute
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
from monty.dev import requires

from quacc import SETTINGS, change_settings, job, strip_decorator
Expand All @@ -17,6 +26,11 @@
except ImportError:
Sella = None

try:
from ase.mep import neb
except ImportError:
neb = None
kumaranu marked this conversation as resolved.
Show resolved Hide resolved

try:
from newtonnet.utils.ase_interface import MLAseCalculator as NewtonNet
except ImportError:
Expand All @@ -25,7 +39,7 @@
if TYPE_CHECKING:
from typing import Any, Literal

from ase.atoms import Atoms
from ase.optimize.optimize import Optimizer
from numpy.typing import NDArray

from quacc.recipes.newtonnet.core import FreqSchema
Expand Down Expand Up @@ -287,3 +301,250 @@
ml_calculator.calculate(atoms)

return ml_calculator.results["hessian"].reshape((-1, 3 * len(atoms)))


"""
@job
@requires(NewtonNet, "NewtonNet must be installed. Refer to the quacc documentation.")
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
def neb_job(
atoms: Atoms,
relax_endpoints: bool = True,
run_geodesic: bool = True,
run_single_ended: bool = True,
run_freq: bool = True,
neb_job_kwargs: dict[str, Any] | None = None,
relax_job_kwargs: dict[str, Any] | None = None,
freq_job_kwargs: dict[str, Any] | None = None,
):
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
relax_job_kwargs = relax_job_kwargs or {}
freq_job_kwargs = freq_job_kwargs or {}

irc_job_defaults = {"max_steps": 5}
irc_job_kwargs = recursive_dict_merge(irc_job_defaults, irc_job_kwargs)

# Run IRC
irc_summary = strip_decorator(irc_job)(
atoms, direction=direction, run_freq=False, **irc_job_kwargs
)

# Run opt
relax_summary = strip_decorator(relax_job)(irc_summary["atoms"], **relax_job_kwargs)

# Run frequency
freq_summary = (
strip_decorator(freq_job)(relax_summary["atoms"], **freq_job_kwargs)
if run_freq
else None
)
relax_summary["freq_job"] = freq_summary
relax_summary["irc_job"] = irc_summary

return relax_summary
"""


def sella_wrapper(
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
atoms_object,
traj_file=None,
sella_order=0,
use_internal=True,
traj_log_interval=2,
fmax_cutoff=1e-3,
max_steps=1000,
):
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
if traj_file:
traj = Trajectory(traj_file, "w", atoms_object)
qn = Sella(atoms_object, order=sella_order, internal=use_internal)
if traj_file:
qn.attach(traj.write, interval=traj_log_interval)
qn.run(fmax=fmax_cutoff, steps=max_steps)
if traj_file:
traj.close()
kumaranu marked this conversation as resolved.
Show resolved Hide resolved


def geodesic_interpolate_wrapper(
r_p_atoms: Atoms,
nimages: int = 17,
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
sweep: bool | None = None,
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
output: str = "interpolated.xyz",
tol: float = 2e-3,
maxiter: int = 15,
microiter: int = 20,
scaling: float = 1.7,
friction: float = 1e-2,
dist_cutoff: float = 3,
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
save_raw: str | None = None,
):
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
"""
Interpolates between two geometries and optimizes the path.

Parameters:
filename (str): XYZ file containing geometries.
nimages (int): Number of images. Default is 17.
sweep (bool): Sweep across the path optimizing one image at a time.
Default is to perform sweeping updates if there are more than 35 atoms.
output (str): Output filename. Default is "interpolated.xyz".
tol (float): Convergence tolerance. Default is 2e-3.
maxiter (int): Maximum number of minimization iterations. Default is 15.
microiter (int): Maximum number of micro iterations for sweeping algorithm. Default is 20.
scaling (float): Exponential parameter for Morse potential. Default is 1.7.
friction (float): Size of friction term used to prevent very large change of geometry. Default is 1e-2.
dist_cutoff (float): Cut-off value for the distance between a pair of atoms to be included in the coordinate system. Default is 3.
save_raw (str): When specified, save the raw path after bisections but before smoothing. Default is None.
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
"""
# Read the initial geometries.
symbols = r_p_atoms[0].get_chemical_symbols()

X = [conf.get_positions() for conf in r_p_atoms]
kumaranu marked this conversation as resolved.
Show resolved Hide resolved

if len(X) < 2:
raise ValueError("Need at least two initial geometries.")

Check warning on line 401 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L401

Added line #L401 was not covered by tests

# First redistribute number of images. Perform interpolation if too few and subsampling if too many images are given
raw = redistribute(symbols, X, nimages, tol=tol * 5)
if save_raw is not None:
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
write_xyz(save_raw, symbols, raw)

Check warning on line 406 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L406

Added line #L406 was not covered by tests
kumaranu marked this conversation as resolved.
Show resolved Hide resolved

# Perform smoothing by minimizing distance in Cartesian coordinates with redundant internal metric
# to find the appropriate geodesic curve on the hyperspace.
smoother = Geodesic(symbols, raw, scaling, threshold=dist_cutoff, friction=friction)
if sweep is None:
sweep = len(symbols) > 35
try:
if sweep:
smoother.sweep(tol=tol, max_iter=maxiter, micro_iter=microiter)

Check warning on line 415 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L415

Added line #L415 was not covered by tests
else:
smoother.smooth(tol=tol, max_iter=maxiter)
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
finally:
# Save the smoothed path to output file. try block is to ensure output is saved if one ^C the process, or there is an error
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
write_xyz(output, symbols, smoother.path)
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
return symbols, smoother.path


def setup_images(logdir: str, xyz_r_p: str, n_intermediate: int = 40):
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
"""
Sets up intermediate images for NEB calculations between reactant and product states.

Parameters:
logdir (str): Directory to save the intermediate files.
xyz_r_p (str): Path to the XYZ file containing reactant and product structures.
n_intermediate (int): Number of intermediate images to generate.

Returns:
List: List of ASE Atoms objects with calculated energies and forces.
"""
calc_defaults = {
"model_path": SETTINGS.NEWTONNET_MODEL_PATH,
"settings_path": SETTINGS.NEWTONNET_CONFIG_PATH,
}

calc_flags = recursive_dict_merge(calc_defaults, {})

try:
# Ensure the log directory exists
os.makedirs(logdir, exist_ok=True)
kumaranu marked this conversation as resolved.
Show resolved Hide resolved

# Read reactant and product structures
reactant = read(xyz_r_p, index="0")
product = read(xyz_r_p, index="1")

# Optimize reactant and product structures using sella
for atom, name in zip([reactant, product], ["reactant", "product"]):
# atom.calc = calc()
atom.calc = NewtonNet(**calc_flags)
traj_file = os.path.join(logdir, f"{name}_opt.traj")
sella_wrapper(atom, traj_file=traj_file, sella_order=0)
# Save optimized reactant and product structures
r_p_path = os.path.join(logdir, "r_p.xyz")
write(r_p_path, [reactant.copy(), product.copy()])

# Generate intermediate images using geodesic interpolation
symbols, smoother_path = geodesic_interpolate_wrapper(
[reactant.copy(), product.copy()]
)
images = [Atoms(symbols=symbols, positions=conf) for conf in smoother_path]

# Calculate energies and forces for each intermediate image
for image in images:
# image.calc = calc()
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
# ml_calculator = calc()
image.calc = NewtonNet(**calc_flags)
ml_calculator = NewtonNet(**calc_flags)
ml_calculator.calculate(image)

energy = ml_calculator.results["energy"]
forces = ml_calculator.results["forces"]

image.info["energy"] = energy
image.arrays["forces"] = forces

# Save the geodesic path
geodesic_path = os.path.join(logdir, "geodesic_path.xyz")
write(geodesic_path, images)

return images

except Exception:
return []

Check warning on line 488 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L487-L488

Added lines #L487 - L488 were not covered by tests


def run_neb_method(
method: str,
optimizer: Optimizer | None = NEBOptimizer,
opt_method: str | None = "aseneb",
precon: str | None = None,
logdir: str | None = None,
xyz_r_p: str | None = None,
n_intermediate: int | None = 20,
k: float | None = 0.1,
max_steps: int | None = 1000,
fmax_cutoff: float | None = 1e-2,
) -> None:
kumaranu marked this conversation as resolved.
Show resolved Hide resolved
"""
Run NEB method.

Args:
method (str): NEB method.
optimizer (Optimizer, Optional): NEB path Optimizer function, Defaults to NEBOptimizer.
precon (str, optional): Preconditioner method. Defaults to None.
opt_method (str, Optimizer): Optimization method. Defaults to aseneb.
logdir (str, optional): Directory to save logs. Defaults to None.
xyz_r_p (str, optional): Path to reactant and product XYZ files. Defaults to None.
n_intermediate (int, optional): Number of intermediate images. Defaults to 20.
k (float, optional): force constant for the springs in NEB. Defaults to 0.1.
max_steps (int, optional): maximum number of optimization steps allowed. Defaults to 1000.
fmax_cutoff (float: optional): convergence cut-off criteria for the NEB optimization. Defaults to 1e-2.
"""
images = setup_images(logdir, xyz_r_p, n_intermediate=n_intermediate)

Check warning on line 518 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L518

Added line #L518 was not covered by tests

mep = NEB(

Check warning on line 520 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L520

Added line #L520 was not covered by tests
images,
k=k,
method=method,
climb=True,
precon=precon,
remove_rotation_and_translation=True,
parallel=True,
)

os.makedirs(logdir, exist_ok=True)
log_filename = f"neb_band_{method}_{optimizer.__name__}_{precon}.txt"

Check warning on line 531 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L530-L531

Added lines #L530 - L531 were not covered by tests

logfile_path = os.path.join(logdir, log_filename)

Check warning on line 533 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L533

Added line #L533 was not covered by tests

opt = optimizer(mep, method=opt_method, logfile=logfile_path, verbose=2)

Check warning on line 535 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L535

Added line #L535 was not covered by tests

opt.run(fmax=fmax_cutoff, steps=max_steps)

Check warning on line 537 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L537

Added line #L537 was not covered by tests

# The following was written because of some error in writing the xyz file below
images_copy = []
for image in images:
image_copy = Atoms(symbols=image.symbols, positions=image.positions)
image_copy.info["energy"] = image.get_potential_energy()
images_copy.append(image_copy)

Check warning on line 544 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L540-L544

Added lines #L540 - L544 were not covered by tests

write(

Check warning on line 546 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L546

Added line #L546 was not covered by tests
f"{logdir}/optimized_path_{method}_{optimizer.__name__}_{precon}.xyz",
images_copy,
)
return images

Check warning on line 550 in src/quacc/recipes/newtonnet/ts.py

View check run for this annotation

Codecov / codecov/patch

src/quacc/recipes/newtonnet/ts.py#L550

Added line #L550 was not covered by tests
Loading
Loading