@@ -776,7 +776,7 @@ subroutine gfnff_hbset(n, at, xyz, topo, neigh, nlist, hbthr1, hbthr2)
776776 integer :: i, j, k, nh, ix
777777 integer :: iTri, iTrj, iTrDum
778778 real (wp) :: rmsd, rab, rih, rjh
779- logical :: ijnonbond, free
779+ logical :: ijnonbond
780780 integer :: nhb1, nhb2, nxb
781781! $ integer, parameter :: N_MAX_LIST = 800 !< keep approx. 32 kb of integer(int64)
782782! $ integer, allocatable :: hblist1(:,:), hblist2(:,:), hblist3(:,:)
@@ -792,7 +792,7 @@ subroutine gfnff_hbset(n, at, xyz, topo, neigh, nlist, hbthr1, hbthr2)
792792 ! $omp parallel default(none) &
793793 ! $omp shared(topo, neigh, nlist, xyz, hbthr1, hbthr2) &
794794 ! $omp private(iTri, iTrj, iTrDum, ix, i, j, k, nh, rab, rih, rjh) &
795- ! $omp private(ijnonbond, free, hblist1, hblist2, hblist3, nhb1, nhb2, nxb)
795+ ! $omp private(ijnonbond, hblist1, hblist2, hblist3, nhb1, nhb2, nxb)
796796
797797#ifndef _OPENMP
798798 associate(hblist1 = > nlist% hblist1, &
@@ -829,7 +829,6 @@ subroutine gfnff_hbset(n, at, xyz, topo, neigh, nlist, hbthr1, hbthr2)
829829 end if
830830 ! loop over relevant H atoms
831831 do k = 1 , topo% nathbH
832- free = .true. ! tripplet not assigned yet
833832 nh = topo% hbatHl(1 , k) ! nh always in central cell
834833 ! distances for non-cov bonded case
835834 rih = sum ((xyz(1 :3 , nh) - (xyz(1 :3 , i) + neigh% transVec(1 :3 , iTri)))** 2 )
@@ -844,11 +843,11 @@ subroutine gfnff_hbset(n, at, xyz, topo, neigh, nlist, hbthr1, hbthr2)
844843 hblist2(4 , nhb2) = iTri
845844 hblist2(5 , nhb2) = iTrj
846845! $ if (nhb2 == N_MAX_LIST) call update_hblist2(nlist, hblist2, nhb2)
847- free = .false. ! not available for nhb1 !!!
846+ cycle ! not available for nhb1 !!!
848847 end if
849848 end if
850849 ! check if j is the bonded A
851- if (iTrj <= neigh% numctr .and. free ) then
850+ if (iTrj <= neigh% numctr) then
852851 if (neigh% bpair(j, nh, iTrj) == 1 .and. ijnonbond) then
853852 nhb2 = nhb2 + 1
854853 hblist2(1 , nhb2) = j
@@ -857,11 +856,11 @@ subroutine gfnff_hbset(n, at, xyz, topo, neigh, nlist, hbthr1, hbthr2)
857856 hblist2(4 , nhb2) = iTrj
858857 hblist2(5 , nhb2) = iTri
859858! $ if (nhb2 == N_MAX_LIST) call update_hblist2(nlist, hblist2, nhb2)
860- free = .false. ! not available for nhb1 !!!
859+ cycle ! not available for nhb1 !!!
861860 end if
862861 end if
863862 ! check for non-cov bonded A
864- if (rab + rih + rjh < hbthr2 .and. free ) then ! sum of rAB,rAH,rBH is below threshold
863+ if (rab + rih + rjh < hbthr2) then ! sum of rAB,rAH,rBH is below threshold
865864 nhb1 = nhb1 + 1
866865 hblist1(1 , nhb1) = i
867866 hblist1(2 , nhb1) = j
@@ -1351,7 +1350,7 @@ subroutine gfnff_hbset0(n, at, xyz, topo, nhb1, nhb2, nxb, neigh, nlist, hbthr1,
13511350
13521351 integer :: i, j, k, nh, ix
13531352 integer :: iTri, iTrj, iTrDum
1354- logical :: ijnonbond, free
1353+ logical :: ijnonbond
13551354 real (wp) :: rab, rih, rjh
13561355
13571356 nhb1 = 0
@@ -1361,7 +1360,7 @@ subroutine gfnff_hbset0(n, at, xyz, topo, nhb1, nhb2, nxb, neigh, nlist, hbthr1,
13611360 ! $omp parallel default(none) &
13621361 ! $omp reduction(+:nhb1, nhb2, nxb) &
13631362 ! $omp shared(topo, neigh, xyz, hbthr1, hbthr2) &
1364- ! $omp private(iTri, iTrj, iTrDum, ix, i, j, k, nh, rab, rih, rjh, ijnonbond, free )
1363+ ! $omp private(iTri, iTrj, iTrDum, ix, i, j, k, nh, rab, rih, rjh, ijnonbond)
13651364
13661365 ! loop over hb-relevant AB atoms
13671366 ! $omp do collapse(3) schedule(dynamic, 16)
@@ -1392,7 +1391,6 @@ subroutine gfnff_hbset0(n, at, xyz, topo, nhb1, nhb2, nxb, neigh, nlist, hbthr1,
13921391 end if
13931392 ! loop over relevant H atoms
13941393 do k = 1 , topo% nathbH
1395- free = .true.
13961394 nh = topo% hbatHl(1 , k) ! nh always in central cell
13971395 ! distances for non-cov bonded case
13981396 rih = sum ((xyz(1 :3 , nh) - (xyz(1 :3 , i) + neigh% transVec(1 :3 , iTri)))** 2 )
@@ -1401,18 +1399,18 @@ subroutine gfnff_hbset0(n, at, xyz, topo, nhb1, nhb2, nxb, neigh, nlist, hbthr1,
14011399 if (iTri <= neigh% numctr) then ! nh is not shifted so bpair works without adjustment
14021400 if (neigh% bpair(i, nh, iTri) == 1 .and. ijnonbond) then
14031401 nhb2 = nhb2 + 1
1404- free = .false.
1402+ cycle
14051403 end if
14061404 end if
14071405 ! check if j is the bonded A
1408- if (iTrj <= neigh% numctr .and. free ) then
1406+ if (iTrj <= neigh% numctr) then
14091407 if (neigh% bpair(j, nh, iTrj) == 1 .and. ijnonbond) then
14101408 nhb2 = nhb2 + 1
1411- free = .false.
1409+ cycle
14121410 end if
14131411 end if
14141412 ! check for non-cov bonded A
1415- if (rab + rih + rjh < hbthr2 .and. free ) then ! sum of rAB,rAH,rBH is below threshold
1413+ if (rab + rih + rjh < hbthr2) then ! sum of rAB,rAH,rBH is below threshold
14161414 nhb1 = nhb1 + 1
14171415 end if
14181416 end do ! k: relevant H atoms
0 commit comments