Commit 350d6c70 authored by Marco Govoni's avatar Marco Govoni
Browse files

Updated output to json.

parent 23a85a15
...@@ -29,11 +29,11 @@ SUBROUTINE west_print_clocks( ) ...@@ -29,11 +29,11 @@ SUBROUTINE west_print_clocks( )
TYPE(json_file) :: json TYPE(json_file) :: json
INTEGER :: iunit, nmax INTEGER :: iunit, nmax
REAL(DP), EXTERNAL :: scnds, cclock REAL(DP), EXTERNAL :: scnds, cclock
CHARACTER(20),EXTERNAL :: human_readable_time
! !
IF( mpime == root ) THEN IF( mpime == root ) THEN
CALL json%initialize() CALL json%initialize()
CALL json%load_file(filename=TRIM(logfile)) CALL json%load_file(filename=TRIM(logfile))
CALL json%add('timing.unit','s')
ENDIF ENDIF
! !
DO n = 1, nclock DO n = 1, nclock
...@@ -60,8 +60,10 @@ SUBROUTINE west_print_clocks( ) ...@@ -60,8 +60,10 @@ SUBROUTINE west_print_clocks( )
nmax = called(n) nmax = called(n)
! !
IF( mpime == root ) THEN IF( mpime == root ) THEN
CALL json%add('timing.'//TRIM(clock_label(n))//'.cpu',elapsed_cpu_time) CALL json%add('timing.'//TRIM(clock_label(n))//'.cpu:sec',elapsed_cpu_time)
CALL json%add('timing.'//TRIM(clock_label(n))//'.wall',elapsed_wall_time) CALL json%add('timing.'//TRIM(clock_label(n))//'.cpu:hum',TRIM(human_readable_time(elapsed_cpu_time)))
CALL json%add('timing.'//TRIM(clock_label(n))//'.wall:sec',elapsed_wall_time)
CALL json%add('timing.'//TRIM(clock_label(n))//'.wall:hum',TRIM(human_readable_time(elapsed_wall_time)))
CALL json%add('timing.'//TRIM(clock_label(n))//'.nocalls',nmax) CALL json%add('timing.'//TRIM(clock_label(n))//'.nocalls',nmax)
ENDIF ENDIF
! !
...@@ -75,5 +77,30 @@ SUBROUTINE west_print_clocks( ) ...@@ -75,5 +77,30 @@ SUBROUTINE west_print_clocks( )
CALL json%destroy() CALL json%destroy()
ENDIF ENDIF
! !
END SUBROUTINE
!
!-----------------------------------------------------------------------
SUBROUTINE get_clock_called( label, ncalls )
!----------------------------------------------------------------------------
!
USE mytime, ONLY : nclock, clock_label, called
!
IMPLICIT NONE
!
CHARACTER(LEN=*), INTENT(IN) :: label
INTEGER, INTENT(OUT) :: ncalls
!
INTEGER :: n
!
ncalls = 0
!
DO n = 1, nclock
!
IF( label /= clock_label(n) ) CYCLE
!
ncalls = called(n)
EXIT
!
ENDDO
! !
END SUBROUTINE END SUBROUTINE
...@@ -77,7 +77,10 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -77,7 +77,10 @@ SUBROUTINE davidson_diago_gamma ( )
! !
INTEGER :: il1,il2,ig1,ig2,i INTEGER :: il1,il2,ig1,ig2,i
REAL(DP) :: time_spent(2) REAL(DP) :: time_spent(2)
INTEGER :: sternop_ncalls(2)
CHARACTER(LEN=8) :: iter_label CHARACTER(LEN=8) :: iter_label
REAL(DP) :: pccg_res_tr2
INTEGER :: dfpt_dim, diago_dim
! !
REAL(DP), EXTERNAL :: GET_CLOCK REAL(DP), EXTERNAL :: GET_CLOCK
! !
...@@ -89,6 +92,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -89,6 +92,7 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL start_clock( 'chidiago' ) CALL start_clock( 'chidiago' )
time_spent(1)=get_clock( 'chidiago' ) time_spent(1)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(1) )
! !
! ... DISTRIBUTE nvecx ! ... DISTRIBUTE nvecx
! !
...@@ -165,10 +169,12 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -165,10 +169,12 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL do_mgs( dvg, 1, nvec) CALL do_mgs( dvg, 1, nvec)
! !
dfpt_dim = nbase
diago_dim = nbase
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, & WRITE(stdout, &
& "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 1/2')")& & "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 1/2')")&
& 'starting', nbase, nbase & 'starting', dfpt_dim, diago_dim
WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ")
! !
! Apply operator with DFPT ! Apply operator with DFPT
...@@ -182,7 +188,8 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -182,7 +188,8 @@ SUBROUTINE davidson_diago_gamma ( )
mloc = mloc + 1 mloc = mloc + 1
ENDDO ENDDO
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), -1._DP ) pccg_res_tr2 = -1._DP
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
dav_iter = -1 dav_iter = -1
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
! !
...@@ -199,10 +206,12 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -199,10 +206,12 @@ SUBROUTINE davidson_diago_gamma ( )
dvg = dng dvg = dng
CALL do_mgs( dvg, 1, nvec) CALL do_mgs( dvg, 1, nvec)
! !
dfpt_dim = nbase
diago_dim = nbase
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, & WRITE(stdout, &
& "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 2/2')")& & "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 2/2')")&
& 'starting', nbase, nbase & 'starting', dfpt_dim, diago_dim
WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ")
! !
! Apply operator with DFPT ! Apply operator with DFPT
...@@ -216,7 +225,8 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -216,7 +225,8 @@ SUBROUTINE davidson_diago_gamma ( )
mloc = mloc + 1 mloc = mloc + 1
ENDDO ENDDO
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), MIN(0.01_DP,1000000._DP*tr2_dfpt) ) pccg_res_tr2 = MIN(0.01_DP,1000000._DP*tr2_dfpt)
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
! !
! </ EXTRA STEP > ! </ EXTRA STEP >
! !
...@@ -228,11 +238,12 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -228,11 +238,12 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr ) CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr )
time_spent(2)=get_clock( 'chidiago' ) time_spent(2)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(2) )
ev(1:nvec) = ew(1:nvec) ev(1:nvec) = ew(1:nvec)
! !
! Write the eigenvalues & time spent ! Write the eigenvalues & time spent
! !
CALL output_ev_and_time(nvec,ev,time_spent) CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv)
dav_iter = 0 dav_iter = 0
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
! !
...@@ -247,12 +258,15 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -247,12 +258,15 @@ SUBROUTINE davidson_diago_gamma ( )
iterate: DO kter = 1, n_pdep_maxiter iterate: DO kter = 1, n_pdep_maxiter
! !
time_spent(1) = get_clock( 'chidiago' ) time_spent(1) = get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(1) )
! !
dav_iter = dav_iter + 1 dav_iter = dav_iter + 1
! !
dfpt_dim = notcnv
diago_dim = nbase+notcnv
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, "( 5x,'# Iteration = | ', i8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' |')") & WRITE(stdout, "( 5x,'# Iteration = | ', i8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' |')") &
&dav_iter, notcnv, nbase+notcnv &dav_iter, dfpt_dim, diago_dim
WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ")
! !
ALLOCATE( ishift( nvecx ), STAT=ierr ) ALLOCATE( ishift( nvecx ), STAT=ierr )
...@@ -306,7 +320,8 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -306,7 +320,8 @@ SUBROUTINE davidson_diago_gamma ( )
! !
! Apply operator with DFPT ! Apply operator with DFPT
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), tr2_dfpt ) pccg_res_tr2 = tr2_dfpt
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
! !
! ... update the reduced hamiltonian ! ... update the reduced hamiltonian
! !
...@@ -323,6 +338,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -323,6 +338,7 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr ) CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr )
time_spent(2)=get_clock( 'chidiago' ) time_spent(2)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(2) )
! !
! ... test for convergence ! ... test for convergence
! !
...@@ -336,7 +352,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -336,7 +352,7 @@ SUBROUTINE davidson_diago_gamma ( )
! !
! Write the eigenvalues & time spent ! Write the eigenvalues & time spent
! !
CALL output_ev_and_time(nvec,ev,time_spent) CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv)
! !
! ... if overall convergence has been achieved, or the dimension of ! ... if overall convergence has been achieved, or the dimension of
! ... the reduced basis set is becoming too large, or in any case if ! ... the reduced basis set is becoming too large, or in any case if
...@@ -358,7 +374,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -358,7 +374,7 @@ SUBROUTINE davidson_diago_gamma ( )
! !
CALL pdep_db_write( ) CALL pdep_db_write( )
CALL wstat_restart_clear() CALL wstat_restart_clear()
CALL output_a_report(-1) !CALL output_a_report(-1)
! !
WRITE(iter_label,'(i8)') kter WRITE(iter_label,'(i8)') kter
CALL io_push_title("Convergence achieved !!! in "//TRIM(iter_label)//" steps") CALL io_push_title("Convergence achieved !!! in "//TRIM(iter_label)//" steps")
...@@ -405,7 +421,7 @@ SUBROUTINE davidson_diago_gamma ( ) ...@@ -405,7 +421,7 @@ SUBROUTINE davidson_diago_gamma ( )
END IF END IF
! !
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
CALL output_a_report(dav_iter) !CALL output_a_report(dav_iter)
! !
END DO iterate END DO iterate
! !
...@@ -475,7 +491,10 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -475,7 +491,10 @@ SUBROUTINE davidson_diago_k ( )
! !
INTEGER :: il1,il2,ig1,ig2,i INTEGER :: il1,il2,ig1,ig2,i
REAL(DP) :: time_spent(2) REAL(DP) :: time_spent(2)
INTEGER :: sternop_ncalls(2)
CHARACTER(LEN=8) :: iter_label CHARACTER(LEN=8) :: iter_label
REAL(DP) :: pccg_res_tr2
INTEGER :: dfpt_dim, diago_dim
! !
REAL(DP), EXTERNAL :: GET_CLOCK REAL(DP), EXTERNAL :: GET_CLOCK
! !
...@@ -487,6 +506,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -487,6 +506,7 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL start_clock( 'chidiago' ) CALL start_clock( 'chidiago' )
time_spent(1)=get_clock( 'chidiago' ) time_spent(1)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(1) )
! !
! ... DISTRIBUTE nvecx ! ... DISTRIBUTE nvecx
! !
...@@ -563,10 +583,12 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -563,10 +583,12 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL do_mgs( dvg, 1, nvec) CALL do_mgs( dvg, 1, nvec)
! !
dfpt_dim = nbase
diago_dim = nbase
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, & WRITE(stdout, &
& "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 1/2')")& & "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 1/2')")&
& 'starting', nbase, nbase & 'starting', dfpt_dim, diago_dim
WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ")
! !
! Apply operator with DFPT ! Apply operator with DFPT
...@@ -580,7 +602,8 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -580,7 +602,8 @@ SUBROUTINE davidson_diago_k ( )
mloc = mloc + 1 mloc = mloc + 1
ENDDO ENDDO
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), -1._DP ) pccg_res_tr2 = -1._DP
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
dav_iter = -1 dav_iter = -1
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
! !
...@@ -597,10 +620,12 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -597,10 +620,12 @@ SUBROUTINE davidson_diago_k ( )
dvg = dng dvg = dng
CALL do_mgs( dvg, 1, nvec) CALL do_mgs( dvg, 1, nvec)
! !
dfpt_dim = nbase
diago_dim = nbase
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, & WRITE(stdout, &
& "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 2/2')")& & "( 5x,'# Iteration = | ', a8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' | x 2/2')")&
& 'starting', nbase, nbase & 'starting', dfpt_dim, diago_dim
WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( 5x,' *----------* *----------* *----------*') ")
! !
! Apply operator with DFPT ! Apply operator with DFPT
...@@ -614,7 +639,8 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -614,7 +639,8 @@ SUBROUTINE davidson_diago_k ( )
mloc = mloc + 1 mloc = mloc + 1
ENDDO ENDDO
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), MIN(0.01_DP,1000000._DP*tr2_dfpt) ) pccg_res_tr2 = MIN(0.01_DP,1000000._DP*tr2_dfpt)
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
! !
! </ EXTRA STEP > ! </ EXTRA STEP >
! !
...@@ -626,11 +652,12 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -626,11 +652,12 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr ) CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr )
time_spent(2)=get_clock( 'chidiago' ) time_spent(2)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(2) )
ev(1:nvec) = ew(1:nvec) ev(1:nvec) = ew(1:nvec)
! !
! Write the eigenvalues & time spent ! Write the eigenvalues & time spent
! !
CALL output_ev_and_time(nvec,ev,time_spent) CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv)
dav_iter = 0 dav_iter = 0
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
! !
...@@ -645,9 +672,12 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -645,9 +672,12 @@ SUBROUTINE davidson_diago_k ( )
iterate: DO kter = 1, n_pdep_maxiter iterate: DO kter = 1, n_pdep_maxiter
! !
time_spent(1) = get_clock( 'chidiago' ) time_spent(1) = get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(1) )
! !
dav_iter = dav_iter + 1 dav_iter = dav_iter + 1
! !
dfpt_dim = notcnv
diago_dim = nbase+notcnv
WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ") WRITE(stdout, "( /,5x,' *----------* *----------* *----------*') ")
WRITE(stdout, "( 5x,'# Iteration = | ', i8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' |')") & WRITE(stdout, "( 5x,'# Iteration = | ', i8,' |',' ','DFPT_dim = | ', i8,' |', ' ','Diago_dim = | ', i8,' |')") &
&dav_iter, notcnv, nbase+notcnv &dav_iter, notcnv, nbase+notcnv
...@@ -704,7 +734,8 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -704,7 +734,8 @@ SUBROUTINE davidson_diago_k ( )
! !
! Apply operator with DFPT ! Apply operator with DFPT
! !
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), tr2_dfpt ) pccg_res_tr2 = tr2_dfpt
CALL dfpt ( mloc, dvg(1,mstart), dng(1,mstart), pccg_res_tr2 )
! !
! ... update the reduced hamiltonian ! ... update the reduced hamiltonian
! !
...@@ -721,6 +752,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -721,6 +752,7 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr ) CALL diagox( nbase, nvec, hr_distr, nvecx, ew, vr_distr )
time_spent(2)=get_clock( 'chidiago' ) time_spent(2)=get_clock( 'chidiago' )
CALL get_clock_called( 'stern' , sternop_ncalls(2) )
! !
! ... test for convergence ! ... test for convergence
! !
...@@ -734,7 +766,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -734,7 +766,7 @@ SUBROUTINE davidson_diago_k ( )
! !
! Write the eigenvalues & time spent ! Write the eigenvalues & time spent
! !
CALL output_ev_and_time(nvec,ev,time_spent) CALL output_ev_and_time(nvec,ev,conv,time_spent,sternop_ncalls,pccg_res_tr2,dfpt_dim,diago_dim,dav_iter,notcnv)
! !
! ... if overall convergence has been achieved, or the dimension of ! ... if overall convergence has been achieved, or the dimension of
! ... the reduced basis set is becoming too large, or in any case if ! ... the reduced basis set is becoming too large, or in any case if
...@@ -756,7 +788,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -756,7 +788,7 @@ SUBROUTINE davidson_diago_k ( )
! !
CALL pdep_db_write( ) CALL pdep_db_write( )
CALL wstat_restart_clear() CALL wstat_restart_clear()
CALL output_a_report(-1) !CALL output_a_report(-1)
! !
WRITE(iter_label,'(i8)') kter WRITE(iter_label,'(i8)') kter
CALL io_push_title("Convergence achieved !!! in "//TRIM(iter_label)//" steps") CALL io_push_title("Convergence achieved !!! in "//TRIM(iter_label)//" steps")
...@@ -802,7 +834,7 @@ SUBROUTINE davidson_diago_k ( ) ...@@ -802,7 +834,7 @@ SUBROUTINE davidson_diago_k ( )
END IF END IF
! !
CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr) CALL wstat_restart_write( dav_iter, notcnv, nbase, ew, hr_distr, vr_distr)
CALL output_a_report(dav_iter) !!CALL output_a_report(dav_iter)
! !
END DO iterate END DO iterate
! !
...@@ -1062,90 +1094,145 @@ END SUBROUTINE ...@@ -1062,90 +1094,145 @@ END SUBROUTINE
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! !
SUBROUTINE output_a_report(iteration) !SUBROUTINE output_a_report(iteration)
! ! !
USE json_module, ONLY : json_file ! USE json_module, ONLY : json_file
USE kinds, ONLY : DP ! USE kinds, ONLY : DP
USE westcom, ONLY : n_pdep_eigen,ev,conv,wstat_output_dir ! USE westcom, ONLY : n_pdep_eigen,ev,conv,wstat_output_dir,logfile
USE west_io , ONLY : serial_table_output ! USE west_io , ONLY : serial_table_output
USE mp_world, ONLY : mpime,root ! USE mp_world, ONLY : mpime,root
! ! !
IMPLICIT NONE ! IMPLICIT NONE
! ! !
TYPE(json_file) :: json ! TYPE(json_file) :: json
INTEGER,INTENT(IN) :: iteration ! INTEGER,INTENT(IN) :: iteration
CHARACTER(LEN=9) :: pref ! CHARACTER(LEN=9) :: pref
INTEGER :: ip, ierr ! INTEGER :: ip, ierr, iunit
!REAL(DP) :: out_tab(n_pdep_eigen,3) ! !REAL(DP) :: out_tab(n_pdep_eigen,3)
! ! !
INTEGER,ALLOCATABLE :: ipert(:), converged(:) ! INTEGER,ALLOCATABLE :: converged(:)
! ! !
ALLOCATE( ipert(n_pdep_eigen), converged(n_pdep_eigen) ) ! ALLOCATE( converged(n_pdep_eigen) )
! ! !
converged = 0 ! converged = 0
DO ip=1,n_pdep_eigen ! DO ip=1,n_pdep_eigen
!out_tab(ip,1) = REAL(ip,DP) ! !out_tab(ip,1) = REAL(ip,DP)
ipert(ip) = ip ! !ipert(ip) = ip
!out_tab(ip,2) = ev(ip) ! !out_tab(ip,2) = ev(ip)
!out_tab(ip,3) = 0._DP ! !out_tab(ip,3) = 0._DP
!IF(conv(ip)) out_tab(ip,3) = 1._DP ! !IF(conv(ip)) out_tab(ip,3) = 1._DP
IF(conv(ip)) converged(ip) = 1 ! IF(conv(ip)) converged(ip) = 1
ENDDO ! ENDDO
IF(iteration>=0) THEN ! IF(iteration>=0) THEN
WRITE(pref,"('itr_',i5.5)") iteration ! WRITE(pref,"('itr_',i5.5)") iteration
ELSE ! ELSE
pref='converged' ! pref='converged'
ENDIF ! ENDIF
!CALL serial_table_output(mpime==root,4000,'wstat.'//TRIM(ADJUSTL(pref)),out_tab,n_pdep_eigen,3,(/' iprt','eigenv.',' conv.'/)) ! !CALL serial_table_output(mpime==root,4000,'wstat.'//TRIM(ADJUSTL(pref)),out_tab,n_pdep_eigen,3,(/' iprt','eigenv.',' conv.'/))
! ! !
IF( mpime == root ) THEN ! IF( mpime == root ) THEN
! ! !
CALL json%initialize() ! CALL json%initialize()
! ! !
CALL json%add('output.iprt', ipert ( 1:n_pdep_eigen ) ) ! CALL json%load_file(filename=TRIM(logfile))
CALL json%add('output.eigenvalue', ev ( 1:n_pdep_eigen ) ) ! !
CALL json%add('output.conv', converged ( 1:n_pdep_eigen ) ) ! CALL json%add('output.davitr'//TRIM(pref)//.'egvl', ev ( 1:n_pdep_eigen ) )
! ! CALL json%add('output.davitr'//TRIM(pref)//.'conv', converged ( 1:n_pdep_eigen ) )
OPEN(UNIT=4000,FILE=TRIM(ADJUSTL(wstat_output_dir))//"/o-wstat."//TRIM(ADJUSTL(pref))//".json",IOSTAT=ierr) ! !
CALL json%print_file( 4000 ) ! !OPEN(UNIT=4000,FILE=TRIM(ADJUSTL(wstat_output_dir))//"/o-wstat."//TRIM(ADJUSTL(pref))//".json",IOSTAT=ierr)
CLOSE( 4000, IOSTAT=ierr ) ! !CALL json%print_file( 4000 )
! ! !CLOSE( 4000, IOSTAT=ierr )
CALL json%destroy() ! !
! ! OPEN( NEWUNIT=iunit,FILE=TRIM(logfile) )
ENDIF ! CALL json%print_file( iunit )
! ! CLOSE( iunit )
DEALLOCATE( ipert, converged ) ! !
! ! CALL json%destroy()
END SUBROUTINE ! !
! ENDIF