subroutine eval_coherence(signedCache, unsignedCache, sgn, connections, staticInit)
! Note that tweakcoherentdoubles and tavcoherentdoubles are mutually exclusive
! in the current implementation
use adi_data, only: tWeakCoherentDoubles, tAvCoherentDoubles, coherenceThreshold, &
nConnection
implicit none
HElement_t(dp), intent(in) :: signedCache
real(dp), intent(in) :: unsignedCache, sgn
integer, intent(in) :: connections
logical, intent(inout) :: staticInit
! Only need to check if we are looking at a double
!if(unsignedCache > eps .and. connections>=minSIConnect) then
if (connections < minSIConnect .or. &
! if the connections are weighted, we want to have at least
! minimum-number-of-connections*SI-threshold
(tWeightedConnections .and. connections < minSIConnect * NoTypeN)) then
staticInit = .false.
if (unsignedCache > EPS) nConnection = nConnection + 1
end if
! We disable superinitiator-related initiators if they fail the coherence check
! else, we leave it as it is
if (tWeakCoherentDoubles) then
if (abs(signedCache) < coherenceThreshold * unsignedCache) then
staticInit = .false.
nIncoherentDets = nIncoherentDets + 1
end if
end if
! If we do averaged coherence check, we check versus the sign of the ilut
! We recommend using both, av and weak
if (tAvCoherentDoubles) then
if (real(signedCache * sgn, dp) > 0.0_dp) then
staticInit = .false.
nIncoherentDets = nIncoherentDets + 1
end if
end if
end subroutine eval_coherence