77#include "./base/base_uses.f90"
82 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_chargemol'
83 LOGICAL,
PARAMETER :: debug_this_module = .false.
85 INTEGER,
PARAMETER :: chargemol_lmax = 5
100 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_wfx'
102 CHARACTER(LEN=12),
DIMENSION(:),
POINTER :: bcgf_symbol
103 CHARACTER(len=2) :: asym
104 CHARACTER(len=20),
ALLOCATABLE,
DIMENSION(:) :: atom_symbols
105 CHARACTER(LEN=6),
DIMENSION(:),
POINTER :: bsgf_symbol
106 CHARACTER(LEN=default_path_length) :: filename
107 CHARACTER(LEN=timestamp_length) :: timestamp
108 INTEGER :: handle, i, iatom, icgf, ico, ikind, iloop, imo, ipgf, irow, iset, isgf, ishell, &
109 ispin, iwfx, lshell, max_l, ncgf, ncol_global, nelec_alpha, nelec_beta, nkpoint, noccup, &
110 nrow_global, nset, nsgf, nspins, num_atoms, output_unit, roks_high, roks_low, tot_npgf
111 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, atomic_numbers, kind_of
112 INTEGER,
DIMENSION(:),
POINTER :: lmax, npgf, nshell
113 INTEGER,
DIMENSION(:, :),
POINTER :: l
114 LOGICAL :: do_kpoints, newl, periodic, unrestricted
115 REAL(kind=
dp) :: zeta
116 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: atoms_cart, cmatrix, smatrix, &
118 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: wfx_coeff
119 REAL(kind=
dp),
DIMENSION(:),
POINTER :: core_charges
120 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: zet
121 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: gcc
133 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
141 CALL timeset(routinen, handle)
146 IF (output_unit > 0)
THEN
147 WRITE (output_unit,
'(/,T2,A)') &
148 '!-----------------------------------------------------------------------------!'
149 WRITE (output_unit,
'(T32,A)')
"Writing Chargemol wfx file..."
150 WRITE (output_unit,
'(T2,A)') &
151 '!-----------------------------------------------------------------------------!'
155 cpassert(
ASSOCIATED(qs_env))
156 CALL get_qs_env(qs_env, cell=cell, mos=mos, particle_set=particle_set, &
157 qs_kind_set=qs_kind_set, scf_env=scf_env, scf_control=scf_control, &
158 dft_control=dft_control, energy=energy, force=force, subsys=subsys, &
159 atomic_kind_set=atomic_kind_set, do_kpoints=do_kpoints, &
160 kpoints=kpoint_env, matrix_s=matrix_s)
162 nkpoint = kpoint_env%nkp
164 IF (dft_control%roks)
THEN
165 CALL cp_abort(__location__,
"The output of chargemol .wfx files is currently "// &
166 "implemented only for (un)restricted HF and Kohn-Sham-like methods.")
169 CALL prepare_wfx_orbitals(qs_env, wfx_coeff, wfx_eigenvalues)
171 IF (dft_control%lsd)
THEN
172 unrestricted = .true.
174 unrestricted = .false.
186 extension=
".wfx", my_local=.false.)
189 IF (logger%para_env%is_source())
THEN
190 CALL open_file(filename, file_status=
"REPLACE", &
191 file_action=
"WRITE", unit_number=iwfx)
199 IF (nspins == 1)
THEN
200 nelec_alpha = mos(1)%nelectron/2
201 nelec_beta = nelec_alpha
203 nelec_alpha = mos(1)%nelectron
204 nelec_beta = mos(2)%nelectron
207 IF (dft_control%roks)
THEN
208 IF (mos(1)%homo > mos(2)%homo)
THEN
220 num_atoms =
SIZE(particle_set)
221 ALLOCATE (atoms_cart(3, num_atoms))
222 ALLOCATE (atom_symbols(num_atoms))
223 ALLOCATE (atomic_numbers(num_atoms))
224 ALLOCATE (core_charges(num_atoms))
227 DO iatom = 1, num_atoms
228 NULLIFY (orb_basis_set)
229 atoms_cart(1:3, iatom) = particle_set(iatom)%r(1:3)
231 element_symbol=asym, kind_number=ikind)
232 atom_symbols(iatom) = asym
234 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set, &
235 core_charge=core_charges(iatom))
236 IF (
ASSOCIATED(orb_basis_set))
THEN
238 nset=nset, lmax=lmax)
241 max_l = max(max_l, lmax(iset))
244 cpabort(
"Unknown basis set type. ")
246 IF (max_l > chargemol_lmax)
THEN
247 CALL cp_abort(__location__,
"Chargemol supports basis sets with l"// &
248 " up to 5 only (h angular functions).")
255 WRITE (iwfx,
"(A)")
"# Chargemol input file generated by CP2K "
257 WRITE (iwfx,
"(A,/)")
"# Creation date "//timestamp(:19)
259 WRITE (iwfx,
"(A)")
"<Title>"
260 WRITE (iwfx, *) trim(logger%iter_info%project_name)
261 WRITE (iwfx,
"(A,/)")
"</Title>"
267 WRITE (iwfx,
"(A)")
"<Keywords>"
268 WRITE (iwfx,
"(A)")
"GTO"
269 WRITE (iwfx,
"(A,/)")
"</Keywords>"
274 WRITE (iwfx,
"(A)")
"#<Model>"
275 IF (unrestricted)
THEN
276 WRITE (iwfx,
"(A)")
"#Unrestricted Kohn-Sham"
278 WRITE (iwfx,
"(A)")
"#Restricted Kohn-Sham"
280 WRITE (iwfx,
"(A,/)")
"#</Model>"
285 WRITE (iwfx,
"(A)")
"<Number of Nuclei>"
286 WRITE (iwfx,
"(I6)") num_atoms
287 WRITE (iwfx,
"(A,/)")
"</Number of Nuclei>"
292 WRITE (iwfx,
"(A)")
"<Number of Occupied Molecular Orbitals>"
294 IF (dft_control%roks .AND. nspins == 2)
THEN
295 noccup = max(mos(1)%homo, mos(2)%homo)
297 DO ispin = 1, dft_control%nspins
298 noccup = noccup + mos(ispin)%homo
301 WRITE (iwfx,
"(2I6)") noccup
302 WRITE (iwfx,
"(A,/)")
"</Number of Occupied Molecular Orbitals>"
307 WRITE (iwfx,
"(A)")
"<Number of Perturbations>"
308 WRITE (iwfx,
"(I6)") 0
309 WRITE (iwfx,
"(A,/)")
"</Number of Perturbations>"
314 WRITE (iwfx,
"(A)")
"<Net Charge>"
315 WRITE (iwfx,
"(F8.4)") real(dft_control%charge, kind=
dp)
316 WRITE (iwfx,
"(A,/)")
"</Net Charge>"
321 WRITE (iwfx,
"(A)")
"<Number of Electrons>"
322 WRITE (iwfx,
"(I6)") scf_env%nelectron
323 WRITE (iwfx,
"(A,/)")
"</Number of Electrons>"
328 WRITE (iwfx,
"(A)")
"<Number of Alpha Electrons>"
329 WRITE (iwfx,
"(I6)") nelec_alpha
330 WRITE (iwfx,
"(A,/)")
"</Number of Alpha Electrons>"
335 WRITE (iwfx,
"(A)")
"<Number of Beta Electrons>"
336 WRITE (iwfx,
"(I6)") nelec_beta
337 WRITE (iwfx,
"(A,/)")
"</Number of Beta Electrons>"
342 WRITE (iwfx,
"(A)")
"<Electron Spin Multiplicity>"
343 WRITE (iwfx,
"(I4)") dft_control%multiplicity
344 WRITE (iwfx,
"(A,/)")
"</Electron Spin Multiplicity>"
349 WRITE (iwfx,
"(A)")
"<Number of Core Electrons>"
350 WRITE (iwfx,
"(F16.10)") sum(atomic_numbers) - sum(core_charges)
351 WRITE (iwfx,
"(A,/)")
"</Number of Core Electrons>"
356 WRITE (iwfx,
"(A)")
"<Nuclear Names>"
357 DO iatom = 1, num_atoms
358 WRITE (iwfx,
"(A4)") atom_symbols(iatom)
360 WRITE (iwfx,
"(A,/)")
"</Nuclear Names>"
365 WRITE (iwfx,
"(A)")
"<Atomic Numbers>"
366 DO iatom = 1, num_atoms
367 WRITE (iwfx,
"(I4)") atomic_numbers(iatom)
369 WRITE (iwfx,
"(A,/)")
"</Atomic Numbers>"
374 WRITE (iwfx,
"(A)")
"<Nuclear Charges>"
375 DO iatom = 1, num_atoms
376 WRITE (iwfx,
"(F12.8)") core_charges(iatom)
378 WRITE (iwfx,
"(A,/)")
"</Nuclear Charges>"
383 WRITE (iwfx,
"(A)")
"<Nuclear Cartesian Coordinates>"
384 DO iatom = 1, num_atoms
385 WRITE (iwfx,
"(3ES26.16E3)") atoms_cart(1:3, iatom)
387 WRITE (iwfx,
"(A,/)")
"</Nuclear Cartesian Coordinates>"
394 IF (sum(cell%perd) == 0)
THEN
395 CALL cp_warn(__location__,
"Writing of periodic cell information"// &
396 " requested in input, but system is not periodic, ignoring request.")
398 WRITE (iwfx,
"(A)")
"<Number of Translation Vectors>"
399 WRITE (iwfx,
"(I3)") sum(cell%perd)
400 WRITE (iwfx,
"(A,/)")
"</Number of Translation Vectors>"
402 WRITE (iwfx,
"(A)")
"<Translation Vectors>"
404 IF (cell%perd(iatom) == 1)
THEN
405 WRITE (iwfx,
"(3F12.6)") cell%hmat(1:3, iatom)
408 WRITE (iwfx,
"(A,/)")
"</Translation Vectors>"
410 WRITE (iwfx,
"(A)")
"<Number of Kpoints>"
411 WRITE (iwfx,
"(I3)") 1
412 WRITE (iwfx,
"(A,/)")
"</Number of Kpoints>"
413 WRITE (iwfx,
"(A)")
"<Kpoint Weights>"
414 WRITE (iwfx,
"(I3)") 1
415 WRITE (iwfx,
"(A,/)")
"</Kpoint Weights>"
416 WRITE (iwfx,
"(A)")
"<Kpoint Fractional Coordinates>"
417 WRITE (iwfx,
"(F8.6)") 0.0
418 WRITE (iwfx,
"(A,/)")
"</Kpoint Fractional Coordinates>"
424 WRITE (iwfx,
"(A)")
"<Primitive Centers>"
426 DO iatom = 1, num_atoms
428 NULLIFY (orb_basis_set)
429 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
430 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
431 IF (
ASSOCIATED(orb_basis_set))
THEN
440 DO ishell = 1, nshell(iset)
441 lshell = l(ishell, iset)
442 DO ico = 1,
nco(lshell)
443 DO ipgf = 1, npgf(iset)
444 tot_npgf = tot_npgf + 1
445 IF (mod(iloop + 10, 10) /= 0)
THEN
446 WRITE (iwfx,
"(I4)", advance=
"no") iatom
449 WRITE (iwfx,
"(I4)") iatom
462 cpabort(
"Unknown basis set type. ")
465 WRITE (iwfx,
"(A,/)")
"</Primitive Centers>"
470 WRITE (iwfx,
"(A)")
"<Number of Primitives>"
471 WRITE (iwfx,
"(I8)") tot_npgf
472 WRITE (iwfx,
"(A,/)")
"</Number of Primitives>"
477 WRITE (iwfx,
"(A)")
"<Primitive Types>"
478 DO iatom = 1, num_atoms
480 NULLIFY (orb_basis_set)
481 NULLIFY (bcgf_symbol)
484 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
485 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
486 IF (
ASSOCIATED(orb_basis_set))
THEN
500 DO ishell = 1, nshell(iset)
501 lshell = l(ishell, iset)
502 DO ico = 1,
nco(lshell)
503 DO ipgf = 1, orb_basis_set%npgf(iset)
504 IF (mod(iloop + 10, 10) /= 0)
THEN
505 WRITE (iwfx,
'(I6)', advance=
"no") &
506 pgf_type_chargemol(bcgf_symbol(icgf) (3:))
509 WRITE (iwfx,
'(I6)') &
510 pgf_type_chargemol(bcgf_symbol(icgf) (3:))
522 cpabort(
"Unknown basis set type.")
528 WRITE (iwfx,
"(A,/)")
"</Primitive Types>"
537 WRITE (iwfx,
"(A)")
"<Primitive Exponents>"
538 DO iatom = 1, num_atoms
539 NULLIFY (orb_basis_set)
544 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
545 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
546 IF (
ASSOCIATED(orb_basis_set))
THEN
556 DO ishell = 1, nshell(iset)
557 lshell = l(ishell, iset)
558 DO ico = 1,
nco(lshell)
559 DO ipgf = 1, npgf(iset)
560 IF (mod(iloop + 5, 5) /= 0)
THEN
561 WRITE (iwfx,
"(ES20.10)", advance=
"no") zet(ipgf, iset)
564 WRITE (iwfx,
"(ES20.10)") zet(ipgf, iset)
577 cpabort(
"Unknown basis set type. ")
580 WRITE (iwfx,
"(A,/)")
"</Primitive Exponents>"
586 WRITE (iwfx,
"(A)")
"<Molecular Orbital Occupation Numbers>"
587 IF (.NOT. dft_control%roks)
THEN
589 DO imo = 1, mos(ispin)%homo
590 WRITE (iwfx,
"(f8.6)") &
591 mos(ispin)%occupation_numbers(imo)
595 DO imo = 1, mos(roks_low)%homo
596 WRITE (iwfx,
"(*(f8.6,1x))") &
597 mos(roks_low)%occupation_numbers(imo) &
598 + mos(roks_low)%occupation_numbers(imo)
600 DO imo = mos(roks_low)%homo + 1, mos(roks_high)%homo
601 WRITE (iwfx,
"(f8.6)") &
602 mos(roks_high)%occupation_numbers(imo)
605 WRITE (iwfx,
"(A,/)")
"</Molecular Orbital Occupation Numbers>"
610 WRITE (iwfx,
"(A)")
"<Molecular Orbital Energies>"
612 DO imo = 1, mos(ispin)%homo
613 WRITE (iwfx,
"(ES20.10)") wfx_eigenvalues(imo, ispin)
616 WRITE (iwfx,
"(A,/)")
"</Molecular Orbital Energies>"
622 WRITE (iwfx,
"(A)")
"<Molecular Orbital Spin Types>"
623 DO imo = 1, mos(1)%homo
624 IF (nspins == 1)
THEN
625 WRITE (iwfx,
'(A15)')
"Alpha and Beta"
626 ELSE IF (dft_control%uks)
THEN
627 WRITE (iwfx,
'(A6)')
"Alpha"
629 CALL cp_abort(__location__,
"This wavefunction type is currently"// &
630 " not supported by the chargemol interface.")
633 IF (nspins == 2)
THEN
634 DO imo = 1, mos(2)%homo
635 WRITE (iwfx,
'(A5)')
"Beta"
638 WRITE (iwfx,
"(A,/)")
"</Molecular Orbital Spin Types>"
644 WRITE (iwfx,
"(A)")
"<Kpoint Index for Orbitals>"
646 DO imo = 1, mos(ispin)%homo
647 WRITE (iwfx,
"(I6)") 1
650 WRITE (iwfx,
"(A,/)")
"</Kpoint Index for Orbitals>"
656 WRITE (iwfx,
"(A)")
"<Molecular Orbital Primitive Coefficients>"
657 NULLIFY (orb_basis_set)
661 nrow_global =
SIZE(wfx_coeff, 1)
662 ncol_global = mos(ispin)%nmo
663 IF (ncol_global == 0) cycle
665 ALLOCATE (smatrix(nrow_global, ncol_global))
668 smatrix(:, :) = wfx_coeff(:, 1:ncol_global, ispin)
672 ALLOCATE (cmatrix(ncgf, ncol_global))
679 DO iatom = 1, num_atoms
680 NULLIFY (orb_basis_set)
681 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
683 basis_set=orb_basis_set)
684 IF (
ASSOCIATED(orb_basis_set))
THEN
690 DO ishell = 1, nshell(iset)
691 lshell = l(ishell, iset)
692 CALL dgemm(
"T",
"N",
nco(lshell), mos(ispin)%nmo, &
693 nso(lshell), 1.0_dp, &
695 smatrix(isgf, 1), nsgf, 0.0_dp, &
696 cmatrix(icgf, 1), ncgf)
708 icgf = icgf +
nco(lshell)
709 isgf = isgf +
nso(lshell)
713 cpabort(
"Unknown basis set type. ")
718 DO imo = 1, mos(ispin)%homo
720 WRITE (iwfx,
"(A)")
"<MO Number>"
721 IF (nspins == 1 .OR. ispin == 1)
THEN
722 WRITE (iwfx,
"(I6)") imo
724 WRITE (iwfx,
"(I6)") imo + mos(1)%homo
726 WRITE (iwfx,
"(A)")
"</MO Number>"
730 DO iatom = 1, num_atoms
732 NULLIFY (orb_basis_set)
736 basis_set=orb_basis_set)
737 IF (
ASSOCIATED(orb_basis_set))
THEN
746 DO ishell = 1, nshell(iset)
747 lshell = orb_basis_set%l(ishell, iset)
749 DO ico = orb_basis_set%first_cgf(ishell, iset), &
750 orb_basis_set%last_cgf(ishell, iset)
753 DO ipgf = 1, orb_basis_set%npgf(iset)
755 zeta = orb_basis_set%zet(ipgf, iset)
757 IF (mod(iloop + 5, 5) /= 0)
THEN
758 WRITE (iwfx,
'(ES20.10)', advance=
"no") &
759 cmatrix(irow, imo)* &
760 orb_basis_set%norm_cgf(ico)* &
761 orb_basis_set%gcc(ipgf, ishell, iset)
764 WRITE (iwfx,
'(ES20.10)') &
765 cmatrix(irow, imo)* &
766 orb_basis_set%norm_cgf(ico)* &
767 orb_basis_set%gcc(ipgf, ishell, iset)
778 cpabort(
"Unknown basis set type.")
787 IF (
ALLOCATED(cmatrix))
DEALLOCATE (cmatrix)
788 IF (
ALLOCATED(smatrix))
DEALLOCATE (smatrix)
791 WRITE (iwfx,
"(A,/)")
"</Molecular Orbital Primitive Coefficients>"
796 WRITE (iwfx,
"(A)")
"<Energy>"
797 WRITE (iwfx,
"(ES26.16E3)") energy%total
798 WRITE (iwfx,
"(A,/)")
"</Energy>"
803 WRITE (iwfx,
"(A)")
"<Virial Ratio (-V/T)>"
804 WRITE (iwfx,
"(ES20.12)") - 1*(energy%total - energy%kinetic)/energy%kinetic
805 WRITE (iwfx,
"(A,/)")
"</Virial Ratio (-V/T)>"
811 IF (
ASSOCIATED(force) .AND. debug_this_module)
THEN
812 WRITE (iwfx,
"(A)")
"<Nuclear Cartesian Energy Gradients>"
814 CALL get_qs_env(qs_env, force=force, atomic_kind_set=atomic_kind_set)
815 ALLOCATE (atom_of_kind(num_atoms))
816 ALLOCATE (kind_of(num_atoms))
818 atom_of_kind=atom_of_kind, &
821 DO iatom = 1, num_atoms
822 ikind = kind_of(iatom)
823 i = atom_of_kind(iatom)
824 WRITE (iwfx,
"(3ES20.12E3)") force(ikind)%total(1:3, i)
827 WRITE (iwfx,
"(A,/)")
"<Nuclear Cartesian Energy Gradients>"
830 WRITE (iwfx,
"(A)")
"<Nuclear Virial of Energy-Gradient-Based Forces on Nuclei, W>"
831 WRITE (iwfx,
"(A)")
""
832 WRITE (iwfx,
"(A,/)")
"<Nuclear Virial of Energy-Gradient-Based Forces on Nuclei, W>"
835 WRITE (iwfx,
"(A)")
"<Full Virial Ratio, -(V - W)/T)>"
836 WRITE (iwfx,
"(A)")
""
837 WRITE (iwfx,
"(A,/)")
"</Full Virial Ratio, -(V - W)/T)>"
839 DEALLOCATE (atom_of_kind)
854 DEALLOCATE (atoms_cart)
855 DEALLOCATE (atom_symbols)
856 DEALLOCATE (atomic_numbers)
857 DEALLOCATE (core_charges)
864 IF (output_unit > 0)
THEN
865 WRITE (output_unit,
'(/,T2,A)') &
866 '!--------------------------- Chargemol wfx written ---------------------------!'
869 DEALLOCATE (wfx_coeff, wfx_eigenvalues)
871 CALL timestop(handle)
881 SUBROUTINE prepare_wfx_orbitals(qs_env, coefficients, eigenvalues)
883 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
884 INTENT(OUT) :: coefficients
885 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
886 INTENT(OUT) :: eigenvalues
888 INTEGER :: homo, ispin, nao, nmo
891 TYPE(
cp_fm_type) :: export_coeff, occupied_coeff
898 CALL get_qs_env(qs_env, mos=mos, matrix_ks=matrix_ks, admm_env=admm_env, &
899 dft_control=dft_control, scf_control=scf_control)
901 ALLOCATE (coefficients(nao, maxval(mos%nmo),
SIZE(mos)), &
902 eigenvalues(maxval(mos%nmo),
SIZE(mos)))
903 coefficients = 0.0_dp
905 DO ispin = 1,
SIZE(mos)
907 homo = mos(ispin)%homo
908 CALL cp_fm_create(export_coeff, mos(ispin)%mo_coeff%matrix_struct,
"WFX orbitals")
909 IF (mos(ispin)%use_mo_coeff_b)
THEN
912 CALL cp_fm_to_fm(mos(ispin)%mo_coeff, export_coeff)
914 eigenvalues(1:nmo, ispin) = mos(ispin)%eigenvalues(1:nmo)
915 IF (scf_control%use_ot .AND. homo > 0)
THEN
918 IF (maxval(abs(mos(ispin)%occupation_numbers(1:homo) - &
919 mos(ispin)%occupation_numbers(1))) > 1.0e-12_dp)
THEN
920 cpabort(
"OT WFX output requires uniformly occupied orbitals.")
922 NULLIFY (occupied_struct, ks_copy)
925 CALL cp_fm_create(occupied_coeff, occupied_struct,
"WFX occupied orbitals")
927 CALL cp_fm_to_fm(export_coeff, occupied_coeff, homo)
929 CALL dbcsr_copy(ks_copy, matrix_ks(ispin)%matrix, name=
"WFX Kohn-Sham matrix")
930 IF (dft_control%do_admm)
CALL correct_wfx_ks(ispin, admm_env, ks_copy)
932 CALL cp_fm_to_fm(occupied_coeff, export_coeff, homo)
940 END SUBROUTINE prepare_wfx_orbitals
948 SUBROUTINE correct_wfx_ks(ispin, admm_env, ks_copy)
949 INTEGER,
INTENT(IN) :: ispin
957 IF (admm_env%block_dm)
RETURN
958 SELECT CASE (admm_env%purification_method)
962 NULLIFY (admm_copy%H_corr)
963 ALLOCATE (admm_copy%H_corr(
SIZE(admm_env%H_corr)))
964 CALL cp_fm_create(admm_copy%H_corr(ispin), admm_env%H_corr(ispin)%matrix_struct,
"WFX ADMM correction")
965 CALL cp_fm_create(work_aux_orb, admm_env%work_aux_orb%matrix_struct,
"WFX ADMM work")
966 admm_copy%work_aux_orb => work_aux_orb
967 export_admm => admm_copy
971 DEALLOCATE (admm_copy%H_corr)
973 END SUBROUTINE correct_wfx_ks
980 INTEGER FUNCTION pgf_type_chargemol(l_symb)
RESULT(label)
982 CHARACTER(len=*),
INTENT(IN) :: l_symb
1098 cpabort(
"The chargemol interface supports basis functions up to l=5 only")
1102 END FUNCTION pgf_type_chargemol
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Types and set/get functions for auxiliary density matrix methods.
Contains methods used in the context of density fitting.
subroutine, public admm_correct_for_eigenvalues(ispin, admm_env, ks_matrix)
...
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum, ccon)
...
Handles all functions related to the CELL.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_init_p(matrix)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
Utility routines to open and close files.
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
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_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...
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...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Types and basic routines needed for a kpoint calculation.
Machine interface based on Fortran 2003 and POSIX.
integer, parameter, public timestamp_length
subroutine, public m_timestamp(timestamp)
Returns a human readable timestamp.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public nso
character(len=12) function, public cgf_symbol(n, lxyz)
Build a Cartesian orbital symbol (orbital labels for printing).
character(len=6) function, public sgf_symbol(n, l, m)
Build a spherical orbital symbol (orbital labels for printing).
Define the data structure for the particle information.
Periodic Table related data definitions.
subroutine, public get_ptable_info(symbol, number, amass, ielement, covalent_radius, metallic_radius, vdw_radius, found)
Pass information about the kind given the element symbol.
Write wfx file, works as interface to chargemol and multiwfn.
subroutine, public write_wfx(qs_env, dft_section)
...
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, matrix_vhxc, 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.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
collects routines that perform operations directly related to MOs
Definition and initialisation of the mo data type.
module that contains the definitions of the scf types
types that represent a quickstep subsys
parameters that control an scf iteration
stores some data used in wavefunction fitting
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information about kpoints.
Provides all information about a quickstep kind.