From 758719deeb53aa128c2f265bb6867fdf81c0c2c8 Mon Sep 17 00:00:00 2001 From: Daniel Appel Date: Mon, 8 Jan 2024 14:39:10 +0100 Subject: [PATCH] when reading parameter-file, cast varying_string to deferred-shape character 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 --- src/readin/readintools.f90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/readin/readintools.f90 b/src/readin/readintools.f90 index 24fca55..ea83cfb 100644 --- a/src/readin/readintools.f90 +++ b/src/readin/readintools.f90 @@ -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 ! ? @@ -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,"!") @@ -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)