From 99a680542d9f95a5168f2943f29f9f4bea55e4d3 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Mon, 27 Jan 2020 20:32:18 -0500 Subject: [PATCH] Extended inf commands to be position independent of the inf command --- src/subroutines.f90 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/subroutines.f90 b/src/subroutines.f90 index 6efb97e..e8c365b 100644 --- a/src/subroutines.f90 +++ b/src/subroutines.f90 @@ -186,15 +186,26 @@ module subroutines pos=box_bd(2*i-1) else if ((index(pos_string,'-') > 0).and.(index(pos_string,'inf')>0)) then !Now extract the number we are reducing from infinity - read(pos_string(index(pos_string,'-')+1:), *, iostat=iospara) pos + if(index(pos_string,'inf') < index(pos_string,'-')) then + read(pos_string(index(pos_string,'-')+1:), *, iostat=iospara) pos + else + read(pos_string(1:index(pos_string,'-')-1), *, iostat=iospara) pos + end if pos = box_bd(2*i) - pos else if ((index(pos_string,'+') > 0).and.(index(pos_string,'inf')>0)) then !Now extract the number we are reducing from infinity - read(pos_string(index(pos_string,'+')+1:), *, iostat=iospara) pos - pos = box_bd(2*i-1) + pos + if(index(pos_string,'inf') < index(pos_string,'-')) then + read(pos_string(index(pos_string,'+')+1:), *, iostat=iospara) pos + else + read(pos_string(1:index(pos_string,'+')-1), *, iostat=iospara) pos + end if else if ((index(pos_string,'*') > 0).and.(index(pos_string,'inf')>0)) then !Now extract the number we are reducing from infinity - read(pos_string(index(pos_string,'*')+1:), *, iostat=iospara) pos + if(index(pos_string,'inf') < index(pos_string,'-')) then + read(pos_string(index(pos_string,'*')+1:), *, iostat=iospara) pos + else + read(pos_string(1:index(pos_string,'*')-1), *, iostat=iospara) pos + end if pos = (box_bd(2*i)-box_bd(2*i-1))*pos else read(pos_string, *, iostat=iospara) pos