Skip to content

Commit

Permalink
Fix coding conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
edditler authored and oschuett committed Feb 16, 2023
1 parent 64b48f6 commit b2cb13c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
35 changes: 14 additions & 21 deletions src/qs_mfp.F
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ MODULE qs_mfp
0.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, -1.0_dp, 0.0_dp, 0.0_dp, &
0.0_dp, -1.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp/), &
(/3, 3, 3/))
INTEGER, DIMENSION(3, 3), PARAMETER :: multipole_2d_to_1d = RESHAPE([4, 5, 6, 5, 7, 8, 6, 8, 9], [3, 3])
CONTAINS

! **************************************************************************************************
Expand Down Expand Up @@ -134,13 +133,13 @@ SUBROUTINE mfp_aat(vcd_env, qs_env)
! CALL cp_fm_scale_and_add(0._dp, vcd_env%dCB_prime(alpha), -1._dp, vcd_env%dCB(alpha))
CALL cp_dbcsr_sm_fm_multiply(vcd_env%matrix_dSdB(alpha)%matrix, mo_coeff, &
buf, ncol=nmo, alpha=1._dp, beta=0._dp)
CALL cp_fm_gemm("T", "N", nmo, nmo, nao, &
1.0_dp, mo_coeff, buf, &
0.0_dp, matrix_dSdB_mo)
CALL parallel_gemm("T", "N", nmo, nmo, nao, &
1.0_dp, mo_coeff, buf, &
0.0_dp, matrix_dSdB_mo)

CALL cp_fm_gemm("N", "N", nao, nmo, nmo, &
-0.5_dp, mo_coeff, matrix_dSdB_mo, &
0.0_dp, vcd_env%dCB_prime(alpha))
CALL parallel_gemm("N", "N", nao, nmo, nmo, &
-0.5_dp, mo_coeff, matrix_dSdB_mo, &
0.0_dp, vcd_env%dCB_prime(alpha))

END DO

Expand Down Expand Up @@ -1157,7 +1156,7 @@ SUBROUTINE mfp_response(vcd_env, p_env, qs_env, alpha)

CHARACTER(LEN=*), PARAMETER :: routineN = 'mfp_response'

INTEGER :: handle, ispin, nspins, output_unit
INTEGER :: handle, output_unit
LOGICAL :: failure, should_stop
TYPE(cp_fm_type), DIMENSION(1) :: h1_psi0, psi1
TYPE(cp_logger_type), POINTER :: logger
Expand Down Expand Up @@ -1190,16 +1189,14 @@ SUBROUTINE mfp_response(vcd_env, p_env, qs_env, alpha)

! allocate the vectors
ASSOCIATE (psi0_order => vcd_env%dcdr_env%mo_coeff)
CALL cp_fm_create(psi1(ispin), vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
CALL cp_fm_create(h1_psi0(ispin), vcd_env%dcdr_env%likemos_fm_struct(ispin)%struct)
CALL cp_fm_create(psi1(1), vcd_env%dcdr_env%likemos_fm_struct(1)%struct)
CALL cp_fm_create(h1_psi0(1), vcd_env%dcdr_env%likemos_fm_struct(1)%struct)

! Restart
IF (linres_control%linres_restart) THEN
CALL vcd_read_restart(qs_env, lr_section, psi1, vcd_env%dcdr_env%lambda, alpha, "dCdB")
ELSE
DO ispin = 1, nspins
CALL cp_fm_set_all(psi1(ispin), 0.0_dp)
END DO
CALL cp_fm_set_all(psi1(1), 0.0_dp)
END IF

IF (output_unit > 0) THEN
Expand All @@ -1213,20 +1210,16 @@ SUBROUTINE mfp_response(vcd_env, p_env, qs_env, alpha)
! h1_psi0 = (H1-E1)
! psi0_order = the unperturbed wavefunction
! Second response to get dCB
DO ispin = 1, nspins
CALL cp_fm_set_all(vcd_env%dCB(alpha), 0.0_dp)
CALL cp_fm_set_all(h1_psi0(ispin), 0.0_dp)
CALL cp_fm_to_fm(vcd_env%op_dB(ispin), h1_psi0(ispin))
END DO
CALL cp_fm_set_all(vcd_env%dCB(alpha), 0.0_dp)
CALL cp_fm_set_all(h1_psi0(1), 0.0_dp)
CALL cp_fm_to_fm(vcd_env%op_dB(1), h1_psi0(1))

linres_control%lr_triplet = .FALSE. ! we do singlet response
linres_control%do_kernel = .FALSE. ! no coupled response since imaginary perturbation
linres_control%converged = .FALSE.
CALL linres_solver(p_env, qs_env, psi1, h1_psi0, psi0_order, &
output_unit, should_stop)
DO ispin = 1, nspins
CALL cp_fm_to_fm(psi1(ispin), vcd_env%dCB(alpha))
END DO
CALL cp_fm_to_fm(psi1(1), vcd_env%dCB(alpha))

! Write the new result to the restart file
IF (linres_control%linres_restart) THEN
Expand Down
5 changes: 0 additions & 5 deletions src/qs_vcd_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,6 @@ SUBROUTINE vcd_env_init(vcd_env, qs_env)
CALL cp_print_key_finished_output(output_unit, logger, lr_section, &
"PRINT%PROGRAM_RUN_INFO")
! IF (vcd_env%output_unit > 0) THEN
! WRITE (vcd_env%output_unit, *) 'size(vcd_env%list_of_atoms)', SIZE(vcd_env%dcdr_env%list_of_atoms)
! WRITE (vcd_env%output_unit, *) 'vcd_env%list_of_atoms', vcd_env%dcdr_env%list_of_atoms
! END IF
CALL timestop(handle)
END SUBROUTINE vcd_env_init
Expand Down Expand Up @@ -628,7 +624,6 @@ SUBROUTINE vcd_read_restart(qs_env, linres_section, vec, lambda, beta, tag)
! check that the number nao, nmo and nspins are
! the same as in the current mos
IF (nspins_tmp .NE. nspins) THEN
PRINT *, 'nspins_tmp, nspins', nspins_tmp, nspins
CPABORT("nspins not consistent")
END IF
IF (nao_tmp .NE. nao) CPABORT("nao not consistent")
Expand Down

0 comments on commit b2cb13c

Please sign in to comment.