From 3e5ca2828ffc6ed2e0e34f90fc1f02224e2cd7d7 Mon Sep 17 00:00:00 2001 From: Hossein Banihashemian Date: Thu, 19 Feb 2015 15:05:52 +0000 Subject: [PATCH] (implicit ps) switch the debug mode on/off from input file svn-origin-rev: 15088 --- src/input_cp2k_poisson.F | 10 ++++++++++ src/pw/dirichlet_bc_types.F | 2 ++ src/pw/ps_implicit_methods.F | 37 +++++++++++++++++++++++++++--------- src/pw_poisson_read_input.F | 1 + 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/input_cp2k_poisson.F b/src/input_cp2k_poisson.F index f1ea538060..20e13691fc 100644 --- a/src/input_cp2k_poisson.F +++ b/src/input_cp2k_poisson.F @@ -776,6 +776,7 @@ END SUBROUTINE create_ewald_section routineP = moduleN//':'//routineN LOGICAL :: failure + TYPE(keyword_type), POINTER :: keyword TYPE(section_type), POINTER :: subsection failure=.FALSE. @@ -787,6 +788,15 @@ END SUBROUTINE create_ewald_section n_keywords=1, n_subsections=4, repeats=.FALSE., required=.FALSE.,& error=error) + NULLIFY(keyword) + + CALL keyword_create(keyword, name="DEBUG", & + description="Whether or not to print out the values of the electrostatic potential "// & + "at Dirichlet regions.", & + usage="DEBUG ", default_l_val=.FALSE., error=error) + CALL section_add_keyword(section, keyword, error=error) + CALL keyword_release(keyword, error=error) + NULLIFY(subsection) CALL create_aa_planar_section(subsection, error) diff --git a/src/pw/dirichlet_bc_types.F b/src/pw/dirichlet_bc_types.F index 4a88fb9529..f28c217589 100644 --- a/src/pw/dirichlet_bc_types.F +++ b/src/pw/dirichlet_bc_types.F @@ -28,6 +28,8 @@ MODULE dirichlet_bc_types ! main types TYPE :: dirichlet_bc_parameters + LOGICAL :: debug + INTEGER :: n_aa_planar REAL(KIND=dp), DIMENSION(:,:), POINTER :: aa_planar_xxtnt => NULL() REAL(KIND=dp), DIMENSION(:,:), POINTER :: aa_planar_yxtnt => NULL() diff --git a/src/pw/ps_implicit_methods.F b/src/pw/ps_implicit_methods.F index 064792c740..51d71f6347 100644 --- a/src/pw/ps_implicit_methods.F +++ b/src/pw/ps_implicit_methods.F @@ -90,7 +90,6 @@ MODULE ps_implicit_methods compute_error_mixed_bc END INTERFACE ps_implicit_compute_error - LOGICAL, PRIVATE, PARAMETER :: debug = .FALSE. LOGICAL, PRIVATE, PARAMETER :: adjust_local_bounds = .FALSE. CONTAINS @@ -499,7 +498,8 @@ CONTAINS routineP = moduleN//':'//routineN INTEGER :: data_size, handle, iter, j, lb1, lb2, lb3, max_iter, n_gates, & - n_tiles_tot, ngpts_local, outp_unit, times_called, ub1, ub2, ub3 + n_tiles_tot, ng, ngpts_local, nt, nt_tot, outp_unit, times_called, ub1, & + ub2, ub3 INTEGER(KIND=int_8) :: ngpts INTEGER, DIMENSION(2, 3) :: bounds_local INTEGER, DIMENSION(3) :: npts_local @@ -683,13 +683,22 @@ CONTAINS END IF ! debugging - IF (debug) THEN + IF (poisson_params%dbc_params%debug) THEN v_new1D(ps_implicit_env%idx_3dto1d) = RESHAPE(v_new%cr3d, (/data_size/)) CALL DGEMV('N', n_tiles_tot, data_size, 1.0_dp, B, n_tiles_tot, v_new1D, 1, 0.0_dp, Bxv_new, 1) CALL mp_sum(Bxv_new, pw_grid%para%group) IF (outp_unit .GT. 0) THEN - WRITE(outp_unit, '(T8,A)') 'vhartree at DB regions : ' - WRITE(outp_unit, '(T8,E10.2)') Bxv_new + WRITE(outp_unit, '(T3,A,A)') "======== debug ", REPEAT('=', 63) + WRITE(outp_unit, '(T25,A)') "Drgn tile vhartree" + WRITE(outp_unit, '(T24,A)') REPEAT('-', 32) + nt_tot = 1 + DO ng = 1, n_gates + DO nt = 1, ps_implicit_env%gates(ng)%dirichlet_bc%n_tiles + WRITE(outp_unit, '(T22,I6,5X,I6,3X,E13.4)') ng, nt, Bxv_new(nt_tot) + nt_tot = nt_tot + 1 + END DO + END DO + WRITE(outp_unit, '(T3,A)') REPEAT('=', 78) END IF END IF @@ -761,7 +770,8 @@ CONTAINS routineP = moduleN//':'//routineN INTEGER :: data_size, handle, iter, j, lb1, lb2, lb3, max_iter, n_gates, & - n_tiles_tot, ngpts_local, outp_unit, times_called, ub1, ub2, ub3 + n_tiles_tot, ng, ngpts_local, nt, nt_tot, outp_unit, times_called, ub1, & + ub2, ub3 INTEGER(KIND=int_8) :: ngpts INTEGER, DIMENSION(2, 3) :: bounds_local INTEGER, DIMENSION(3) :: npts_local @@ -958,13 +968,22 @@ CONTAINS END IF ! debugging - IF (debug) THEN + IF (poisson_params%dbc_params%debug) THEN v_new1D(ps_implicit_env%idx_3dto1d) = RESHAPE(v_new%cr3d, (/data_size/)) CALL DGEMV('N', n_tiles_tot, data_size, 1.0_dp, B, n_tiles_tot, v_new1D, 1, 0.0_dp, Bxv_new, 1) CALL mp_sum(Bxv_new, pw_grid%para%group) IF (outp_unit .GT. 0) THEN - WRITE(outp_unit, '(T8,A)') 'vhartree at DB regions : ' - WRITE(outp_unit, '(T8,E10.2)') Bxv_new + WRITE(outp_unit, '(T3,A)') "======== debug "//REPEAT('=', 63) + WRITE(outp_unit, '(T25,A)') "Drgn tile vhartree" + WRITE(outp_unit, '(T24,A)') REPEAT('-', 32) + nt_tot = 1 + DO ng = 1, n_gates + DO nt = 1, ps_implicit_env%gates(ng)%dirichlet_bc%n_tiles + WRITE(outp_unit, '(T22,I6,5X,I6,3X,E13.4)') ng, nt, Bxv_new(nt_tot) + nt_tot = nt_tot + 1 + END DO + END DO + WRITE(outp_unit, '(T3,A)') REPEAT('=', 78) END IF END IF diff --git a/src/pw_poisson_read_input.F b/src/pw_poisson_read_input.F index 64d718b409..1d46fbc626 100644 --- a/src/pw_poisson_read_input.F +++ b/src/pw_poisson_read_input.F @@ -261,6 +261,7 @@ CONTAINS ! parsing DIRICHLET_BC subsection dbc_section => section_vals_get_subs_vals(ps_implicit_section, "DIRICHLET_BC", error=error) + CALL section_vals_val_get(dbc_section, "DEBUG", l_val=params%dbc_params%debug, error=error) aa_planar_section => section_vals_get_subs_vals(dbc_section, "AA_PLANAR", error=error) planar_section => section_vals_get_subs_vals(dbc_section, "PLANAR", error=error) xaa_cylindrical_section => section_vals_get_subs_vals(dbc_section, "XAA_CYLINDRICAL", error=error)