Skip to content

Commit

Permalink
Allow strict mode for new environment (#145)
Browse files Browse the repository at this point in the history
- turns warnings into errors, but error handling is only performed after procedure ends
  • Loading branch information
awvwgk authored Mar 15, 2020
1 parent bf69fc5 commit 69b5cfe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
long_description = fh.read()

setup(name="xtb",
version="6.2.2",
version="6.2.3",
author="Sebastian Ehlert",
author_email="[email protected]",
description="Wrapper for the extended tight binding program",
Expand Down
1 change: 1 addition & 0 deletions src/prog/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ program XTBprog

! You had it coming!
if (strict) call mctc_strict
env%strict = strict

call check_cold_fusion(mol)

Expand Down
18 changes: 15 additions & 3 deletions src/type/environment.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ module xtb_type_environment

!> Message log
type(TMessage), allocatable :: log(:)

!> Handle warnings as errors
logical :: strict

!> Actual executable name
character(len=:),allocatable :: whoami
Expand Down Expand Up @@ -106,10 +109,13 @@ module xtb_type_environment


!> Construct the calculation environment
subroutine initEnvironment(self)
subroutine initEnvironment(self, strict)

!> Calculation environment
type(TEnvironment), intent(out) :: self

!> Handle warnings as errors
logical, intent(in), optional :: strict

integer :: err

Expand All @@ -129,6 +135,12 @@ subroutine initEnvironment(self)
if (err /= 0 .or. len(self%xtbpath) <= 0) then
self%xtbpath = self%xtbhome
end if

if (present(strict)) then
self%strict = strict
else
self%strict = .false.
end if

end subroutine initEnvironment

Expand Down Expand Up @@ -274,9 +286,9 @@ subroutine warning(self, message, source)

self%nLog = self%nLog + 1
if (present(source)) then
self%log(self%nLog) = TMessage(.false., source // ": " // message)
self%log(self%nLog) = TMessage(self%strict, source // ": " // message)
else
self%log(self%nLog) = TMessage(.false., message)
self%log(self%nLog) = TMessage(self%strict, message)
end if

end subroutine warning
Expand Down

0 comments on commit 69b5cfe

Please sign in to comment.