Skip to content

Commit

Permalink
improve the progress bar printing
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Oct 25, 2024
1 parent 42c0cff commit a609d60
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 36 deletions.
38 changes: 29 additions & 9 deletions src/ahestetic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,40 @@
! Written by Leandro Martínez, 2009-2011.
! Copyright (c) 2009-2018, Leandro Martínez, Jose Mario Martinez,
! Ernesto G. Birgin.
!
!
! Module that contains some ahestetic output definitions
!
module ahestetic

character(len=13), parameter :: dash1_line = "( 80('-') )",&
dash2_line = "(/,80('-') )",&
dash3_line = "(/,80('-'),/)"
character(len=13), parameter :: dash1_line = "( 80('-') )",&
dash2_line = "(/,80('-') )",&
dash3_line = "(/,80('-'),/)"

character(len=13), parameter :: hash1_line = "( 80('#') )",&
hash2_line = "(/,80('#') )",&
hash3_line = "(/,80('#'),/)"
character(len=13), parameter :: hash1_line = "( 80('#') )",&
hash2_line = "(/,80('#') )",&
hash3_line = "(/,80('#'),/)"

character(len=31), parameter :: prog1_line = "(' Packing:|0 ',tr60,'100%|' )",&
prog2_line = "(' Moving:|0 ',tr60,'100%|' )"
character(len=31), parameter :: prog1_line = "(' Packing:|0 ',tr55,'100%|' )",&
prog2_line = "(' Moving:|0 ',tr55,'100%|' )"

end module ahestetic


subroutine printbar(iprint, iter, maxit)
integer :: iter, maxit
itprint = 60 / (maxit)
if( iprint .ge. 2 ) then
if( iter.eq.0) then
write(*,"(' |')",advance='no')
else if(iter.eq.maxit) then
do i = itprint*(maxit-1), 60
write(*,"('*')", advance='no')
end do
write(*,"('|')")
else
do i = 1, itprint
write(*,"('*')", advance='no')
end do
end if
end if
end subroutine printbar
30 changes: 4 additions & 26 deletions src/gencan.f
Original file line number Diff line number Diff line change
Expand Up @@ -1855,20 +1855,8 @@ subroutine gencan(n,x,l,u,m,lambda,rho,epsgpen,epsgpsn,maxitnfp,

C Print initial information

if( iprint .ge. 2 ) then
c LM: output for packmol
c write(*,1003) iter,f,gpsupn
if((mod((iter-1),10).eq.0.or.iter.eq.0).and.iter.ne.1) then
write(*,778)
else if(mod(iter,10).eq.0) then
write(*,779)
else if(iter.ne.1) then
write(*,777)
end if
end if
777 format('*******',$)
778 format(' |',$)
779 format('**********|')
c LM: progress bar for packmol
call printbar(iprint, iter, maxit)

if( iprint .ge. 3 ) then
write(*, 981) iter
Expand Down Expand Up @@ -2421,18 +2409,8 @@ subroutine gencan(n,x,l,u,m,lambda,rho,epsgpen,epsgpsn,maxitnfp,
end do

C Print information of this iteration

if( iprint .ge. 2 ) then
c Output for packmol
c write(*, 1003) iter,f,gpsupn
if((mod((iter-1),10).eq.0.or.iter.eq.0).and.iter.ne.1) then
write(*,778)
else if(mod(iter,10).eq.0) then
write(*,779)
else if(iter.ne.1) then
write(*,777)
end if
end if
c LM: progress bar for packmol
call printbar(iprint, iter, maxit)

if ( iprint .ge. 3 ) then
write(*, 983) iter,ittype
Expand Down
2 changes: 1 addition & 1 deletion src/heuristics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ subroutine movebad(n,x,fx,movebadprint)
x(ilugan+2) = x(ilugan2+2)
x(ilugan+3) = x(ilugan2+3)
call restmol(itype,ilubar,n,x,fx,.true.)
do while( j <= 65.d0*i/nmove )
do while( j <= 60*i/nmove )
write(*,"('*',$)")
j = j + 1
end do
Expand Down

0 comments on commit a609d60

Please sign in to comment.