17 dbcsr_type_antisymmetric,&
18 dbcsr_type_no_symmetry
71#include "./base/base_uses.f90"
80 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_vcd_utils'
82 REAL(dp),
DIMENSION(3, 3, 3),
PARAMETER :: Levi_Civita = reshape([ &
83 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp, -1.0_dp, 0.0_dp, 1.0_dp, 0.0_dp, &
84 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, &
85 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])
99 CHARACTER(LEN=*),
PARAMETER :: routinen =
'vcd_env_init'
101 INTEGER :: handle, i, idir, ispin, j, natom, &
102 nspins, output_unit, reference, &
105 REAL(kind=dp),
DIMENSION(:),
POINTER :: ref_point
108 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, my_matrix_hr_1d
111 POINTER :: sab_all, sab_orb, sap_ppnl
113 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
117 CALL timeset(routinen, handle)
118 vcd_env%do_mfp = .false.
121 NULLIFY (logger, vcd_section, lr_section)
125 extension=
".data", middle_name=
"vcd", log_filename=.false., &
126 file_position=
"REWIND", file_status=
"REPLACE")
130 extension=
".linresLog")
131 unit_number =
cp_print_key_unit_nr(logger, lr_section,
"PRINT%PROGRAM_RUN_INFO", extension=
".linresLog")
137 IF (output_unit > 0)
THEN
138 WRITE (output_unit,
"(/,T20,A,/)")
"*** Start NVPT/MFPT calculation ***"
145 CALL section_vals_val_get(vcd_section,
"ORIGIN_DEPENDENT_MFP", l_val=vcd_env%origin_dependent_op_mfp)
148 vcd_env%magnetic_origin = 0._dp
149 vcd_env%spatial_origin = 0._dp
157 cpabort(
"User-defined reference point should be given explicitly")
162 reference=reference, &
172 cpabort(
"User-defined reference point should be given explicitly")
177 reference=reference, &
180 IF (vcd_env%distributed_origin .AND. any(vcd_env%magnetic_origin /= vcd_env%spatial_origin))
THEN
181 cpwarn(
"The magnetic and spatial origins don't match")
185 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,3F10.6)") &
186 'The reference point is', vcd_env%dcdr_env%ref_point
187 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,3F10.6)") &
188 'The magnetic origin is', vcd_env%magnetic_origin
189 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,3F10.6)") &
190 'The velocity origin is', vcd_env%spatial_origin
192 vcd_env%magnetic_origin_atom = vcd_env%magnetic_origin
193 vcd_env%spatial_origin_atom = vcd_env%spatial_origin
197 dft_control=dft_control, &
201 particle_set=particle_set, &
202 matrix_ks=matrix_ks, &
204 qs_kind_set=qs_kind_set)
206 natom =
SIZE(particle_set)
207 nspins = dft_control%nspins
209 ALLOCATE (vcd_env%apt_el_nvpt(3, 3, natom))
210 ALLOCATE (vcd_env%apt_nuc_nvpt(3, 3, natom))
211 ALLOCATE (vcd_env%apt_total_nvpt(3, 3, natom))
212 ALLOCATE (vcd_env%aat_atom_nvpt(3, 3, natom))
213 ALLOCATE (vcd_env%aat_atom_mfp(3, 3, natom))
214 vcd_env%apt_el_nvpt = 0._dp
215 vcd_env%apt_nuc_nvpt = 0._dp
216 vcd_env%apt_total_nvpt = 0._dp
217 vcd_env%aat_atom_nvpt = 0._dp
218 vcd_env%aat_atom_mfp = 0._dp
220 ALLOCATE (vcd_env%dCV(nspins))
221 ALLOCATE (vcd_env%dCV_prime(nspins))
222 ALLOCATE (vcd_env%op_dV(nspins))
223 ALLOCATE (vcd_env%op_dB(nspins))
225 CALL cp_fm_create(vcd_env%dCV(ispin), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
226 CALL cp_fm_create(vcd_env%dCV_prime(ispin), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
227 CALL cp_fm_create(vcd_env%op_dV(ispin), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
228 CALL cp_fm_create(vcd_env%op_dB(ispin), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
231 ALLOCATE (vcd_env%dCB(3))
232 ALLOCATE (vcd_env%dCB_prime(3))
234 CALL cp_fm_create(vcd_env%dCB(i), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
235 CALL cp_fm_create(vcd_env%dCB_prime(i), vcd_env%dcdr_env%likemos_fm_struct(1)%struct, set_zero=.true.)
266 CALL dbcsr_init_p(vcd_env%moments_der_right(i, idir)%matrix)
267 CALL dbcsr_init_p(vcd_env%moments_der_left(i, idir)%matrix)
269 CALL dbcsr_create(vcd_env%moments_der(i, idir)%matrix, template=matrix_ks(1)%matrix, &
270 matrix_type=dbcsr_type_antisymmetric)
272 CALL dbcsr_set(vcd_env%moments_der(i, idir)%matrix, 0.0_dp)
275 CALL dbcsr_copy(vcd_env%moments_der_right(i, idir)%matrix, &
276 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
277 CALL dbcsr_copy(vcd_env%moments_der_left(i, idir)%matrix, &
278 vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
285 CALL dbcsr_copy(vcd_env%matrix_difdip2(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
286 CALL dbcsr_set(vcd_env%matrix_difdip2(i, j)%matrix, 0.0_dp)
288 CALL dbcsr_init_p(vcd_env%matrix_nosym_temp_33(i, j)%matrix)
289 CALL dbcsr_create(vcd_env%matrix_nosym_temp_33(i, j)%matrix, template=matrix_ks(1)%matrix, &
290 matrix_type=dbcsr_type_no_symmetry)
292 CALL dbcsr_set(vcd_env%matrix_nosym_temp_33(i, j)%matrix, 0._dp)
294 CALL dbcsr_init_p(vcd_env%matrix_nosym_temp2_33(i, j)%matrix)
295 CALL dbcsr_create(vcd_env%matrix_nosym_temp2_33(i, j)%matrix, template=matrix_ks(1)%matrix, &
296 matrix_type=dbcsr_type_no_symmetry)
298 CALL dbcsr_set(vcd_env%matrix_nosym_temp2_33(i, j)%matrix, 0._dp)
302 CALL dbcsr_copy(vcd_env%matrix_dSdV(i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
304 CALL dbcsr_copy(vcd_env%matrix_dSdB(i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
308 CALL dbcsr_init_p(vcd_env%matrix_hxc_dsdv(ispin)%matrix)
309 CALL dbcsr_copy(vcd_env%matrix_hxc_dsdv(ispin)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
316 CALL dbcsr_copy(vcd_env%dipvel_ao(i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
319 CALL dbcsr_copy(vcd_env%dipvel_ao_delta(i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
325 CALL dbcsr_create(vcd_env%hcom(i)%matrix, template=matrix_ks(1)%matrix, &
326 matrix_type=dbcsr_type_antisymmetric)
330 CALL dbcsr_create(vcd_env%matrix_rxrv(i)%matrix, template=matrix_ks(1)%matrix, &
331 matrix_type=dbcsr_type_antisymmetric)
336 CALL dbcsr_copy(vcd_env%matrix_rcomr(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
338 CALL dbcsr_copy(vcd_env%matrix_rrcom(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
340 CALL dbcsr_copy(vcd_env%matrix_dcom(i, j)%matrix, matrix_ks(1)%matrix)
341 CALL dbcsr_set(vcd_env%matrix_dcom(i, j)%matrix, 0._dp)
344 CALL dbcsr_copy(vcd_env%matrix_r_rxvr(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
345 CALL dbcsr_set(vcd_env%matrix_r_rxvr(i, j)%matrix, 0._dp)
348 CALL dbcsr_copy(vcd_env%matrix_rxvr_r(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
349 CALL dbcsr_set(vcd_env%matrix_rxvr_r(i, j)%matrix, 0._dp)
351 CALL dbcsr_init_p(vcd_env%matrix_r_doublecom(i, j)%matrix)
352 CALL dbcsr_copy(vcd_env%matrix_r_doublecom(i, j)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
353 CALL dbcsr_set(vcd_env%matrix_r_doublecom(i, j)%matrix, 0._dp)
361 CALL dbcsr_copy(vcd_env%matrix_hr(ispin, i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
364 CALL dbcsr_copy(vcd_env%matrix_rh(ispin, i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
371 CALL dbcsr_copy(vcd_env%matrix_drpnl(i)%matrix, vcd_env%dcdr_env%matrix_nosym_temp(1)%matrix)
376 my_matrix_hr_1d => vcd_env%matrix_hr(1, 1:3)
377 CALL build_rpnl_matrix(my_matrix_hr_1d, qs_kind_set, particle_set, sab_all, sap_ppnl, &
378 dft_control%qs_control%eps_ppnl, cell, [0._dp, 0._dp, 0._dp], &
380 CALL build_tr_matrix(my_matrix_hr_1d, qs_env, qs_kind_set,
"ORB", sab_all, &
381 direction_or=.true., rc=[0._dp, 0._dp, 0._dp])
382 CALL build_rcore_matrix(my_matrix_hr_1d, qs_env, qs_kind_set,
"ORB", sab_all, [0._dp, 0._dp, 0._dp])
385 my_matrix_hr_1d => vcd_env%matrix_rh(1, 1:3)
386 CALL build_rpnl_matrix(my_matrix_hr_1d, qs_kind_set, particle_set, sab_all, sap_ppnl, &
387 dft_control%qs_control%eps_ppnl, cell, [0._dp, 0._dp, 0._dp], &
388 direction_or=.false.)
389 CALL build_tr_matrix(my_matrix_hr_1d, qs_env, qs_kind_set,
"ORB", sab_all, &
390 direction_or=.false., rc=[0._dp, 0._dp, 0._dp])
391 CALL build_rcore_matrix(my_matrix_hr_1d, qs_env, qs_kind_set,
"ORB", sab_all, [0._dp, 0._dp, 0._dp])
396 CALL build_com_mom_nl(qs_kind_set, sab_orb, sap_ppnl, dft_control%qs_control%eps_ppnl, &
397 particle_set, cell=cell, matrix_rv=vcd_env%hcom)
399 CALL build_com_rpnl_r(vcd_env%matrix_rcomr, qs_kind_set, sab_all, sap_ppnl, &
400 dft_control%qs_control%eps_ppnl, particle_set, cell, .true.)
401 CALL build_com_rpnl_r(vcd_env%matrix_rrcom, qs_kind_set, sab_all, sap_ppnl, &
402 dft_control%qs_control%eps_ppnl, particle_set, cell, .false.)
410 nmoments_der=2, nmoments=0, ref_point=[0._dp, 0._dp, 0._dp])
413 CALL build_com_mom_nl(qs_kind_set, sab_orb, sap_ppnl, dft_control%qs_control%eps_ppnl, &
414 particle_set, matrix_rxrv=vcd_env%matrix_rxrv, ref_point=[0._dp, 0._dp, 0._dp], &
417 CALL build_com_mom_nl(qs_kind_set, sab_all, sap_ppnl, dft_control%qs_control%eps_ppnl, &
418 particle_set, ref_point=[0._dp, 0._dp, 0._dp], cell=cell, &
419 matrix_r_rxvr=vcd_env%matrix_r_rxvr)
421 CALL build_com_mom_nl(qs_kind_set, sab_all, sap_ppnl, dft_control%qs_control%eps_ppnl, &
422 particle_set, ref_point=[0._dp, 0._dp, 0._dp], cell=cell, &
423 matrix_rxvr_r=vcd_env%matrix_rxvr_r)
428 "PRINT%PROGRAM_RUN_INFO")
430 CALL timestop(handle)
445 CHARACTER(LEN=*),
PARAMETER :: routinen =
'vcd_env_cleanup'
449 CALL timeset(routinen, handle)
454 DEALLOCATE (vcd_env%apt_el_nvpt)
455 DEALLOCATE (vcd_env%apt_nuc_nvpt)
456 DEALLOCATE (vcd_env%apt_total_nvpt)
457 DEALLOCATE (vcd_env%aat_atom_nvpt)
458 DEALLOCATE (vcd_env%aat_atom_mfp)
495 CALL timestop(handle)
512 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: vec
513 INTEGER,
INTENT(IN) :: lambda, beta
514 CHARACTER(LEN=*) :: tag
516 CHARACTER(LEN=*),
PARAMETER :: routinen =
'vcd_read_restart'
518 CHARACTER(LEN=default_path_length) :: filename
519 CHARACTER(LEN=default_string_length) :: my_middle
520 INTEGER :: beta_tmp, handle, i, i_block, ia, ie, iostat, iounit, ispin, j, lambda_tmp, &
521 max_block, n_rep_val, nao, nao_tmp, nmo, nmo_tmp, nspins, nspins_tmp, rst_unit
523 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: vecbuffer
532 CALL timeset(routinen, handle)
534 NULLIFY (mos, para_env, logger, print_key, vecbuffer)
538 "PRINT%PROGRAM_RUN_INFO", extension=
".Log")
547 IF (para_env%is_source())
THEN
552 my_middle =
"RESTART-"//tag(ia:ie)//trim(
"-")//trim(adjustl(
cp_to_string(beta))) &
555 IF (n_rep_val > 0)
THEN
558 filename = filename(ia:ie)//trim(my_middle)//
".lr"
563 extension=
".lr", middle_name=trim(my_middle), my_local=.false.)
569 CALL open_file(file_name=trim(filename), &
570 file_action=
"READ", &
571 file_form=
"UNFORMATTED", &
572 file_position=
"REWIND", &
574 unit_number=rst_unit)
576 IF (iounit > 0)
WRITE (iounit,
"(T2,A)") &
577 "LINRES| Reading response wavefunctions from the restart file <"//trim(adjustl(filename))//
">"
579 IF (iounit > 0)
WRITE (iounit,
"(T2,A)") &
580 "LINRES| Restart file <"//trim(adjustl(filename))//
"> not found"
589 CALL cp_fm_get_info(mo_coeff, nrow_global=nao, ncol_block=max_block)
591 ALLOCATE (vecbuffer(nao, max_block))
594 IF (rst_unit > 0)
READ (rst_unit, iostat=iostat) lambda_tmp, beta_tmp, nspins_tmp, nao_tmp
595 CALL para_env%bcast(iostat)
597 CALL para_env%bcast(beta_tmp)
598 CALL para_env%bcast(lambda_tmp)
599 CALL para_env%bcast(nspins_tmp)
600 CALL para_env%bcast(nao_tmp)
604 IF (nspins_tmp /= nspins)
THEN
605 cpabort(
"nspins not consistent")
607 IF (nao_tmp /= nao) cpabort(
"nao not consistent")
610 IF (lambda_tmp /= lambda) cpabort(
"lambda not consistent")
611 IF (beta_tmp /= beta) cpabort(
"beta not consistent")
614 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff)
617 IF (rst_unit > 0)
READ (rst_unit) nmo_tmp
618 CALL para_env%bcast(nmo_tmp)
619 IF (nmo_tmp /= nmo) cpabort(
"nmo not consistent")
622 DO i = 1, nmo, max(max_block, 1)
623 i_block = min(max_block, nmo - i + 1)
625 IF (rst_unit > 0)
READ (rst_unit) vecbuffer(1:nao, j)
627 CALL para_env%bcast(vecbuffer)
632 IF (iostat /= 0)
THEN
633 IF (iounit > 0)
WRITE (iounit,
"(T2,A)") &
634 "LINRES| Restart file <"//trim(adjustl(filename))//
"> not found"
637 DEALLOCATE (vecbuffer)
641 IF (para_env%is_source())
THEN
645 CALL timestop(handle)
662 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: vec
663 INTEGER,
INTENT(IN) :: lambda, beta
664 CHARACTER(LEN=*) :: tag
666 CHARACTER(LEN=*),
PARAMETER :: routinen =
'vcd_write_restart'
668 CHARACTER(LEN=default_path_length) :: filename
669 CHARACTER(LEN=default_string_length) :: my_middle, my_pos, my_status
670 INTEGER :: handle, i, i_block, ia, ie, iounit, &
671 ispin, j, max_block, nao, nmo, nspins, &
673 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: vecbuffer
680 NULLIFY (logger, mo_coeff, mos, para_env, print_key, vecbuffer)
682 CALL timeset(routinen, handle)
687 used_print_key=print_key), &
691 "PRINT%PROGRAM_RUN_INFO", extension=
".Log")
699 my_status =
"REPLACE"
702 my_middle =
"RESTART-"//tag(ia:ie)//trim(
"-")//trim(adjustl(
cp_to_string(beta))) &
705 extension=
".lr", middle_name=trim(my_middle), file_status=trim(my_status), &
706 file_position=trim(my_pos), file_action=
"WRITE", file_form=
"UNFORMATTED")
709 extension=
".lr", middle_name=trim(my_middle), my_local=.false.)
712 WRITE (unit=iounit, fmt=
"(T2,A)") &
713 "LINRES| Writing response functions to the restart file <"//trim(adjustl(filename))//
">"
720 CALL cp_fm_get_info(mo_coeff, nrow_global=nao, ncol_block=max_block)
721 ALLOCATE (vecbuffer(nao, max_block))
723 IF (rst_unit > 0)
WRITE (rst_unit) lambda, beta, nspins, nao
728 IF (rst_unit > 0)
WRITE (rst_unit) nmo
730 DO i = 1, nmo, max(max_block, 1)
731 i_block = min(max_block, nmo - i + 1)
737 IF (rst_unit > 0)
WRITE (rst_unit) vecbuffer(1:nao, j)
742 DEALLOCATE (vecbuffer)
748 CALL timestop(handle)
762 CHARACTER(len=*),
PARAMETER :: routinen =
'vcd_print'
764 CHARACTER(LEN=default_string_length) :: description
765 INTEGER :: alpha, beta, delta,
gamma, handle, i, l, &
766 lambda, natom, nsubset, output_unit
767 REAL(dp) :: mean, standard_deviation, &
768 standard_deviation_sum
769 REAL(dp),
DIMENSION(:, :, :),
POINTER :: apt_el_dcdr, apt_el_nvpt, apt_nuc_dcdr, &
770 apt_nuc_nvpt, apt_total_dcdr, &
772 REAL(dp),
DIMENSION(:, :, :, :),
POINTER :: apt_center_dcdr, apt_subset_dcdr
773 REAL(kind=dp),
DIMENSION(3, 3) :: sum_rule_0, sum_rule_0_second, &
774 sum_rule_1, sum_rule_2, &
775 sum_rule_2_second, sum_rule_3_mfp, &
783 CALL timeset(routinen, handle)
792 NULLIFY (particle_set)
793 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set, molecule_set=molecule_set)
794 natom =
SIZE(particle_set)
795 nsubset =
SIZE(molecule_set)
797 apt_el_dcdr => vcd_env%dcdr_env%apt_el_dcdr
798 apt_nuc_dcdr => vcd_env%dcdr_env%apt_nuc_dcdr
799 apt_total_dcdr => vcd_env%dcdr_env%apt_total_dcdr
800 apt_subset_dcdr => vcd_env%dcdr_env%apt_el_dcdr_per_subset
801 apt_center_dcdr => vcd_env%dcdr_env%apt_el_dcdr_per_center
803 apt_el_nvpt => vcd_env%apt_el_nvpt
804 apt_nuc_nvpt => vcd_env%apt_nuc_nvpt
805 apt_total_nvpt => vcd_env%apt_total_nvpt
807 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A)") &
808 'APT | Write the final APT matrix per atom (Position perturbation)'
810 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,I3,A,F15.6)") &
811 'APT | Atom', l,
' - GAPT ', &
812 (apt_total_dcdr(1, 1, l) &
813 + apt_total_dcdr(2, 2, l) &
814 + apt_total_dcdr(3, 3, l))/3._dp
816 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,F15.6,F15.6,F15.6)")
"APT | ", apt_total_dcdr(i, :, l)
820 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A)") &
821 'NVP | Write the final APT matrix per atom (Velocity perturbation)'
823 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,I3,A,F15.6)") &
824 'NVP | Atom', l,
' - GAPT ', &
825 (apt_total_nvpt(1, 1, l) &
826 + apt_total_nvpt(2, 2, l) &
827 + apt_total_nvpt(3, 3, l))/3._dp
829 IF (vcd_env%output_unit > 0)
THEN
830 WRITE (vcd_env%output_unit,
"(A,F15.6,F15.6,F15.6)") &
831 "NVP | ", apt_total_nvpt(i, :, l)
836 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A)") &
837 'NVP | Write the final AAT matrix per atom (Velocity perturbation)'
839 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,I3)") &
842 IF (vcd_env%output_unit > 0)
THEN
843 WRITE (vcd_env%output_unit,
"(A,F15.6,F15.6,F15.6)") &
844 "NVP | ", vcd_env%aat_atom_nvpt(i, :, l)
849 IF (vcd_env%do_mfp)
THEN
850 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A)") &
851 'MFP | Write the final AAT matrix per atom (Magnetic Field perturbation)'
853 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,I3)") &
856 IF (vcd_env%output_unit > 0)
THEN
857 WRITE (vcd_env%output_unit,
"(A,F15.6,F15.6,F15.6)") &
858 "MFP | ", vcd_env%aat_atom_mfp(i, :, l)
866 description =
"[DIPOLE]"
867 CALL get_results(results=results, description=description, values=vcd_env%dcdr_env%dipole_pos(1:3))
873 sum_rule_0_second = 0._dp
874 sum_rule_2_second = 0._dp
875 sum_rule_3_second = 0._dp
876 sum_rule_3_mfp = 0._dp
877 standard_deviation = 0._dp
878 standard_deviation_sum = 0._dp
884 sum_rule_0(alpha, beta) = sum_rule_0(alpha, beta) &
885 + apt_total_dcdr(alpha, beta, lambda)
886 sum_rule_0_second(alpha, beta) = sum_rule_0_second(alpha, beta) &
887 + apt_total_nvpt(alpha, beta, lambda)
892 sum_rule_1(alpha, beta) = sum_rule_1(alpha, beta) &
893 + levi_civita(alpha, beta,
gamma)*vcd_env%dcdr_env%dipole_pos(
gamma)
900 sum_rule_2(alpha, beta) = sum_rule_2(alpha, beta) &
901 + levi_civita(beta,
gamma, delta) &
902 *particle_set(lambda)%r(
gamma) &
903 *apt_total_dcdr(delta, alpha, lambda)
904 sum_rule_2_second(alpha, beta) = sum_rule_2_second(alpha, beta) &
905 + levi_civita(beta,
gamma, delta) &
906 *particle_set(lambda)%r(
gamma) &
907 *apt_total_nvpt(delta, alpha, lambda)
914 sum_rule_3_second(alpha, beta) = sum_rule_3_second(alpha, beta) &
915 + vcd_env%aat_atom_nvpt(alpha, beta, lambda)
919 IF (vcd_env%do_mfp)
THEN
922 sum_rule_3_mfp(alpha, beta) = sum_rule_3_mfp(alpha, beta) &
923 + vcd_env%aat_atom_mfp(alpha, beta, lambda)
930 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A)")
"APT | Position perturbation sum rules"
931 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(A,T19,A,T35,A,T50,A,T65,A)") &
932 "APT |",
" Total APT",
"Dipole",
"R * APT",
"AAT"
933 standard_deviation_sum = 0._dp
936 mean = (sum_rule_1(alpha, beta) + sum_rule_2(alpha, beta) + sum_rule_3_mfp(alpha, beta))/3
937 standard_deviation = &
938 sqrt((sum_rule_1(alpha, beta)**2 + sum_rule_2(alpha, beta)**2 + sum_rule_3_mfp(alpha, beta)**2)/3 &
940 standard_deviation_sum = standard_deviation_sum + standard_deviation
942 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit, &
943 "(A,I3,I3,F15.6,F15.6,F15.6,F15.6,F15.6)") &
946 sum_rule_0(alpha, beta), &
947 sum_rule_1(alpha, beta), &
948 sum_rule_2(alpha, beta), &
949 sum_rule_3_mfp(alpha, beta), &
953 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(T73,F15.6)") standard_deviation_sum
955 IF (vcd_env%output_unit > 0)
THEN
956 WRITE (vcd_env%output_unit,
"(A)")
"NVP | Velocity perturbation sum rules"
957 WRITE (vcd_env%output_unit,
"(A,T19,A,T35,A,T50,A,T65,A)")
"NVP |",
" Total APT",
"Dipole",
"R * APT",
"AAT"
960 standard_deviation_sum = 0._dp
963 mean = (sum_rule_1(alpha, beta) + sum_rule_2_second(alpha, beta) + sum_rule_3_second(alpha, beta))/3
964 standard_deviation = &
965 sqrt((sum_rule_1(alpha, beta)**2 + sum_rule_2_second(alpha, beta)**2 + sum_rule_3_second(alpha, beta)**2)/3 &
967 standard_deviation_sum = standard_deviation_sum + standard_deviation
968 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit, &
969 "(A,I3,I3,F15.6,F15.6,F15.6,F15.6,F15.6)") &
973 sum_rule_0_second(alpha, beta), &
974 sum_rule_1(alpha, beta), &
975 sum_rule_2_second(alpha, beta), &
976 sum_rule_3_second(alpha, beta), &
980 IF (vcd_env%output_unit > 0)
WRITE (vcd_env%output_unit,
"(T73,F15.6)") standard_deviation_sum
982 CALL timestop(handle)
Handles all functions related to the CELL.
Calculation of the non-local pseudopotential contribution to the core Hamiltonian <a|V(non-local)|b> ...
subroutine, public build_com_mom_nl(qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, cell, matrix_rv, matrix_rxrv, matrix_rrv, matrix_rvr, matrix_rrv_vrr, matrix_r_rxvr, matrix_rxvr_r, matrix_r_doublecom, pseudoatom, ref_point)
Calculate [r,Vnl] (matrix_rv), r x [r,Vnl] (matrix_rxrv) or [rr,Vnl] (matrix_rrv) in AO basis....
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
set of type/routines to handle the storage of results in force_envs
set of type/routines to handle the storage of results in force_envs
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Interface to the message passing library MPI.
Define the data structure for the molecule information.
Calculates the moment integrals <a|r^m|b>
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
Define the data structure for the particle information.
Calculate the derivatives of the MO coefficients wrt nuclear coordinates.
subroutine, public dcdr_env_cleanup(qs_env, dcdr_env)
Deallocate the dcdr environment.
subroutine, public dcdr_env_init(dcdr_env, qs_env)
Initialize the dcdr environment.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Type definitiona for linear response calculations.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>
subroutine, public build_local_moments_der_matrix(qs_env, moments_der, nmoments_der, nmoments, ref_point, moments)
Calculate right-hand sided derivatives of multipole moments, e. g. < a | xy d/dz | b > Optionally sto...
Define the neighbor list data types and the corresponding functionality.
subroutine, public build_lin_mom_matrix(qs_env, matrix)
Calculation of the linear momentum matrix <mu|∂|nu> over Cartesian Gaussian functions.
subroutine, public build_rpnl_matrix(matrix_rv, qs_kind_set, particle_set, sab_all, sap_ppnl, eps_ppnl, cell, ref_point, direction_or)
Product of r with V_nl. Adapted from build_com_rpnl.
subroutine, public build_matrix_r_vhxc(matrix_rv, qs_env, rc)
Commutator of the Hartree+XC potentials with r.
subroutine, public build_rcore_matrix(matrix_rcore, qs_env, qs_kind_set, basis_type, sab_nl, rf)
Commutator of the of the local part of the pseudopotential with r.
subroutine, public build_com_rpnl_r(matrix_rv, qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, cell, direction_or)
Builds the [Vnl, r] * r from either side.
subroutine, public build_tr_matrix(matrix_tr, qs_env, qs_kind_set, basis_type, sab_nl, direction_or, rc)
Calculation of the product Tr or rT over Cartesian Gaussian functions.
subroutine, public vcd_print(vcd_env, qs_env)
Print the APTs, AATs, and sum rules.
subroutine, public vcd_env_cleanup(qs_env, vcd_env)
Deallocate the vcd environment.
subroutine, public vcd_write_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_write_restart.
subroutine, public vcd_env_init(vcd_env, qs_env)
Initialize the vcd environment.
subroutine, public vcd_read_restart(qs_env, linres_section, vec, lambda, beta, tag)
Copied from linres_read_restart.
Utilities for string manipulations.
elemental subroutine, public xstring(string, ia, ib)
...
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
contains arbitrary information which need to be stored
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...