From 1879f189937b20c3d9892a5512c19ec9e8488ee1 Mon Sep 17 00:00:00 2001 From: "Lorenzo Paulatto (naquite)" Date: Mon, 15 Jul 2024 11:52:53 +0200 Subject: [PATCH] Prevent code stop when an input line containing only spaces or tabs is present in the "cards" section of input --- Modules/read_cards.f90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/read_cards.f90 b/Modules/read_cards.f90 index bd32dc89f..7163b328d 100644 --- a/Modules/read_cards.f90 +++ b/Modules/read_cards.f90 @@ -123,7 +123,7 @@ CONTAINS CHARACTER(len=256) :: input_line CHARACTER(len=80) :: card LOGICAL :: tend - INTEGER :: i + INTEGER :: i, ios ! ! read_line reads from unit parse_unit ! @@ -145,7 +145,8 @@ CONTAINS input_line( i : i ) = capital( input_line( i : i ) ) ENDDO ! - READ (input_line, *) card + READ (input_line, *, iostat=ios) card + IF(ios/=0) card='' ! IF ( trim(card) == 'AUTOPILOT' ) THEN ! @@ -747,7 +748,7 @@ CONTAINS k2 < 0 .or. k2 > 1 .or. & k3 < 0 .or. k3 > 1 ) CALL errore & ('card_kpoints', 'invalid offsets: must be 0 or 1', 1) - IF ( nk1 <= 0 .or. nk2 <= 0 .or. nk3 <= 0 ) CALL errore & + IF ( nk1 < 0 .or. nk2 < 0 .or. nk3 < 0 ) CALL errore & ('card_kpoints', 'invalid values for nk1, nk2, nk3', 1) ALLOCATE ( xk(3,1), wk(1) ) ! prevents problems with debug flags ! ! when init_startk is called in iosys