Skip to content

Commit

Permalink
Raise error for too heavy elements (tblite#188)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
Co-authored-by: Sebastian Ehlert <[email protected]>
  • Loading branch information
2 people authored and thfroitzheim committed Jul 31, 2024
1 parent 5a4d1fd commit 0f43a7d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/driver_guess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ subroutine guess_main(config, error)
if (allocated(config%method)) method = config%method
if (method == "ceh") then
call new_ceh_calculator(calc_ceh, mol, error)
if (allocated(error)) return
call new_wavefunction(wfn_ceh, mol%nat, calc_ceh%bas%nsh, calc_ceh%bas%nao, 1, config%etemp_guess * kt)
end if

Expand Down
1 change: 1 addition & 0 deletions app/driver_run.f90
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ subroutine run_main(config, error)

if (config%guess == "ceh") then
call new_ceh_calculator(calc_ceh, mol, error)
if (allocated(error)) return
call new_wavefunction(wfn_ceh, mol%nat, calc_ceh%bas%nsh, calc_ceh%bas%nao, 1, config%etemp_guess * kt)
if (config%grad) then
call ctx%message("WARNING: CEH gradient not yet implemented. Stopping.")
Expand Down
6 changes: 6 additions & 0 deletions src/tblite/xtb/gfn1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ subroutine new_gfn1_calculator(calc, mol, error)
!> Error handling
type(error_type), allocatable, intent(out) :: error

! Check if all atoms of mol%nat are supported (Z <= 86)
if (any(mol%num > max_elem)) then
call fatal_error(error, "No support for elements with Z >" // format_string(max_elem, '(i0)') // ".")
return
end if

! Check if all atoms of mol%nat are supported (Z <= 86)
if (any(mol%num > max_elem)) then
call fatal_error(error, "No support for elements with Z >" // format_string(max_elem, '(i0)') // ".")
Expand Down
6 changes: 6 additions & 0 deletions src/tblite/xtb/gfn2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ subroutine new_gfn2_calculator(calc, mol, error)
!> Error handling
type(error_type), allocatable, intent(out) :: error

! Check if all atoms of mol%nat are supported (Z <= 86)
if (any(mol%num > max_elem)) then
call fatal_error(error, "No support for elements with Z >" // format_string(max_elem, '(i0)') // ".")
return
end if

! Check if all atoms of mol%nat are supported (Z <= 86)
if (any(mol%num > max_elem)) then
call fatal_error(error, "No support for elements with Z >" // format_string(max_elem, '(i0)') // ".")
Expand Down

0 comments on commit 0f43a7d

Please sign in to comment.