Skip to content

Commit

Permalink
reference max_string_length in auxiliary programs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Jun 27, 2018
1 parent 3164424 commit 4d4dd7e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 58 deletions.
30 changes: 15 additions & 15 deletions src/evalmodels.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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(:)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
29 changes: 15 additions & 14 deletions src/filtermodels.f90
Original file line number Diff line number Diff line change
@@ -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(:)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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, &
Expand Down
29 changes: 15 additions & 14 deletions src/linkcorrelation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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(:)
Expand Down Expand Up @@ -101,15 +102,15 @@ 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
nmodels = nmodels + 1
! 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)
Expand Down Expand Up @@ -137,15 +138,15 @@ 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
imodel = imodel + 1
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)
Expand All @@ -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)
Expand Down
30 changes: 15 additions & 15 deletions src/linkensemble.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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(:)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 4d4dd7e

Please sign in to comment.