From 52ed36ac2e01c35b4af5129ac3f75f4b9e053300 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Mon, 9 Dec 2019 09:21:18 +0100 Subject: [PATCH] add cold fusion check to xtb (#75) 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 --- xtb/program_main.f90 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/xtb/program_main.f90 b/xtb/program_main.f90 index 15e61b3b1..1c4a39cad 100644 --- a/xtb/program_main.f90 +++ b/xtb/program_main.f90 @@ -376,6 +376,8 @@ program XTBprog ! You had it coming! if (strict) call mctc_strict + call check_cold_fusion(mol) + !! ------------------------------------------------------------------------ ! PARAMETER !! ------------------------------------------------------------------------ @@ -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