Skip to content

Commit

Permalink
grid: Rename ga_gb_function constants
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Feb 7, 2020
1 parent 4e7a03d commit c695f28
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 93 deletions.
49 changes: 34 additions & 15 deletions src/grid/grid_collocate.F
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ MODULE grid_collocate
return_cube_nonortho
USE d3_poly, ONLY: poly_cp2k2d3
USE gauss_colloc, ONLY: collocGauss
USE grid_modify_pab_block, ONLY: &
FUNC_AB, FUNC_ADBmDAB, FUNC_ARB, FUNC_ARDBmDARB, FUNC_DABpADB, FUNC_DADB, FUNC_DX, &
FUNC_DXDX, FUNC_DXDY, FUNC_DY, FUNC_DYDY, FUNC_DYDZ, FUNC_DZ, FUNC_DZDX, FUNC_DZDZ, &
prepare_adb_m_dab, prepare_arb, prepare_ardb_m_darb, prepare_dab_p_adb, prepare_dadb, &
prepare_diadib, prepare_diiadiib, prepare_dijadijb
USE grid_modify_pab_block, ONLY: prepare_adb_m_dab,&
prepare_arb,&
prepare_ardb_m_darb,&
prepare_dab_p_adb,&
prepare_dadb,&
prepare_diadib,&
prepare_diiadiib,&
prepare_dijadijb
USE kinds, ONLY: dp,&
int_8
USE mathconstants, ONLY: fac
Expand All @@ -32,6 +35,22 @@ MODULE grid_collocate

PUBLIC :: collocate_pgf_product

INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_AB = 401
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DADB = 402
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_ADBmDAB = 403
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_ARDBmDARB = 404
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DABpADB = 405
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_ARB = 406
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DXDY = 601
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DYDZ = 602
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DZDX = 603
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DXDX = 604
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DYDY = 605
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DZDZ = 606
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DX = 501
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DY = 502
INTEGER, PARAMETER, PUBLIC :: GRID_FUNC_DZ = 503

CONTAINS

! **************************************************************************************************
Expand Down Expand Up @@ -191,7 +210,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
! it's a choice to compute lX_min/max, pab here,
! this way we get the same radius as we use for the corresponding density
SELECT CASE (ga_gb_function)
CASE (FUNC_DADB)
CASE (GRID_FUNC_DADB)
la_max_local = la_max + 1
la_min_local = MAX(la_min - 1, 0)
lb_max_local = lb_max + 1
Expand Down Expand Up @@ -221,7 +240,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
o1_local = 0
o2_local = 0
pab_local = pab_local*0.5_dp
CASE (FUNC_ADBmDAB)
CASE (GRID_FUNC_ADBmDAB)
CPASSERT(PRESENT(idir))
la_max_local = la_max + 1
la_min_local = MAX(la_min - 1, 0)
Expand Down Expand Up @@ -253,7 +272,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_DABpADB)
CASE (GRID_FUNC_DABpADB)
CPASSERT(PRESENT(idir))
la_max_local = la_max + 1
la_min_local = MAX(la_min - 1, 0)
Expand Down Expand Up @@ -285,7 +304,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_DX, FUNC_DY, FUNC_DZ)
CASE (GRID_FUNC_DX, GRID_FUNC_DY, GRID_FUNC_DZ)
ider1 = ga_gb_function - 500
la_max_local = la_max + 1
la_min_local = MAX(la_min - 1, 0)
Expand Down Expand Up @@ -317,7 +336,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_DXDY, FUNC_DYDZ, FUNC_DZDX)
CASE (GRID_FUNC_DXDY, GRID_FUNC_DYDZ, GRID_FUNC_DZDX)
ider1 = ga_gb_function - 600
ider2 = ga_gb_function - 600 + 1
IF (ider2 > 3) ider2 = ider1 - 2
Expand Down Expand Up @@ -347,7 +366,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_DXDX, FUNC_DYDY, FUNC_DZDZ)
CASE (GRID_FUNC_DXDX, GRID_FUNC_DYDY, GRID_FUNC_DZDZ)
ider1 = ga_gb_function - 603
la_max_local = la_max + 2
la_min_local = MAX(la_min - 2, 0)
Expand Down Expand Up @@ -376,7 +395,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_ARDBmDARB)
CASE (GRID_FUNC_ARDBmDARB)
CPASSERT(PRESENT(idir))
CPASSERT(PRESENT(ir))
la_max_local = la_max + 1
Expand Down Expand Up @@ -410,7 +429,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_ARB)
CASE (GRID_FUNC_ARB)
CPASSERT(PRESENT(ir))
la_max_local = la_max
la_min_local = la_min
Expand All @@ -437,7 +456,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END DO
o1_local = 0
o2_local = 0
CASE (FUNC_AB)
CASE (GRID_FUNC_AB)
la_max_local = la_max
la_min_local = la_min
lb_max_local = lb_max
Expand Down Expand Up @@ -582,7 +601,7 @@ SUBROUTINE collocate_pgf_product(la_max, zeta, la_min, &
END IF
END IF

IF (ga_gb_function /= FUNC_AB) THEN
IF (ga_gb_function /= GRID_FUNC_AB) THEN
DEALLOCATE (pab_local)
ENDIF

Expand Down
12 changes: 0 additions & 12 deletions src/grid/grid_modify_pab_block.F
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ MODULE grid_modify_pab_block

PUBLIC :: prepare_dadb, prepare_adb_m_dab, prepare_dab_p_adb, prepare_ardb_m_darb, prepare_arb
PUBLIC :: prepare_diadib, prepare_dijadijb, prepare_diiadiib
PUBLIC :: FUNC_AB, FUNC_ARB, FUNC_DADB, FUNC_ADBmDAB, FUNC_ARDBmDARB, FUNC_DABpADB
PUBLIC :: FUNC_DER, FUNC_DXDY, FUNC_DYDZ, FUNC_DZDX, FUNC_DX, FUNC_DY, FUNC_DZ
PUBLIC :: FUNC_DXDX, FUNC_DYDY, FUNC_DZDZ

! Flags for the type of function to be collocated
INTEGER, PARAMETER :: FUNC_AB = 401, FUNC_DADB = 402
INTEGER, PARAMETER :: FUNC_ADBmDAB = 403, FUNC_ARDBmDARB = 404
INTEGER, PARAMETER :: FUNC_DABpADB = 405, FUNC_ARB = 406
INTEGER, DIMENSION(0:9), PARAMETER :: FUNC_DER = (/401, 501, 502, 503, 601, 602, 603, 604, 605, 606/)
INTEGER, PARAMETER :: FUNC_DXDY = 601, FUNC_DYDZ = 602, FUNC_DZDX = 603
INTEGER, PARAMETER :: FUNC_DXDX = 604, FUNC_DYDY = 605, FUNC_DZDZ = 606
INTEGER, PARAMETER :: FUNC_DX = 501, FUNC_DY = 502, FUNC_DZ = 503

CONTAINS

Expand Down
6 changes: 3 additions & 3 deletions src/hirshfeld_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ MODULE hirshfeld_methods
USE cp_para_types, ONLY: cp_para_env_type
USE cp_units, ONLY: cp_unit_to_cp2k
USE cube_utils, ONLY: cube_info_type
USE grid_collocate, ONLY: collocate_pgf_product
USE grid_collocate, ONLY: GRID_FUNC_AB,&
collocate_pgf_product
USE grid_integrate, ONLY: integrate_pgf_product
USE grid_modify_pab_block, ONLY: FUNC_AB
USE hirshfeld_types, ONLY: get_hirshfeld_info,&
hirshfeld_type,&
set_hirshfeld_info
Expand Down Expand Up @@ -483,7 +483,7 @@ SUBROUTINE calculate_hirshfeld_normalization(qs_env, hirshfeld_env)
! la_max==0 so set lmax_global to 0
CALL collocate_pgf_product(0, alpha, 0, 0, 0.0_dp, 0, ra, &
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, 1.0_dp, pab, 0, 0, rs_rho, &
cell, cube_info, eps_rho_rspace, ga_gb_function=FUNC_AB, &
cell, cube_info, eps_rho_rspace, ga_gb_function=GRID_FUNC_AB, &
use_subpatch=.TRUE., subpatch_pattern=subpatch_pattern, &
lmax_global=0)
END DO
Expand Down
6 changes: 3 additions & 3 deletions src/mixed_cdft_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ MODULE mixed_cdft_methods
use_qmmm,&
use_qmmmx,&
use_qs_force
USE grid_collocate, ONLY: collocate_pgf_product
USE grid_modify_pab_block, ONLY: FUNC_AB
USE grid_collocate, ONLY: GRID_FUNC_AB,&
collocate_pgf_product
USE hirshfeld_methods, ONLY: create_shape_function
USE hirshfeld_types, ONLY: hirshfeld_type
USE input_constants, ONLY: &
Expand Down Expand Up @@ -2599,7 +2599,7 @@ SUBROUTINE mixed_becke_constraint_init(force_env, mixed_cdft, calculate_forces,
CALL collocate_pgf_product(0, alpha, 0, 0, 0.0_dp, 0, ra, &
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, 1.0_dp, pab, 0, 0, &
rs_cavity, cell, mixed_cdft%pw_env%cube_info(1), &
mixed_cdft%eps_rho_rspace, ga_gb_function=FUNC_AB, &
mixed_cdft%eps_rho_rspace, ga_gb_function=GRID_FUNC_AB, &
use_subpatch=.TRUE., &
subpatch_pattern=0_int_8, lmax_global=0)
END DO
Expand Down
10 changes: 5 additions & 5 deletions src/qs_cdft_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ MODULE qs_cdft_methods
USE cp_para_types, ONLY: cp_para_env_type
USE cp_realspace_grid_cube, ONLY: cp_cube_to_pw
USE cube_utils, ONLY: cube_info_type
USE grid_collocate, ONLY: collocate_pgf_product
USE grid_modify_pab_block, ONLY: FUNC_AB
USE grid_collocate, ONLY: GRID_FUNC_AB,&
collocate_pgf_product
USE hirshfeld_types, ONLY: get_hirshfeld_info,&
hirshfeld_type,&
set_hirshfeld_info
Expand Down Expand Up @@ -1284,20 +1284,20 @@ SUBROUTINE hirshfeld_constraint_low(qs_env)
CALL collocate_pgf_product(0, alpha, 0, 0, 0.0_dp, 0, ra, &
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, 1.0_dp, pab, 0, 0, &
rs_rho_all, cell, cube_info, eps_rho_rspace, &
ga_gb_function=FUNC_AB, use_subpatch=.TRUE., &
ga_gb_function=GRID_FUNC_AB, use_subpatch=.TRUE., &
subpatch_pattern=subpatch_pattern, lmax_global=0)
IF (is_constraint(atom_a)) &
CALL collocate_pgf_product(0, alpha, 0, 0, 0.0_dp, 0, ra, &
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, coefficients(atom_a), &
pab, 0, 0, rs_rho_constr, cell, cube_info, eps_rho_rspace, &
ga_gb_function=FUNC_AB, use_subpatch=.TRUE., &
ga_gb_function=GRID_FUNC_AB, use_subpatch=.TRUE., &
subpatch_pattern=subpatch_pattern, lmax_global=0)
IF (cdft_control%atomic_charges .AND. igroup == 1) THEN
IF (compute_charge(atom_a)) &
CALL collocate_pgf_product(0, alpha, 0, 0, 0.0_dp, 0, ra, &
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, 1.0_dp, pab, 0, 0, &
rs_single(atom_a)%rs_grid, cell, cube_info, eps_rho_rspace, &
ga_gb_function=FUNC_AB, use_subpatch=.TRUE., &
ga_gb_function=GRID_FUNC_AB, use_subpatch=.TRUE., &
subpatch_pattern=subpatch_pattern, lmax_global=0)
END IF
END DO
Expand Down
6 changes: 3 additions & 3 deletions src/qs_cdft_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ MODULE qs_cdft_utils
USE cp_para_types, ONLY: cp_para_env_type
USE cp_realspace_grid_cube, ONLY: cp_pw_to_cube
USE cp_units, ONLY: cp_unit_from_cp2k
USE grid_collocate, ONLY: collocate_pgf_product
USE grid_modify_pab_block, ONLY: FUNC_AB
USE grid_collocate, ONLY: GRID_FUNC_AB,&
collocate_pgf_product
USE hirshfeld_methods, ONLY: create_shape_function
USE hirshfeld_types, ONLY: create_hirshfeld_type,&
hirshfeld_type,&
Expand Down Expand Up @@ -379,7 +379,7 @@ SUBROUTINE becke_constraint_init(qs_env)
(/0.0_dp, 0.0_dp, 0.0_dp/), 0.0_dp, 1.0_dp, &
pab, 0, 0, rs_cavity, cell, pw_env%cube_info(1), &
dft_control%qs_control%eps_rho_rspace, &
ga_gb_function=FUNC_AB, &
ga_gb_function=GRID_FUNC_AB, &
use_subpatch=.TRUE., subpatch_pattern=0_int_8, &
lmax_global=0)
END DO
Expand Down

0 comments on commit c695f28

Please sign in to comment.