TheochemUI / eOn

eOn v3 and beyond
https://theochemui.github.io/eOn/
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

ENH: Add the energy weighted springs #77

Closed HaoZeke closed 7 months ago

HaoZeke commented 7 months ago

As implemented from J. Chem. Theory Comput. 2021, 17, 4929−4945. Basically just: image image

For results, consider the CuH2 case:

cd client
meson setup builddir --buildtype=release --optimization=3
meson compile -C builddir
cd builddir
cp ../gtests/data/systems/cuh2_neb_test/* .
cp min1_0Cu.con reactant.con
cp min2_0Cu.con product.con

Along with the following config:

[Main]
job = nudged_elastic_band
random_seed = 706253457

[Potential]
potential = cuh2

[Nudged Elastic Band]
images = 8
spring = 9.7
climbing_image_method = true
climbing_image_converged_only = true
energy_weighted = true
ew_ksp_min = 0.97
ew_ksp_max = 9.72

[Optimizer]
opt_method = qm
max_iterations = 2000
max_move = 0.1
converged_force = 0.05
convergence_metric = norm

[Refine]
opt_method = lbfgs
threshold = 0.3

[QuickMin]
time_step = 0.8

[Debug]
write_movies=true
HaoZeke commented 7 months ago

Without EW:

(./eonclient 2>&1) | tee eon_no_ew
EON Client
VERSION: rUnversioned directory
BUILD DATE: Tue Sep 12 01:19:48 PM GMT 2023

Hostname: rgx1gen11
OS: Linux
Arch: x86_64
PID: 2462479
DIR: /home/rgoswami/Git/Github/TheochemUI/EONgit/client/builddir

Loading parameter file config.ini
* [Main] job: nudged_elastic_band
* [Main] random_seed: 706253457
* [Potential] potential: cuh2
* [Debug] write_movies: true
* [Optimizer] opt_method: qm
* [Optimizer] convergence_metric: norm
* [Refine] opt_method: lbfgs
* [Refine] threshold: 0.3
* [Optimizer] converged_force: 0.05
* [Optimizer] max_iterations: 2000
* [Optimizer] max_move: 0.1
* [QuickMin] time_step: 0.8
* [Nudged Elastic Band] images: 8
* [Nudged Elastic Band] spring: 9.7
* [Nudged Elastic Band] climbing_image_method: true
* [Nudged Elastic Band] climbing_image_converged_only: true
* [Nudged Elastic Band] energy_weighted: false
* [Nudged Elastic Band] ew_ksp_min: 0.97
* [Nudged Elastic Band] ew_ksp_max: 9.72

NEB: initializing with linear path

Nudged elastic band calculation started.
 iteration    step size      ||Force||   max image   max energy
---------------------------------------------------------------

         1   0.0000e+00     9.0222e-01           4        4.261
         2   5.0170e-02     9.2644e-01           4        4.258
         3   8.3994e-02     9.8394e-01           4        4.251
         4   1.0000e-01     1.0564e+00           4        4.241
         5   1.0000e-01     1.2283e+00           4        4.215
         6   1.0000e-01     1.4062e+00           4        4.186
         7   1.0000e-01     1.6148e+00           4        4.151
         8   1.0000e-01     2.0609e+00           4        4.072
         9   6.9057e-02     3.2515e+00           4        3.841
        10   4.3362e-02     1.1195e+00           5        3.732
        11   5.2322e-02     1.1132e+00           5        3.738
        12   7.1761e-02     1.1102e+00           5        3.744
        13   9.6627e-02     1.1157e+00           5        3.747
        14   1.0000e-01     1.1372e+00           5        3.745
        15   1.0000e-01     1.2252e+00           5        3.728
        16   8.3558e-02     1.6154e+00           5        3.645
        17   5.5454e-02     2.2282e+00           5        3.497
        18   5.3662e-02     2.8651e+00           5        3.325
        19   5.6817e-02     3.4960e+00           5        3.132
        20   7.4278e-02     4.1536e+00           5        2.888
        21   9.2656e-02     1.5928e+00           6        2.788
        22   5.3556e-02     1.5862e+00           6        2.785
        23   6.9788e-02     1.5735e+00           6        2.787
        24   8.7584e-02     1.5581e+00           6        2.789
        25   9.4275e-02     1.5612e+00           6        2.778
        26   7.9856e-02     1.6930e+00           6         2.71
        27   7.0050e-02     2.1323e+00           6        2.535
        28   6.0459e-02     2.3916e+00           6        2.412
        29   7.3272e-02     2.6600e+00           6        2.283
        30   5.4883e-02     3.0471e+00           6        2.097
        31   7.2565e-02     3.3896e+00           6        1.867
        32   8.4186e-02     3.3713e+00           6        1.668
        33   9.2150e-02     2.8898e+00           6        1.548
        34   8.7264e-02     2.3116e+00           6        1.464
        35   8.3249e-02     1.8936e+00           6        1.358
        36   8.0489e-02     1.6091e+00           6        1.235
        37   6.9130e-02     1.4259e+00           6        1.125
        38   4.8777e-02     1.3406e+00           6         1.07
        39   2.0545e-02     1.3068e+00           6        1.047
        40   2.1605e-02     1.2555e+00           6        1.014
        41   2.7023e-02     1.1898e+00           6       0.9736
        42   3.1885e-02     1.1103e+00           6       0.9289
        43   3.6459e-02     1.0164e+00           6       0.8817
        44   4.0938e-02     9.0710e-01           6       0.8351
        45   4.4014e-02     7.8271e-01           6       0.7928
        46   4.9132e-02     6.7098e-01           6        0.764
        47   1.5231e-02     6.5289e-01           6       0.7603
        48   1.5003e-02     6.1649e-01           6       0.7535
        49   1.3568e-02     5.7516e-01           6       0.7466
        50   1.4051e-02     5.2606e-01           6       0.7397
        51   1.7285e-02     4.6972e-01           6       0.7334
        52   1.8539e-02     4.1169e-01           6       0.7286
        53   1.8569e-02     3.6809e-01           6        0.726
        54   9.8549e-03     3.4828e-01           6       0.7252
        55   6.9328e-03     3.2360e-01           6       0.7243
        56   7.8767e-03     2.9295e-01           6       0.7235
Switched to Limited memory Broyden-Fletcher-Goldfarb-Shanno optimizer
        57   9.4128e-02     2.0809e-01           6       0.7312
        58   5.8937e-02     1.6386e-01           6       0.7288
        59   5.0887e-02     1.8993e-01           6       0.7308
        60   2.1802e-03     1.8200e-01           6       0.7305
        61   6.9151e-02     3.2280e-01           6       0.7155
        62   1.4470e-03     3.1740e-01           6        0.716
        63   2.9847e-03     3.0590e-01           6       0.7171
        64   4.6407e-03     2.8774e-01           6       0.7189
        65   1.8756e-02     2.7805e-01           6       0.7243
        66   7.8698e-02     4.3984e-01           6       0.7263
        67   4.6576e-03     4.3467e-01           6       0.7256
        68   7.9000e-03     4.2249e-01           6       0.7242
        69   9.9899e-03     3.9656e-01           6        0.722
        70   1.1361e-02     3.5417e-01           6       0.7202
        71   1.1842e-02     3.0443e-01           6       0.7198
        72   1.1892e-02     2.5026e-01           6       0.7206
        73   6.9105e-02     3.8581e-01           6       0.7328
        74   3.8694e-03     3.6961e-01           6       0.7332
        75   5.3882e-03     3.4385e-01           6       0.7337
        76   7.0640e-03     3.1024e-01           6       0.7341
        77   8.5533e-03     2.7177e-01           6        0.734
        78   1.8767e-02     2.0725e-01           6       0.7318
        79   7.1403e-02     3.3606e-01           6       0.7145
        80   9.0490e-03     3.3080e-01           6       0.7151
        81   1.4750e-02     3.1703e-01           6       0.7166
        82   1.4820e-03     3.1145e-01           6       0.7171
        83   2.8678e-03     3.0055e-01           6       0.7183
        84   4.1518e-03     2.8446e-01           6       0.7199
        85   1.4964e-02     1.9598e-01           6       0.7247
        86   9.0577e-02     4.1342e-01           6        0.709
        87   4.6735e-03     4.0376e-01           6       0.7101
        88   7.8866e-03     3.8062e-01           6       0.7125
        89   6.0834e-03     3.4767e-01           6       0.7156
        90   7.5094e-03     3.0698e-01           6       0.7191
        91   8.5399e-03     2.6130e-01           6       0.7224
        92   5.5099e-02     8.4709e-02           6       0.7269
        93   1.8209e-02     1.9460e-02           6       0.7259
NEB converged

  0     0.000000     0.000000    -0.001046
  1     0.915806     0.002309    -0.004580
  2     1.843285     0.010799    -0.015718
  3     2.745480     0.035845    -0.043408
  4     3.674296     0.101712    -0.107789
  5     4.586791     0.265794    -0.243935
  6     5.506509     0.725900    -0.000536
  7     5.944768     0.458450     0.734503
  8     6.377810     0.247096     0.260349
  9     6.812369     0.197119    -0.000059
Found 2 extrema
Energy reference: -0.0017562905660497563
extrema #1 at image position 6.000244409866487 with energy 0.7259000713305713 and curvature -0.9615230291605937
extrema #2 at image position 8.99919731259756 with energy 0.19711919974685738 and curvature 0.07388457083278656
Final state: 
Nudged elastic band, successful.
timing information:
real      1.016 seconds
user      1.227 seconds
sys       0.767 seconds

Which can be plotted via python -m plot_all_neb if tools is in PYTHONPATH we get:

no_ew

_potcalls.log notes that [cuh2] was called 754 times

HaoZeke commented 7 months ago

With EW:

(./eonclient 2>&1) | tee eon_ew_fix
EON Client
VERSION: rUnversioned directory
BUILD DATE: Tue Sep 12 01:19:48 PM GMT 2023

Hostname: rgx1gen11
OS: Linux
Arch: x86_64
PID: 2460819
DIR: /home/rgoswami/Git/Github/TheochemUI/EONgit/client/builddir

Loading parameter file config.ini
* [Main] job: nudged_elastic_band
* [Main] random_seed: 706253457
* [Potential] potential: cuh2
* [Debug] write_movies: true
* [Optimizer] opt_method: qm
* [Optimizer] convergence_metric: norm
* [Refine] opt_method: lbfgs
* [Refine] threshold: 0.3
* [Optimizer] converged_force: 0.05
* [Optimizer] max_iterations: 2000
* [Optimizer] max_move: 0.1
* [QuickMin] time_step: 0.8
* [Nudged Elastic Band] images: 8
* [Nudged Elastic Band] spring: 9.7
* [Nudged Elastic Band] climbing_image_method: true
* [Nudged Elastic Band] climbing_image_converged_only: true
* [Nudged Elastic Band] energy_weighted: true
* [Nudged Elastic Band] ew_ksp_min: 0.97
* [Nudged Elastic Band] ew_ksp_max: 9.72

NEB: initializing with linear path

Nudged elastic band calculation started.
 iteration    step size      ||Force||   max image   max energy
---------------------------------------------------------------

         1   0.0000e+00     9.0222e-01           4        4.261
         2   5.0774e-02     9.2644e-01           4        4.258
         3   8.6036e-02     9.8325e-01           4        4.251
         4   1.0000e-01     1.0533e+00           4        4.241
         5   1.0000e-01     1.1646e+00           4        4.224
         6   1.0000e-01     1.3640e+00           4        4.193
         7   1.0000e-01     1.5995e+00           4        4.152
         8   1.0000e-01     1.9420e+00           4        4.091
         9   1.0000e-01     2.6829e+00           4        3.949
        10   1.0000e-01     1.0756e+00           5        3.795
        11   1.0000e-01     1.0860e+00           5        3.795
        12   1.0000e-01     1.1229e+00           5        3.784
        13   1.0000e-01     1.2432e+00           5        3.747
        14   1.0000e-01     1.6873e+00           5        3.622
        15   1.0000e-01     2.4949e+00           5        3.359
        16   8.8045e-02     1.4284e+00           6        3.166
        17   7.5432e-02     1.4321e+00           6        3.145
        18   8.7414e-02     1.4682e+00           6        3.099
        19   8.6028e-02     1.5885e+00           6        3.007
        20   7.0267e-02     1.8042e+00           6        2.861
        21   4.6103e-02     1.9574e+00           6        2.744
        22   3.5724e-02     2.0658e+00           6        2.651
        23   4.3327e-02     2.1790e+00           6         2.54
        24   5.1227e-02     2.2676e+00           6        2.412
        25   5.9364e-02     2.2818e+00           6        2.276
        26   6.7202e-02     2.1793e+00           6        2.141
        27   7.5505e-02     1.9839e+00           6        2.007
        28   8.2550e-02     1.7804e+00           6        1.861
        29   8.9696e-02     1.6242e+00           6        1.689
        30   9.2496e-02     1.5047e+00           6        1.503
        31   8.1411e-02     1.3998e+00           6         1.34
        32   4.4690e-02     1.3707e+00           6        1.299
        33   1.8129e-02     1.3446e+00           6        1.266
        34   2.4366e-02     1.3078e+00           6        1.221
        35   2.9908e-02     1.2595e+00           6        1.168
        36   3.5028e-02     1.1985e+00           6        1.108
        37   3.9573e-02     1.1234e+00           6        1.044
        38   4.3384e-02     1.0329e+00           6       0.9799
        39   4.6212e-02     9.2620e-01           6       0.9176
        40   4.7652e-02     8.0409e-01           6       0.8612
        41   5.2630e-02     6.7455e-01           6       0.8152
        42   4.9388e-02     5.7512e-01           6        0.788
        43   1.1959e-02     5.6674e-01           6        0.786
        44   1.4760e-02     5.4808e-01           6       0.7816
        45   1.5382e-02     5.2304e-01           6       0.7761
        46   2.0144e-02     4.9027e-01           6       0.7694
        47   2.4777e-02     4.5027e-01           6       0.7619
        48   2.9232e-02     4.0391e-01           6       0.7542
        49   3.3504e-02     3.5241e-01           6       0.7468
        50   3.7559e-02     2.9728e-01           6       0.7402
Switched to Limited memory Broyden-Fletcher-Goldfarb-Shanno optimizer
        51   1.0000e-01     1.5828e-01           6        0.729
        52   1.0000e-01     5.3631e-02           6        0.726
        53   1.0000e-01     1.0392e-02           6       0.7259
NEB converged

  0     0.000000     0.000000    -0.002114
  1     1.869854     0.011667    -0.018316
  2     3.362260     0.073951    -0.079237
  3     4.278100     0.192029    -0.190854
  4     4.861386     0.359258    -0.395305
  5     5.256317     0.559100    -0.655110
  6     5.563076     0.725877     0.000226
  7     5.804506     0.611188     0.767767
  8     6.065351     0.412983     0.663275
  9     6.868634     0.197119    -0.000114
Found 2 extrema
Energy reference: -0.0017562905660497563
extrema #1 at image position 5.9998843481849224 with energy 0.7258765959570231 and curvature -0.5989228347817753
extrema #2 at image position 8.999506571370446 with energy 0.19711919551343682 and curvature 0.2303423658868322
Final state: 
Nudged elastic band, successful.
timing information:
real      0.713 seconds
user      0.950 seconds
sys       0.750 seconds

Which can be plotted the same way to get:

with_ew

_potcalls.log notes that [cuh2] was called 434 times

HaoZeke commented 7 months ago

Finally, via python -m compare_neb eon_no_ew eon_ew we get:

Extrema #1 differences:
Position: 0.00036006168156443863
Energy: 2.3475373548187406e-05
Curvature: 0.3626001943788184
Extrema #2 differences:
Position: 0.0003092587728854568
Energy: 4.233420558552581e-09
Curvature: 0.15645779505404567

Since the positions are almost the same, and the energies are similar enough, this seems to be correct.

HaoZeke commented 4 months ago

image From a 2000 paper