Skip to content

Commit

Permalink
add cold fusion check to xtb (#75)
Browse files Browse the repository at this point in the history
fixes #74
- checks all distances for very small distances
- lists all distances except for strict jobs
- kills the job because otherwise it is going to break elsewhere
  • Loading branch information
awvwgk authored Dec 9, 2019
1 parent 7644b8c commit 52ed36a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions xtb/program_main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ program XTBprog
! You had it coming!
if (strict) call mctc_strict

call check_cold_fusion(mol)

!! ------------------------------------------------------------------------
! PARAMETER
!! ------------------------------------------------------------------------
Expand Down Expand Up @@ -1026,5 +1028,30 @@ program XTBprog
call terminate(0)
endif

contains
subroutine check_cold_fusion(mol)
type(tb_molecule), intent(in) :: mol
integer :: iat, jat
character(len=10) :: a10
character(len=20) :: a20
logical :: cold_fusion
cold_fusion = .false.
do iat = 1, len(mol)
do jat = 1, iat-1
if (mol%dist(jat, iat) < 1.0e-9_wp) then
cold_fusion = .true.
write(a20, '(a,i0,"-",a,i0)') &
& trim(mol%sym(jat)), jat, trim(mol%sym(iat)), iat
write(a10, '(es10.3)') mol%dist(jat, iat)
call raise('S', "Found *very* short distance of "//a10//" for "//&
& trim(a20), 1)
endif
enddo
enddo
if (cold_fusion) then
call raise('F', "Some atoms in the start geometry are *very* close", 1)
call raise('E', "XTB REFUSES TO CONTINUE WITH THIS CALCULATION!", 1)
endif
end subroutine check_cold_fusion
end program XTBprog

0 comments on commit 52ed36a

Please sign in to comment.