Improvements of LZSH algorithm#159
Conversation
Current implementation allows for hops like (05-->01), which is not compatible with the LZ formula that was derived for two-state problem. This commit changes it and evaluates it only for closest neighbours.
LZSH exhibits large problems when discontinuities in energies are encountered. Simple warning based on large change in second derivatives is added. It was tested on azobenzene and bilirubin and it was able to warn when suspicious hops occured. Also warning about too many states was added at the beginning of the output file.
This unfortunately means we can no longer test with gfortran-7.
danielhollas
left a comment
There was a problem hiding this comment.
Cool! These look like very important fixes. I mostly have just a couple of clarifying questions.
In general, don't be afraid to spell things out a bit more in the code comments to make things super-clear for anybody who might look at this code. Thanks!
(note, the tests are not running because of the old Ubuntu version, I am fixing that in #160
The only significant change is a new condition for discontinuities.
GHA: Update Ubuntu version to 20.04
|
@JanosJiri are you compiling locally with MPI? Looks like the TERAPI-LZ tests are failing. |
|
@danielhollas No, I didn't compile it with MPI. I had general issues with MPI here so I even did not try. |
|
@JanosJiri anything I can help with to get this over the finish line? |
@danielhollas I know the problem is in the TERAPI-LZ test but I was not able to compile ABIN with MPI here. So I don't see where exactly it failed. I just know it did not hop in the test suite. I will try to compile it again but I won't have time to do it soon. |
|
Cool, thanks! In terms of compiling with MPI, I'd recommend using the |
|
@JanosJiri I've looked at the failing test I am not sure if this is expected, since the PES seems fine to me at first glance. Here are the curves between S2 and S1 states Zoomed out view that includes S0 (of course this is a synthetic test but the curves don't seem unrealistic to me) |
@danielhollas Thanks for looking at it and also sorry for taking such a long time with it. I believe the problem is in the test, not in the code. The 'smoothness' check I implemented compares the current second derivative of the energy difference with the previous one. However, since this hops on the third step of the algorithm, there is no previous second derivative to compare with. Or rather the 4th energy in the array is still zero generating an artificial second derivative. So I believe this can be solved by adding one more data point before the hopping step. All should be fine then. I will have a look but in a three weeks when I will be back from holidays. |
|
No worries at all! Ah, that is tricky indeed. Let's discuss when you get back. Enjoy the well deserved break! |
Modification of TERAPI-LZ test to be compatible with the new modifications of the LZ algorithm. The problem was just three steps. Thus, the previous second derivative used in the discontinuity check was still set to 0 which caused the code to think there is a discontinuity. One more step was artificially added so that it has also the previous second derivative.
|
@danielhollas I modified the test so that it has one more step before hopping. It worked on neon so hopefully it will work also here. |
|
@JanosJiri Thanks for fixing the test!
I am not sure I agree that the problem was in the test though (or at least I wouldn't phrase it that way). Before this PR it was perfectly legal to jump on the third step (but not in the first two steps). After this change, we're essentially disallowing any hopping before 4th steps. I guess that is okay, but I am not very happy that there is a misleading warning emitted if the system wants to jump in the third step (i.e. user might think there was discontinuity, even though in reality there wasn't). @JanosJiri Let me know your thoughts. I am happy to merge this as is, and we can improve upon this later. 🚀 |
First of all, I agree it is not ideal but there shouldn't be a big problem. The problem is that it won't allow hopping the 2nd step of simulation (not 3rd, 3rd is propagation after hopping) because it has no memory of second derivatives. This should not be a problem when launching the simulations, because in LZ, you should not hop so early, the theory isn't derived for that (it assumes long propagation in the coupling region). The only problem might occur when restarting simulation. I would merge it and later we can add the second derivative memory to the restart files, which is the only problem I see. |
danielhollas
left a comment
There was a problem hiding this comment.
Okay, sounds good, thanks @JanosJiri
Codecov Report
@@ Coverage Diff @@
## master #159 +/- ##
==========================================
- Coverage 92.39% 92.37% -0.03%
==========================================
Files 43 43
Lines 6065 6084 +19
Branches 735 741 +6
==========================================
+ Hits 5604 5620 +16
- Misses 449 452 +3
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Ugh, I thought I had already merged this. Merging now, apologies for the delay. |




This commit slightly modifies the LZ code to fix issues we encountered for several molecules.
Btw, the simple velocity rescaling right be also a problem for LZSH but this was not modified.