Commit b58c794d authored by Victor Yu's avatar Victor Yu

Update NTPoly to version 2.1

This contains an important fix in LoggingModule.
parent f03baee7
......@@ -15,6 +15,7 @@ LIST(APPEND ntpoly_src
src/LinearSolversModule.f90
src/LoadBalancerModule.f90
src/LoggingModule.f90
src/MatrixMapsModule.f90
src/MatrixMarketModule.f90
src/MatrixMemoryPoolModule.f90
src/NTMPIModule.f90
......
......@@ -17,11 +17,13 @@ repository. We of course recommend that you download a
to get started.
Installing NTPoly requires the following software:
* A Fortran Compiler.
* An MPI Installation (MPI-3 Standard+).
* CMake (Version 3.2+).
The following optional software can greatly enhance the NTPoly experience:
* BLAS: for multiplying dense matrices, if they emerge in the calculation.
* A C++ Compiler for building C++ bindings.
* Doxygen: for building documentation.
......@@ -113,7 +115,6 @@ The following features and methods have been implemented in NTPoly:
* Square Root and Inverse Square Root
* Matrix *p* th Root
* Quantum Chemistry
* Density Matrix Minimization
* Density Matrix Purification
* Chemical Potential Calculation
* Geometry Optimization
......@@ -126,7 +127,7 @@ The following features and methods have been implemented in NTPoly:
Citation
--------------------------------------------------------------------------------
A description of the techniques used in NTPoly can be found in the following
Computer Phyics Communications paper:
Computer Physics Communications paper:
> Dawson, William, and Takahito Nakajima. "Massively parallel sparse matrix
> function calculations with NTPoly." Computer Physics Communications (2017).
......
......@@ -116,8 +116,8 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Chebyshev Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Standard")
CALL WriteElement(key="Degree", int_value_in=degree-1)
CALL WriteElement(key="Method", value="Standard")
CALL WriteElement(key="Degree", value=degree-1)
CALL PrintParameters(solver_parameters)
END IF
......@@ -226,8 +226,8 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Chebyshev Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Recursive")
CALL WriteElement(key="Degree", int_value_in=degree-1)
CALL WriteElement(key="Method", value="Recursive")
CALL WriteElement(key="Degree", value=degree-1)
CALL PrintParameters(solver_parameters)
END IF
......
......@@ -79,7 +79,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="PM")
CALL WriteElement(key="Method", value="PM")
CALL WriteCitation("palser1998canonical")
CALL PrintParameters(solver_parameters)
END IF
......@@ -191,10 +191,10 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = ABS(energy_value - energy_value2)
IF (solver_parameters%be_verbose) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter)
CALL WriteListElement(key="Round", value=outer_counter)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement("Energy_Value", float_value_in=energy_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement("Energy_Value", value=energy_value)
CALL ExitSubLog
END IF
......@@ -205,7 +205,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter)
CALL WriteElement(key="Total_Iterations",value=outer_counter)
CALL PrintMatrixInformation(X_k)
END IF
......@@ -328,7 +328,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="TRS2")
CALL WriteElement(key="Method", value="TRS2")
CALL WriteCitation("niklasson2002expansion")
CALL PrintParameters(solver_parameters)
END IF
......@@ -406,10 +406,10 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = ABS(energy_value - energy_value2)
IF (solver_parameters%be_verbose) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter)
CALL WriteListElement(key="Round", value=outer_counter)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement("Energy_Value", float_value_in=energy_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement("Energy_Value", value=energy_value)
CALL ExitSubLog
END IF
......@@ -420,7 +420,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter)
CALL WriteElement(key="Total_Iterations",value=outer_counter)
CALL PrintMatrixInformation(X_k)
END IF
......@@ -538,7 +538,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="TRS4")
CALL WriteElement(key="Method", value="TRS4")
CALL WriteCitation("niklasson2002expansion")
CALL PrintParameters(solver_parameters)
END IF
......@@ -636,10 +636,10 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = ABS(energy_value - energy_value2)
IF (solver_parameters%be_verbose) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter)
CALL WriteListElement(key="Round", value=outer_counter)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement("Energy_Value", float_value_in=energy_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement("Energy_Value", value=energy_value)
CALL ExitSubLog
END IF
......@@ -650,7 +650,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter)
CALL WriteElement(key="Total_Iterations",value=outer_counter)
CALL PrintMatrixInformation(X_k)
END IF
......@@ -780,7 +780,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="HPCP")
CALL WriteElement(key="Method", value="HPCP")
CALL WriteCitation("truflandier2016communication")
CALL PrintParameters(solver_parameters)
END IF
......@@ -882,10 +882,10 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = ABS(energy_value - energy_value2)
IF (solver_parameters%be_verbose) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter)
CALL WriteListElement(key="Round", value=outer_counter)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement("Energy_Value", float_value_in=energy_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement("Energy_Value", value=energy_value)
CALL ExitSubLog
END IF
......@@ -896,7 +896,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter)
CALL WriteElement(key="Total_Iterations",value=outer_counter)
CALL PrintMatrixInformation(D1)
END IF
......@@ -1022,7 +1022,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="HPCP+")
CALL WriteElement(key="Method", value="HPCP+")
CALL WriteCitation("truflandier2016communication")
CALL PrintParameters(solver_parameters)
END IF
......@@ -1161,10 +1161,10 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = ABS(energy_value - energy_value2)
IF (solver_parameters%be_verbose) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter)
CALL WriteListElement(key="Round", value=outer_counter)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement("Energy_Value", float_value_in=energy_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement("Energy_Value", value=energy_value)
CALL ExitSubLog
END IF
......@@ -1175,7 +1175,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter)
CALL WriteElement(key="Total_Iterations",value=outer_counter)
CALL PrintMatrixInformation(D1)
END IF
......
......@@ -192,9 +192,9 @@ CONTAINS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = solver_parameters%converge_diff + 1.0_NTREAL
DO outer_counter = 1,solver_parameters%max_iterations
IF (solver_parameters%be_verbose .AND. outer_counter .GT. 1) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter-1)
CALL WriteListElement(key="Round", value=outer_counter-1)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement(key="Convergence", value=norm_value)
CALL ExitSubLog
END IF
......@@ -217,7 +217,7 @@ CONTAINS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END DO
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter-1)
CALL WriteElement(key="Total_Iterations",value=outer_counter-1)
END IF
!! Compute The Largest Eigenvalue
......@@ -228,7 +228,7 @@ CONTAINS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
max_value = max_value / scale_value
IF (solver_parameters%be_verbose) THEN
CALL WriteElement(key="Max_Eigen_Value",float_value_in=max_value)
CALL WriteElement(key="Max_Eigen_Value",value=max_value)
CALL ExitSubLog
END IF
......
......@@ -70,7 +70,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Exponential Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Chebyshev")
CALL WriteElement(key="Method", value="Chebyshev")
CALL PrintParameters(solver_parameters)
END IF
......@@ -89,7 +89,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sub_solver_parameters%threshold = sub_solver_parameters%threshold/sigma_val
IF (solver_parameters%be_verbose) THEN
CALL WriteElement(key="Sigma", float_value_in=sigma_val)
CALL WriteElement(key="Sigma", value=sigma_val)
END IF
!! Expand Chebyshev Series
......@@ -183,7 +183,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Exponential Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Pade")
CALL WriteElement(key="Method", value="Pade")
CALL PrintParameters(solver_parameters)
END IF
......@@ -202,8 +202,8 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CALL CopyMatrix(InputMat, ScaledMat)
CALL ScaleMatrix(ScaledMat,1.0/sigma_val)
IF (solver_parameters%be_verbose) THEN
CALL WriteElement(key="Sigma", float_value_in=sigma_val)
CALL WriteElement(key="Scaling_Steps", int_value_in=sigma_counter)
CALL WriteElement(key="Sigma", value=sigma_val)
CALL WriteElement(key="Scaling_Steps", value=sigma_counter)
END IF
!! Sub Solver Parameters
......@@ -306,7 +306,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Exponential Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Taylor")
CALL WriteElement(key="Method", value="Taylor")
CALL PrintParameters(solver_parameters)
END IF
......@@ -406,7 +406,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Logarithm Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Chebyshev")
CALL WriteElement(key="Method", value="Chebyshev")
CALL PrintParameters(solver_parameters)
END IF
......@@ -427,7 +427,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sigma_counter = sigma_counter + 1
END DO
IF (solver_parameters%be_verbose) THEN
CALL WriteElement(key="Sigma", int_value_in=sigma_val)
CALL WriteElement(key="Sigma", value=sigma_val)
END IF
f_sub_solver_parameters%threshold = &
& f_sub_solver_parameters%threshold/REAL(2**(sigma_counter-1),NTREAL)
......@@ -525,7 +525,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Logarithm Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Taylor")
CALL WriteElement(key="Method", value="Taylor")
CALL PrintParameters(solver_parameters)
END IF
......
......@@ -65,7 +65,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Extrapolator")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Purification")
CALL WriteElement(key="Method", value="Purification")
CALL WriteCitation("niklasson2010trace")
CALL PrintParameters(solver_parameters)
END IF
......@@ -132,12 +132,12 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END IF
IF (solver_parameters%be_verbose .AND. outer_counter .GT. 1) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter-1)
CALL WriteListElement(key="Round", value=outer_counter-1)
CALL EnterSubLog
CALL WriteElement(key="Convergence", float_value_in=norm_value)
CALL WriteElement(key="Trace", float_value_in=trace_value)
CALL WriteElement(key="AddTrace", float_value_in=add_trace)
CALL WriteElement(key="SubtractTrace", float_value_in=subtract_trace)
CALL WriteElement(key="Convergence", value=norm_value)
CALL WriteElement(key="Trace", value=trace_value)
CALL WriteElement(key="AddTrace", value=add_trace)
CALL WriteElement(key="SubtractTrace", value=subtract_trace)
CALL ExitSubLog
END IF
......@@ -163,7 +163,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
total_iterations = outer_counter-1
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=total_iterations)
CALL WriteElement(key="Total_Iterations",value=total_iterations)
CALL PrintMatrixInformation(NewDensity)
END IF
......@@ -222,7 +222,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Density Matrix Extrapolator")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Lowdin")
CALL WriteElement(key="Method", value="Lowdin")
CALL WriteCitation("exner2002comparison")
CALL PrintParameters(solver_parameters)
END IF
......
......@@ -114,8 +114,8 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Hermite Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="Standard")
CALL WriteElement(key="Degree", int_value_in=degree-1)
CALL WriteElement(key="Method", value="Standard")
CALL WriteElement(key="Degree", value=degree-1)
CALL PrintParameters(solver_parameters)
END IF
......
......@@ -90,9 +90,9 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = solver_parameters%converge_diff + 1.0_NTREAL
DO outer_counter = 1,solver_parameters%max_iterations
IF (solver_parameters%be_verbose .AND. outer_counter .GT. 1) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter-1)
CALL WriteListElement(key="Round", value=outer_counter-1)
CALL EnterSubLog
CALL WriteListElement(key="Convergence", float_value_in=norm_value)
CALL WriteListElement(key="Convergence", value=norm_value)
CALL ExitSubLog
END IF
......@@ -122,7 +122,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END DO
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter-1)
CALL WriteElement(key="Total_Iterations",value=outer_counter-1)
CALL PrintMatrixInformation(InverseMat)
END IF
......@@ -211,9 +211,9 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = solver_parameters%converge_diff + 1.0_NTREAL
DO outer_counter = 1,solver_parameters%max_iterations
IF (solver_parameters%be_verbose .AND. outer_counter .GT. 1) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter-1)
CALL WriteListElement(key="Round", value=outer_counter-1)
CALL EnterSubLog
CALL WriteListElement(key="Convergence", float_value_in=norm_value)
CALL WriteListElement(key="Convergence", value=norm_value)
CALL ExitSubLog
END IF
......@@ -242,7 +242,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END DO
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter-1)
CALL WriteElement(key="Total_Iterations",value=outer_counter-1)
CALL PrintMatrixInformation(InverseMat)
END IF
......
......@@ -60,7 +60,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF (solver_parameters%be_verbose) THEN
CALL WriteHeader("Linear Solver")
CALL EnterSubLog
CALL WriteElement(key="Method", text_value_in="CG")
CALL WriteElement(key="Method", value="CG")
CALL PrintParameters(solver_parameters)
END IF
......@@ -104,9 +104,9 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
norm_value = solver_parameters%converge_diff + 1.0_NTREAL
DO outer_counter = 1,solver_parameters%max_iterations
IF (solver_parameters%be_verbose .AND. outer_counter .GT. 1) THEN
CALL WriteListElement(key="Round", int_value_in=outer_counter-1)
CALL WriteListElement(key="Round", value=outer_counter-1)
CALL EnterSubLog
CALL WriteListElement(key="Convergence", float_value_in=norm_value)
CALL WriteListElement(key="Convergence", value=norm_value)
CALL ExitSubLog
END IF
IF (norm_value .LE. solver_parameters%converge_diff) THEN
......@@ -153,7 +153,7 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END DO
IF (solver_parameters%be_verbose) THEN
CALL ExitSubLog
CALL WriteElement(key="Total_Iterations",int_value_in=outer_counter-1)
CALL WriteElement(key="Total_Iterations",value=outer_counter-1)
CALL PrintMatrixInformation(XMat)
END IF
......
......@@ -18,6 +18,19 @@ MODULE LoggingModule
PUBLIC :: WriteElement
PUBLIC :: WriteCitation
PUBLIC :: ExitSubLog
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
INTERFACE WriteListElement
MODULE PROCEDURE WriteListElement_bool
MODULE PROCEDURE WriteListElement_float
MODULE PROCEDURE WriteListElement_int
MODULE PROCEDURE WriteListElement_string
END INTERFACE
INTERFACE WriteElement
MODULE PROCEDURE WriteElement_bool
MODULE PROCEDURE WriteElement_float
MODULE PROCEDURE WriteElement_int
MODULE PROCEDURE WriteElement_string
END INTERFACE
CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Activate the logger.
SUBROUTINE ActivateLogger
......@@ -52,92 +65,158 @@ CONTAINS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END SUBROUTINE WriteHeader
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a element.
SUBROUTINE WriteElement(key, text_value_in, int_value_in, float_value_in, &
& bool_value_in)
SUBROUTINE WriteElement_bool(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> A text value to write.
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: text_value_in
!> An integer value to write.
INTEGER, INTENT(IN), OPTIONAL :: int_value_in
LOGICAL, INTENT(IN) :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') key
IF (value) THEN
WRITE(*,'(A)',ADVANCE='no') ": True"
ELSE
WRITE(*,'(A)',ADVANCE='no') ": False"
END IF
WRITE(*,*)
END IF
END SUBROUTINE WriteElement_bool
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a element.
SUBROUTINE WriteElement_float(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> A float value to write.
REAL(NTReal), INTENT(IN), OPTIONAL :: float_value_in
!> A bool value to write.
LOGICAL, INTENT(IN), OPTIONAL :: bool_value_in
REAL(NTReal), INTENT(IN) :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') key
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(ES22.14)',ADVANCE='no') value
IF (PRESENT(text_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(A)',ADVANCE='no') text_value_in
END IF
IF (PRESENT(int_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(I10)',ADVANCE='no') int_value_in
END IF
IF (PRESENT(float_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(ES22.14)',ADVANCE='no') float_value_in
END IF
IF (PRESENT(bool_value_in)) THEN
IF (bool_value_in) THEN
WRITE(*,'(A)',ADVANCE='no') ": True"
ELSE
WRITE(*,'(A)',ADVANCE='no') ": False"
END IF
WRITE(*,*)
END IF
END SUBROUTINE WriteElement_float
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a element.
SUBROUTINE WriteElement_int(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> An integer value to write.
INTEGER, INTENT(IN) :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') key
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(I10)',ADVANCE='no') value
WRITE(*,*)
END IF
END SUBROUTINE WriteElement_int
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a element.
SUBROUTINE WriteElement_string(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> A text value to write.
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') key
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(A)',ADVANCE='no') value
WRITE(*,*)
END IF
END SUBROUTINE WriteElement_string
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a list element.
SUBROUTINE WriteListElement_bool(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> A bool value to write.
LOGICAL, INTENT(IN) :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') "- "
WRITE(*,'(A)',ADVANCE='no') key
IF (value) THEN
WRITE(*,'(A)',ADVANCE='no') ": True"
ELSE
WRITE(*,'(A)',ADVANCE='no') ": False"
END IF
WRITE(*,*)
END IF
END SUBROUTINE WriteElement
END SUBROUTINE WriteListElement_bool
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Write out a list element.
!> Only specify one of the kinds of values.
SUBROUTINE WriteListElement(key, text_value_in, int_value_in, float_value_in,&
bool_value_in)
SUBROUTINE WriteListElement_float(key, value)
!> Some text to write.
CHARACTER(LEN=*), INTENT(IN) :: key
!> A text value to write.
CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: text_value_in
!> An integer value to write.
INTEGER, INTENT(IN), OPTIONAL :: int_value_in
!> A float value to write.
REAL(NTReal), INTENT(IN), OPTIONAL :: float_value_in
!> A bool value to write.
LOGICAL, INTENT(IN), OPTIONAL :: bool_value_in
REAL(NTReal), INTENT(IN) :: value
IF (IsActive) THEN
CALL WriteIndent
WRITE(*,'(A)',ADVANCE='no') "- "
WRITE(*,'(A)',ADVANCE='no') key
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(ES22.14)',ADVANCE='no') value
IF (PRESENT(text_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(A)',ADVANCE='no') text_value_in
END IF
IF (PRESENT(int_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(I10)',ADVANCE='no') int_value_in
END IF
IF (PRESENT(float_value_in)) THEN
WRITE(*,'(A)',ADVANCE='no') ": "
WRITE(*,'(ES22.14)',ADVANCE='no') float_value_in
END IF
IF (PRESENT(bool_value_in)) THEN
IF (bool_value_in) THEN
WRITE(*,'(A)',ADVANCE='no') ": True"
ELSE
WRITE(*,'(A)',ADVANCE='no') ": False"
END IF
END IF
WRITE(*,*)
END IF
END SUBROUTINE WriteListElement_float