diff --git a/src/evalmodels.f90 b/src/evalmodels.f90 index c30dfd8..451b9cb 100644 --- a/src/evalmodels.f90 +++ b/src/evalmodels.f90 @@ -24,7 +24,7 @@ program evalmodels implicit none integer :: i, j, ilink, imodel integer :: nargs, nmodels, ioerr, nlinks, scorecol, modelcol, sortcol, nminmax - character(len=200) :: loglist, scorelist, record, record2, record3, line, name, output + character(len=max_string_length) :: loglist, scorelist, record, record2, record3, line, name, output logical :: error type(specific_link) :: linktemp type(modeldata), allocatable :: model(:) @@ -105,7 +105,7 @@ program evalmodels ! Read number of models nmodels = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle read(record,*,iostat=ioerr) (record2, i=1, modelcol) @@ -127,7 +127,7 @@ program evalmodels rewind(10) imodel = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle read(record,*,iostat=ioerr) (record2, i=1, modelcol) @@ -154,7 +154,7 @@ program evalmodels end if i = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle open(20,file=record,status='old',action='read',iostat=ioerr) @@ -181,7 +181,7 @@ program evalmodels ! nlinks = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) nlinks = nlinks + 1 end do @@ -195,7 +195,7 @@ program evalmodels ilink = 0 nminmax = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) @@ -208,23 +208,23 @@ program evalmodels end if end if end if - if ( line(4:11) == "RESULT0:") read(line(12:200),*,iostat=ioerr) model(imodel)%nobscons + if ( line(4:11) == "RESULT0:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nobscons if ( ioerr /= 0 ) model(imodel)%nobscons = 0 - if ( line(4:11) == "RESULT1:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopcons + if ( line(4:11) == "RESULT1:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopcons if ( ioerr /= 0 ) model(imodel)%ntopcons = 0 - if ( line(4:11) == "RESULT2:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopnot + if ( line(4:11) == "RESULT2:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopnot if ( ioerr /= 0 ) model(imodel)%ntopnot = 0 - if ( line(4:11) == "RESULT3:") read(line(12:200),*,iostat=ioerr) model(imodel)%nmiss + if ( line(4:11) == "RESULT3:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nmiss if ( ioerr /= 0 ) model(imodel)%nmiss = 0 - if ( line(4:11) == "RESULT4:") read(line(12:200),*,iostat=ioerr) model(imodel)%sumscores + if ( line(4:11) == "RESULT4:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%sumscores if ( ioerr /= 0 ) model(imodel)%sumscores = 0. - if ( line(4:11) == "RESULT5:") read(line(12:200),*,iostat=ioerr) model(imodel)%likeli + if ( line(4:11) == "RESULT5:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%likeli if ( ioerr /= 0 ) model(imodel)%likeli = 0. - if ( line(4:11) == "RESULT6:") read(line(12:200),*,iostat=ioerr) model(imodel)%loglikeli + if ( line(4:11) == "RESULT6:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%loglikeli if ( ioerr /= 0 ) model(imodel)%loglikeli = 0. - if ( line(4:11) == "RESULT7:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrlike + if ( line(4:11) == "RESULT7:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrlike if ( ioerr /= 0 ) model(imodel)%usrlike = 0. - if ( line(4:11) == "RESULT8:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrloglike + if ( line(4:11) == "RESULT8:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrloglike if ( ioerr /= 0 ) model(imodel)%usrloglike = 0. end do model(imodel)%nminmax = nminmax diff --git a/src/filtermodels.f90 b/src/filtermodels.f90 index 83de143..6ac75a9 100644 --- a/src/filtermodels.f90 +++ b/src/filtermodels.f90 @@ -1,13 +1,14 @@ program filtermodels + use ioformat, only : max_string_length, string_read use topolink_data use topolink_operations implicit none integer :: i, j, ilink, imodel integer :: nargs, nmodels, ioerr, maxlinks, nlinks, ncut, ngood - character(len=200) :: loglist, linklist, record, line + character(len=max_string_length) :: loglist, linklist, record, line type(specific_link) :: linktemp type(observed_link), allocatable :: link(:) type(modeldata), allocatable :: model(:) @@ -45,7 +46,7 @@ program filtermodels ! Check the number of links reported in this file nlinks = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) @@ -81,7 +82,7 @@ program filtermodels model(imodel)%name = record ilink = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) @@ -90,23 +91,23 @@ program filtermodels model(imodel)%link(ilink) = linktemp end if end if - if ( line(4:11) == "RESULT0:") read(line(12:200),*,iostat=ioerr) model(imodel)%nobscons + if ( line(4:11) == "RESULT0:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nobscons if ( ioerr /= 0 ) model(imodel)%nobscons = 0 - if ( line(4:11) == "RESULT1:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopcons + if ( line(4:11) == "RESULT1:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopcons if ( ioerr /= 0 ) model(imodel)%ntopcons = 0 - if ( line(4:11) == "RESULT2:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopnot + if ( line(4:11) == "RESULT2:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopnot if ( ioerr /= 0 ) model(imodel)%ntopnot = 0 - if ( line(4:11) == "RESULT3:") read(line(12:200),*,iostat=ioerr) model(imodel)%nmiss + if ( line(4:11) == "RESULT3:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nmiss if ( ioerr /= 0 ) model(imodel)%nmiss = 0 - if ( line(4:11) == "RESULT4:") read(line(12:200),*,iostat=ioerr) model(imodel)%sumscores + if ( line(4:11) == "RESULT4:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%sumscores if ( ioerr /= 0 ) model(imodel)%sumscores = 0. - if ( line(4:11) == "RESULT5:") read(line(12:200),*,iostat=ioerr) model(imodel)%likeli + if ( line(4:11) == "RESULT5:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%likeli if ( ioerr /= 0 ) model(imodel)%likeli = 0. - if ( line(4:11) == "RESULT6:") read(line(12:200),*,iostat=ioerr) model(imodel)%loglikeli + if ( line(4:11) == "RESULT6:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%loglikeli if ( ioerr /= 0 ) model(imodel)%loglikeli = 0. - if ( line(4:11) == "RESULT7:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrlike + if ( line(4:11) == "RESULT7:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrlike if ( ioerr /= 0 ) model(imodel)%usrlike = 0. - if ( line(4:11) == "RESULT8:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrloglike + if ( line(4:11) == "RESULT8:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrloglike if ( ioerr /= 0 ) model(imodel)%usrloglike = 0. end do close(20) @@ -129,7 +130,7 @@ program filtermodels end if nlinks = 0 do - read(10,"(a200)",iostat=ioerr) line + read(10,string_read,iostat=ioerr) line if( ioerr /= 0 ) exit nlinks = nlinks + 1 end do @@ -143,7 +144,7 @@ program filtermodels nlinks = 0 write(*,"(a)") '# Links to be considered: ' do - read(10,"(a200)",iostat=ioerr) line + read(10,string_read,iostat=ioerr) line if( ioerr /= 0 ) exit nlinks = nlinks + 1 read(line,*,iostat=ioerr) link(nlinks)%residue1%name, & diff --git a/src/linkcorrelation.f90 b/src/linkcorrelation.f90 index 13e4286..04c7d4d 100644 --- a/src/linkcorrelation.f90 +++ b/src/linkcorrelation.f90 @@ -35,13 +35,14 @@ program linkcorrelation + use ioformat, only : max_string_length, string_read use topolink_data use topolink_operations implicit none integer :: i, j, ilink, imodel, type integer :: nargs, nmodels, ioerr, maxlinks, nlinks - character(len=200) :: loglist, record, line, format + character(len=max_string_length) :: loglist, record, line, format double precision, allocatable :: correlation(:,:), fraction(:) type(specific_link) :: linktemp type(modeldata), allocatable :: model(:) @@ -101,7 +102,7 @@ program linkcorrelation nmodels = 0 maxlinks = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit open(20,file=record,status='old',action='read',iostat=ioerr) if ( ioerr /= 0 ) cycle @@ -109,7 +110,7 @@ program linkcorrelation ! Check the number of links reported in this file nlinks = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) @@ -137,7 +138,7 @@ program linkcorrelation end do imodel = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit open(20,file=record,status='old',action='read',iostat=ioerr) if ( ioerr /= 0 ) cycle @@ -145,7 +146,7 @@ program linkcorrelation model(imodel)%name = record ilink = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) @@ -154,23 +155,23 @@ program linkcorrelation model(imodel)%link(ilink) = linktemp end if end if - if ( line(4:11) == "RESULT0:") read(line(12:200),*,iostat=ioerr) model(imodel)%nobscons + if ( line(4:11) == "RESULT0:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nobscons if ( ioerr /= 0 ) model(imodel)%nobscons = 0 - if ( line(4:11) == "RESULT1:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopcons + if ( line(4:11) == "RESULT1:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopcons if ( ioerr /= 0 ) model(imodel)%ntopcons = 0 - if ( line(4:11) == "RESULT2:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopnot + if ( line(4:11) == "RESULT2:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopnot if ( ioerr /= 0 ) model(imodel)%ntopnot = 0 - if ( line(4:11) == "RESULT3:") read(line(12:200),*,iostat=ioerr) model(imodel)%nmiss + if ( line(4:11) == "RESULT3:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nmiss if ( ioerr /= 0 ) model(imodel)%nmiss = 0 - if ( line(4:11) == "RESULT4:") read(line(12:200),*,iostat=ioerr) model(imodel)%sumscores + if ( line(4:11) == "RESULT4:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%sumscores if ( ioerr /= 0 ) model(imodel)%sumscores = 0. - if ( line(4:11) == "RESULT5:") read(line(12:200),*,iostat=ioerr) model(imodel)%likeli + if ( line(4:11) == "RESULT5:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%likeli if ( ioerr /= 0 ) model(imodel)%likeli = 0. - if ( line(4:11) == "RESULT6:") read(line(12:200),*,iostat=ioerr) model(imodel)%loglikeli + if ( line(4:11) == "RESULT6:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%loglikeli if ( ioerr /= 0 ) model(imodel)%loglikeli = 0. - if ( line(4:11) == "RESULT7:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrlike + if ( line(4:11) == "RESULT7:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrlike if ( ioerr /= 0 ) model(imodel)%usrlike = 0. - if ( line(4:11) == "RESULT8:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrloglike + if ( line(4:11) == "RESULT8:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrloglike if ( ioerr /= 0 ) model(imodel)%usrloglike = 0. end do close(20) diff --git a/src/linkensemble.f90 b/src/linkensemble.f90 index 890a6b6..388e33d 100644 --- a/src/linkensemble.f90 +++ b/src/linkensemble.f90 @@ -27,7 +27,7 @@ program linkensemble integer :: nargs, nmodels, ioerr, nlinks, nsatisfied integer, allocatable :: satisfied(:) double precision :: gscore, degree - character(len=200) :: loglist, gscorefile, record, name, output, line + character(len=max_string_length) :: loglist, gscorefile, record, name, output, line logical :: error type(specific_link) :: linktemp type(modeldata), allocatable :: model(:) @@ -72,7 +72,7 @@ program linkensemble ! Read number of models nmodels = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle read(record,*,iostat=ioerr) gscore, degree, name @@ -89,7 +89,7 @@ program linkensemble rewind(10) imodel = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle read(record,*,iostat=ioerr) gscore, degree, name @@ -111,7 +111,7 @@ program linkensemble end if i = 0 do - read(10,"(a200)",iostat=ioerr) record + read(10,string_read,iostat=ioerr) record if ( ioerr /= 0 ) exit if ( comment(record) ) cycle open(20,file=record,status='old',action='read',iostat=ioerr) @@ -139,7 +139,7 @@ program linkensemble nlinks = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) nlinks = nlinks + 1 end do @@ -157,30 +157,30 @@ program linkensemble rewind(20) ilink = 0 do - read(20,"(a200)",iostat=ioerr) line + read(20,string_read,iostat=ioerr) line if ( ioerr /= 0 ) exit if ( line(3:7) == "LINK:" ) then linktemp = read_link(line) ilink = ilink + 1 model(imodel)%link(ilink) = linktemp end if - if ( line(4:11) == "RESULT0:") read(line(12:200),*,iostat=ioerr) model(imodel)%nobscons + if ( line(4:11) == "RESULT0:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nobscons if ( ioerr /= 0 ) model(imodel)%nobscons = 0 - if ( line(4:11) == "RESULT1:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopcons + if ( line(4:11) == "RESULT1:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopcons if ( ioerr /= 0 ) model(imodel)%ntopcons = 0 - if ( line(4:11) == "RESULT2:") read(line(12:200),*,iostat=ioerr) model(imodel)%ntopnot + if ( line(4:11) == "RESULT2:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%ntopnot if ( ioerr /= 0 ) model(imodel)%ntopnot = 0 - if ( line(4:11) == "RESULT3:") read(line(12:200),*,iostat=ioerr) model(imodel)%nmiss + if ( line(4:11) == "RESULT3:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%nmiss if ( ioerr /= 0 ) model(imodel)%nmiss = 0 - if ( line(4:11) == "RESULT4:") read(line(12:200),*,iostat=ioerr) model(imodel)%sumscores + if ( line(4:11) == "RESULT4:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%sumscores if ( ioerr /= 0 ) model(imodel)%sumscores = 0. - if ( line(4:11) == "RESULT5:") read(line(12:200),*,iostat=ioerr) model(imodel)%likeli + if ( line(4:11) == "RESULT5:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%likeli if ( ioerr /= 0 ) model(imodel)%likeli = 0. - if ( line(4:11) == "RESULT6:") read(line(12:200),*,iostat=ioerr) model(imodel)%loglikeli + if ( line(4:11) == "RESULT6:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%loglikeli if ( ioerr /= 0 ) model(imodel)%loglikeli = 0. - if ( line(4:11) == "RESULT7:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrlike + if ( line(4:11) == "RESULT7:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrlike if ( ioerr /= 0 ) model(imodel)%usrlike = 0. - if ( line(4:11) == "RESULT8:") read(line(12:200),*,iostat=ioerr) model(imodel)%usrloglike + if ( line(4:11) == "RESULT8:") read(line(12:max_string_length),*,iostat=ioerr) model(imodel)%usrloglike if ( ioerr /= 0 ) model(imodel)%usrloglike = 0. end do