Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
a162548
LZ hopping probabily evaluated only to neighbouring states
JanosJiri Apr 6, 2023
854a967
Warning for discontinuities in Landau Zener
JanosJiri Apr 12, 2023
14749f6
GHA: Update Ubuntu version to 20.04
danielhollas Apr 12, 2023
5ac7a49
Fix gcc versions
danielhollas Apr 12, 2023
ad668cb
More fixes
danielhollas Apr 12, 2023
5d0e95a
FFTW tests seems to work now
danielhollas Apr 12, 2023
f77a531
include OS version in cache keys
danielhollas Apr 12, 2023
802d7e3
Update Plumed versions
danielhollas Apr 12, 2023
86a7cd1
Try if GCC9 is available in Ubuntu 22.04
danielhollas Apr 12, 2023
9fa909a
Update actions/checkout
danielhollas Apr 12, 2023
d92acbc
codecov: Update number of builds
danielhollas Apr 12, 2023
1df8765
verbose codecov
danielhollas Apr 12, 2023
3899eae
Trying to fix codecov gcov paths
danielhollas Apr 12, 2023
7e0d57f
do not install gcov
danielhollas Apr 12, 2023
42ccabf
Run gcov manually
danielhollas Apr 12, 2023
f2034d9
Remove verbose
danielhollas Apr 12, 2023
8ea5179
revert codecov.yml changes that did not do anything
danielhollas Apr 12, 2023
b6680cc
simplify codecov yaml
danielhollas Apr 12, 2023
de71492
Add gcov options to fix coverage?
danielhollas Apr 12, 2023
9af96a7
Install gcc-7
danielhollas Apr 12, 2023
5794619
Try again
danielhollas Apr 12, 2023
2ab40ba
Use gcov args as in codecov
danielhollas Apr 12, 2023
bd1ccf1
Install g++-7
danielhollas Apr 12, 2023
0978931
Only install gcc-7 when needed
danielhollas Apr 12, 2023
9348290
Try without codecov arguments
danielhollas Apr 12, 2023
effa476
Back to 18 builds
danielhollas Apr 12, 2023
f1c63f6
GCC-7 with mpich
danielhollas Apr 12, 2023
35e1904
-fprofile-abs-path
danielhollas Apr 12, 2023
966023a
gcc-7 doesn't have the -fprofiles-abs-path option
danielhollas Apr 12, 2023
b7ef49a
Update actions/cache
danielhollas Apr 12, 2023
b6d445a
fix unit test coverage
danielhollas Apr 12, 2023
477e67a
Ignore utils
danielhollas Apr 12, 2023
01e3597
fftw gcov from codecov
danielhollas Apr 12, 2023
6d8a8c6
plumed gcov
danielhollas Apr 12, 2023
e7cd6e9
gcov mpi
danielhollas Apr 12, 2023
4761ee4
Cleanup
danielhollas Apr 12, 2023
9e4d2b0
Try without -finstrument-functions
danielhollas Apr 12, 2023
26f1805
try -Og for fftw build
danielhollas Apr 12, 2023
e564cc8
Try ubuntu 22.04 for the fftw build
danielhollas Apr 12, 2023
7e9ee70
try enabling method and macro branch detection
danielhollas Apr 12, 2023
a50d4f3
Revert "try enabling method and macro branch detection"
danielhollas Apr 12, 2023
764728a
Add -fcheck=all compilation flag
danielhollas Apr 15, 2023
e72ae20
-fno-inline
danielhollas Apr 15, 2023
72a7665
Fix out-of-bounds array access in nhc init
danielhollas Apr 15, 2023
3d01eca
no-early-inlining
danielhollas Apr 15, 2023
f14fcfc
revert
danielhollas Apr 15, 2023
c2569a8
fcheck not all
danielhollas Apr 15, 2023
29fc214
-g
danielhollas Apr 15, 2023
2545f39
fcheck and fsanitize conditionally
danielhollas Apr 15, 2023
48c2a16
fix
danielhollas Apr 15, 2023
2abff53
more fix
danielhollas Apr 15, 2023
81e074d
always run e2etest even if unit tests fail
danielhollas Apr 15, 2023
f12f5bc
Do not run MM unit tests
danielhollas Apr 15, 2023
cf292da
Do not run spline unit tests
danielhollas Apr 15, 2023
eaa344f
Fix MM leak?
danielhollas Apr 15, 2023
56aa52e
Deallocate fix
danielhollas Apr 15, 2023
9c1d760
Disable most tests
danielhollas Apr 15, 2023
39dc950
Remove disabled macro
danielhollas Apr 15, 2023
c507356
Addressing comments of DH from previous pull request
JanosJiri Apr 17, 2023
70a1327
Merge pull request #160 from PHOTOX/gha-ubuntu-update
JanosJiri Apr 17, 2023
01a6662
Merge branch 'master' into lzsh
JanosJiri Apr 17, 2023
01a7889
Correcting typo and modified test reference for LZ_SS
JanosJiri Apr 18, 2023
a91c6bc
Modifying TERAPI-LZ test
JanosJiri Jul 14, 2023
1d1d841
Merge branch 'master' into lzsh
danielhollas Jul 27, 2023
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
8 changes: 7 additions & 1 deletion src/abin.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ program abin
& nwrite, nstep, ncalc, it, inormalmodes, istage, irest
use mod_init, only: init
use mod_sh, only: surfacehop, sh_init, get_nacm, move_vars
use mod_lz, only: lz_hop, en_array_lz, lz_rewind
use mod_lz, only: lz_hop, en_array_lz, lz_rewind, nsinglet_lz, ntriplet_lz
use mod_kinetic, only: temperature
use mod_utils, only: del_file, archive_file
use mod_transform, only: initialize_pi_transforms, &
Expand Down Expand Up @@ -68,6 +68,12 @@ program abin
write (stdout, '(A)') 'Job started at: '//trim(get_formatted_date_and_time(time_start))
write (stdout, *) ''

! LZ warning for too many states
if (ipimd == 5 .and. (nsinglet_lz > 2 .or. ntriplet_lz > 2 )) then
Comment thread
danielhollas marked this conversation as resolved.
write (*, *) 'WARNING: LZ was derived for a two-state problem. More states might cause unphysical behavior.'
write (stdout, *) ''
end if

! Transform coordinates and velocities for Path Integral MD
! (staging or normal modes)
if (istage == 1 .or. inormalmodes > 0) then
Expand Down
1 change: 1 addition & 0 deletions src/force_abin.F90
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ subroutine force_abin(x, y, z, fx, fy, fz, eclas, chpot, walkmax)
else if (ipimd == 5) then

! Move old energies by 1
en_array_lz(:, 4) = en_array_lz(:, 3)
en_array_lz(:, 3) = en_array_lz(:, 2)
en_array_lz(:, 2) = en_array_lz(:, 1)

Expand Down
1 change: 1 addition & 0 deletions src/force_terash.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ subroutine receive_terash(fx, fy, fz, eclas, tc_comm)
! Landau-Zener arrays
if (ipimd == 5) then
!Move old energies by 1
en_array_lz(:, 4) = en_array_lz(:, 3);
en_array_lz(:, 3) = en_array_lz(:, 2);
en_array_lz(:, 2) = en_array_lz(:, 1);
!Store the new one
Expand Down
54 changes: 45 additions & 9 deletions src/landau_zener.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
! Nonadiabatic nuclear dynamics of atomic collisions based on branching classical trajectories
! Andrey K. Belyaev and Oleg V. Lebedev
! Implemented by: J. Suchan, (J. Chalabala)
! Modified by J. Janos (2023)

! No S/T TeraChem functionality YET
! No energy drift check
Expand All @@ -19,7 +20,7 @@ module mod_lz
implicit none
private
public :: lz_init, lz_hop, lz_rewind, lz_restin, lz_restout, lz_finalize !Routines
public :: initstate_lz, nstate_lz, nsinglet_lz, ntriplet_lz, deltaE_lz, energydifthr_lz !User defined variables
public :: initstate_lz, nstate_lz, nsinglet_lz, ntriplet_lz, deltaE_lz, energydifthr_lz !User defined variables, [deltaE_lz] = eV
public :: en_array_lz, tocalc_lz, istate_lz !Routine variables
!Caveat: Every time we call force_clas en_array_lz is updated

Expand Down Expand Up @@ -90,7 +91,7 @@ subroutine lz_init(pot)
end do

!Allocate energy arrays
allocate (en_array_lz(nstate_lz, 3), en_array_lz_backup(nstate_lz, 3)) !last 3 energies (1: current, 2: n-1, 3: n-3)
allocate (en_array_lz(nstate_lz, 4), en_array_lz_backup(nstate_lz, 4)) !last 3 energies (1: current, 2: n-1, 3: n-3)
allocate (fx_old(natom, nwalk), fy_old(natom, nwalk), fz_old(natom, nwalk))
allocate (px_temp(natom, nwalk), py_temp(natom, nwalk), pz_temp(natom, nwalk))
allocate (x_prev(natom, nwalk), y_prev(natom, nwalk), z_prev(natom, nwalk), &
Expand Down Expand Up @@ -143,7 +144,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)

real(DP) :: prob(nstate_lz), prob2(nstate_lz), probc
real(DP) :: ran(10)
real(DP) :: en_diff(3), second_der, soc_matrix(nsinglet_lz, ntriplet_lz)
real(DP) :: en_diff(4), second_der, second_der_back, der_check, soc_matrix(nsinglet_lz, ntriplet_lz)
integer :: ihop, icross, ihist, ist1, iat, ibeg, iend !, istatus
integer :: S_to_T !itest, iost
integer :: ist ! =istate_lz
Expand Down Expand Up @@ -175,10 +176,17 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
end if

do ist1 = ibeg, iend
if (ist1 == ist) cycle
do ihist = 1, 3
if (ist1 == ist) cycle
! only closest states are considered for hopping
if (ist1 > (ist + 1) .or. ist1 < (ist - 1)) cycle

do ihist = 1, 4
en_diff(ihist) = abs(en_array_lz(ist, ihist) - en_array_lz(ist1, ihist))
end do

! the energy condition is considered here, otherwise it messes up probabilities
if (abs(en_diff(2) * AUTOEV) > deltaE_lz) cycle
Comment thread
JanosJiri marked this conversation as resolved.

! Three point minima of adiabatic splitting Zjk
if ((en_diff(1) > en_diff(2)) .and. (en_diff(2) < en_diff(3)) .and. (it > 2)) then
second_der = ((en_diff(3) - 2 * en_diff(2) + en_diff(1)) / dt**2)
Expand All @@ -192,9 +200,36 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
call fatal_error(__FILE__, __LINE__, 'LZ probability > 1')
end if

! Adding check for false 3P-minima
! only for significant probabilities, for tiny probabilities this does not make sense
! e.g. for parallel states (the whole LZ does not make sense for this case)
if (prob(ist1) > 0.01) then
! Calculating backward second derivative formula. We are not using the newest energy
! but the previous three. Discontinuity would not affect this formula.
second_der_back = ((en_diff(2) - 2 * en_diff(3) + en_diff(4)) / dt**2)
! We have central and backward second derivative formulas and compare them.
! If the change is too large, we either almost hit the CI or we have discontinuity.
der_check = abs((second_der - second_der_back) / second_der)
! If they differ by more then 130%, we have aa unphysical change of curvature --> certain discontinuity.
if (der_check > 1.3) then
write (stdout,*) "ERROR: Change of curvature --> discontinuity in PES!"
write (stdout,*) "Probability set to 0!"
prob(ist1) = 0.0D0
! 30% threshold was set empirically and should capture most discontinuities
! yet it can also be a conical intersection. Thus, we just issue an warning
! and let the user to evaluate on his own.
else if (der_check > 0.3) then
write (stdout,*) "WARNING: Possible discontinuity in PES! Check PES.dat!"
end if
end if

end if
end do
!write(stdout,*) "diff1",en_diff(1),"diff2",en_diff(2),"diff3",en_diff(3)

! LZ warning
if (sum(prob) > 1) then
write (stdout, *) "WARNING: Sum of hopping probabilities > 1. Breakdown of LZ assumptions"
end if

!Hop?
ihop = 0
Expand Down Expand Up @@ -231,7 +266,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
if (ihop /= 0) then
Ekin = ekin_v(vx, vy, vz)
dE = (en_array_lz(ihop, 2) - en_array_lz(ist, 2))
Epot = abs(en_array_lz(ist, 1) - en_array_lz(ihop, 1))
Epot = abs(en_array_lz(ist, 1) - en_array_lz(ihop, 1)) ! This is not used anywhere in the code
Epot2 = abs(en_array_lz(ist, 2) - en_array_lz(ihop, 2))
write (fmt_in, '(I2.2)') istate_lz
write (fmt_out, '(I2.2)') ihop
Expand Down Expand Up @@ -282,6 +317,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
!e) Update only last energy history entry
en_array_lz(:, 2) = en_array_lz_backup(:, 2)
en_array_lz(:, 3) = en_array_lz_backup(:, 3)
en_array_lz(:, 4) = en_array_lz_backup(:, 4)

else
write (stdout, *) "NO adiabatic HOP (", trim(fmt_in), "->", trim(fmt_out), ")dE/a.u.", Epot2, &
Expand Down Expand Up @@ -553,7 +589,7 @@ subroutine lz_restout(fileunit)

write (fileunit, *) istate_lz
do ist = 1, nstate_lz
write (fileunit, '(3ES25.16E3)') en_array_lz(ist, 1), en_array_lz(ist, 2), en_array_lz(ist, 3)
write (fileunit, '(3ES25.16E3)') en_array_lz(ist, 1), en_array_lz(ist, 2), en_array_lz(ist, 3), en_array_lz(ist, 4)
Comment thread
danielhollas marked this conversation as resolved.
end do

end subroutine lz_restout
Expand Down Expand Up @@ -581,7 +617,7 @@ subroutine lz_restin(fileunit, x, y, z, vx, vy, vz)
end if

do ist = 1, nstate_lz
read (fileunit, *) en_array_lz(ist, 1), en_array_lz(ist, 2), en_array_lz(ist, 3)
read (fileunit, *) en_array_lz(ist, 1), en_array_lz(ist, 2), en_array_lz(ist, 3), en_array_lz(ist, 4)
end do

!Store previous step values
Expand Down
16 changes: 8 additions & 8 deletions tests/LZ_SS/pop.dat.ref
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Time[fs] CurrentState Populations Sum-of-Populations
0.24 2 0.00000 1.00000 0.00000 1.0000000
0.48 2 0.00000 1.00000 0.00000 1.0000000
0.73 1 1.00000 0.00000 0.00000 1.0000000
0.97 1 1.00000 0.00000 0.00000 1.0000000
1.21 1 1.00000 0.00000 0.00000 1.0000000
1.45 1 1.00000 0.00000 0.00000 1.0000000
1.69 2 0.00000 1.00000 0.00000 1.0000000
1.94 2 0.00000 1.00000 0.00000 1.0000000
2.18 2 0.00000 1.00000 0.00000 1.0000000
2.42 2 0.00000 1.00000 0.00000 1.0000000
0.73 2 0.00000 1.00000 0.00000 1.0000000
0.97 2 0.00000 1.00000 0.00000 1.0000000
1.21 2 0.00000 1.00000 0.00000 1.0000000
1.45 2 0.00000 1.00000 0.00000 1.0000000
1.69 1 1.00000 0.00000 0.00000 1.0000000
1.94 1 1.00000 0.00000 0.00000 1.0000000
2.18 1 1.00000 0.00000 0.00000 1.0000000
2.42 1 1.00000 0.00000 0.00000 1.0000000
Loading