Skip to content

Commit

Permalink
when reading parameter-file, cast varying_string to deferred-shape ch…
Browse files Browse the repository at this point in the history
…aracter array (instead of fixed length) to avoid truncation of long input lines

use case: periodic box where corner coordinates are irrational numbers, e.g. as obtained from trigonometric relations -> coordinates have to be given with sufficient decimals for opposite sides to be identified as conforming
  • Loading branch information
AppelDaniel authored and kopperp committed Jan 31, 2024
1 parent cf452c8 commit 2f16f57
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/readin/readintools.f90
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ SUBROUTINE FillStrings(IniFile)
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
TYPE(tString),POINTER :: Str1=>NULL(),Str2=>NULL() ! ?
CHARACTER(LEN=255) :: HelpStr,Str ! ?
CHARACTER(LEN=:),ALLOCATABLE :: HelpStr
CHARACTER(LEN=300) :: File ! ?
TYPE(Varying_String) :: aStr,bStr,Separator ! ?
INTEGER :: EOF ! ?
Expand Down Expand Up @@ -533,8 +533,6 @@ SUBROUTINE FillStrings(IniFile)
IF(.NOT.ASSOCIATED(Str1)) CALL GetNewString(Str1)
! Read line from file
CALL Get(103,aStr,iostat=EOF)
Str=aStr
!IPWRITE(*,*)'Reading: ',Str,EOF
IF (EOF.NE.IOSTAT_END) THEN
! Remove comments with "!"
CALL Split(aStr,Str1%Str,"!")
Expand All @@ -555,7 +553,8 @@ SUBROUTINE FillStrings(IniFile)
! Replace commas
Str1%Str=Replace(Str1%Str,","," ",Every=.true.)
! Lower case
CALL LowCase(CHAR(Str1%Str),HelpStr)
HelpStr = CHAR(Str1%Str) ! define HelpStr to set size of deferred-shape array
CALL LowCase(CHAR(Str1%Str),HelpStr) ! overwrite HelpStr without modifying size
! If we have a remainder (no comment only)
IF(LEN_TRIM(HelpStr).GT.2) THEN
Str1%Str=Var_Str(HelpStr)
Expand Down

0 comments on commit 2f16f57

Please sign in to comment.