Skip to content

Commit

Permalink
changed print out nglobal and added same sequence guess in randimini
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro Martinez committed Dec 6, 2016
1 parent f2c87ab commit 0f71c87
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
64 changes: 37 additions & 27 deletions src/protall.f90
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,10 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
if(iprint.eq.2) write(*,data_format) it, score, gnor, nbij, ngaps,nef

end do
if ( abs(score-scorebest) < tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
if ( score > scorebest ) then
iglobal = 1
if ( abs(score-scorebest) > tol*score ) then
iglobal = 1
end if
nbijbest = nbij
scorebest = score
do i = 1, nbij
Expand All @@ -115,6 +111,13 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
prota_best(i,3) = prota(i,3)
end do
if(iprint.eq.1) write(*,trial_format) itrial, score, nbij, ngaps, iglobal
else
if ( scorebest-score <= tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal .and. iprint == 1 ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
end if
if(iprint.eq.2) write(*,trial_format) itrial, score, nbij, ngaps, iglobal

Expand Down Expand Up @@ -188,12 +191,6 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
if(iprint.eq.2) write(*,data_format) it, score, gnor, nbij, ngaps, nef

end do
if ( abs(score-scorebest) < tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
if ( score > scorebest ) then
iglobal = 1
nbijbest = nbij
Expand All @@ -208,6 +205,13 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
prota_best(i,3) = prota(i,3)
end do
if(iprint.eq.1) write(*,trial_format) itrial, score, nbij, ngaps, iglobal
else
if ( scorebest-score <= tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal .and. iprint == 1 ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
end if
if(iprint.eq.2) write(*,trial_format) itrial, score, nbij, ngaps, iglobal

Expand Down Expand Up @@ -274,14 +278,10 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
if(iprint.eq.2) write(*,data_format) it, score, score-prevscore, nbij, ngaps, nef

end do
if ( abs(score-scorebest) < tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
if ( score > scorebest ) then
iglobal = 1
if ( abs(score-scorebest) > tol*score ) then
iglobal = 1
end if
nbijbest = nbij
scorebest = score
do i = 1, nbij
Expand All @@ -294,6 +294,13 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
prota_best(i,3) = prota(i,3)
end do
if(iprint.eq.1) write(*,trial_format) itrial, score, nbij, ngaps, iglobal
else
if ( scorebest-score <= tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal .and. iprint == 1 ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
end if
if(iprint.eq.2) write(*,trial_format) itrial, score, nbij, ngaps, iglobal

Expand Down Expand Up @@ -363,14 +370,10 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
if(iprint.eq.2) write(*,data_format) it, score, score-prevscore, nbij, ngaps, nef

end do
if ( abs(score-scorebest) < tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
if ( score > scorebest ) then
iglobal = 1
if ( abs(score-scorebest) > tol*score ) then
iglobal = 1
end if
nbijbest = nbij
scorebest = score
do i = 1, nbij
Expand All @@ -383,6 +386,13 @@ subroutine protall(prota,protb,na,nb,disord,indisord,resa,resb,numa,numb)
prota_best(i,3) = prota(i,3)
end do
if(iprint.eq.1) write(*,trial_format) itrial, score, nbij, ngaps, iglobal
else
if ( scorebest-score <= tol*score ) then
iglobal = iglobal + 1
if ( iglobal == nglobal .and. iprint == 1 ) then
write(*,"(a,i5,a,i5)") ' Repeated best solution found ', nglobal,' times at trial ', itrial
end if
end if
end if
if(iprint.eq.2) write(*,trial_format) itrial, score, nbij, ngaps, iglobal
end do
Expand Down
7 changes: 6 additions & 1 deletion src/randomini.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ subroutine randomini(na,nb,prota,protb,nbij,bije)
ib = ia
else
call random_number(random)
ib = int(random*(nb-nbij))+1
if ( random > 0.5d0 ) then
call random_number(random)
ib = int(random*(nb-nbij))+1
else
ib = ia
end if
end if
do i = 1, nbij
bije(i,1) = ia + i - 1
Expand Down

0 comments on commit 0f71c87

Please sign in to comment.