25 h5aread_double_scalar, h5awrite_boolean, h5awrite_double_scalar, h5awrite_double_simple, &
26 h5awrite_fixlen_string, h5awrite_integer_scalar, h5awrite_integer_simple, &
27 h5awrite_string_simple, h5close, h5dread_double_simple, h5dwrite_double_simple, h5fclose, &
28 h5fcreate, h5fopen, h5gclose, h5gcreate, h5gopen, h5open, hdf5_id
51#include "./base/base_uses.f90"
57 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qcschema'
67 TYPE qcschema_provenance
68 CHARACTER(LEN=default_string_length) :: creator =
""
69 CHARACTER(LEN=default_string_length) :: version =
""
70 CHARACTER(LEN=default_string_length) :: routine =
""
71 END TYPE qcschema_provenance
78 TYPE qcschema_topology
79 CHARACTER(LEN=default_string_length) :: name =
""
80 CHARACTER(LEN=2),
DIMENSION(:),
ALLOCATABLE :: symbols
81 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: geometry
82 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: masses
83 INTEGER,
DIMENSION(:),
ALLOCATABLE :: atomic_numbers
84 INTEGER :: molecular_charge = 0
85 INTEGER :: molecular_multiplicity = 1
86 CHARACTER(LEN=default_string_length) :: schema_name =
""
87 INTEGER :: schema_version = 0
88 TYPE(qcschema_provenance) :: provenance = qcschema_provenance()
89 END TYPE qcschema_topology
96 TYPE qcschema_electron_shell
98 INTEGER,
DIMENSION(:),
POINTER :: angular_momentum => null()
100 CHARACTER(LEN=9) :: harmonic_type =
""
102 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: exponents => null()
104 REAL(KIND=
dp),
DIMENSION(:, :),
POINTER :: coefficients => null()
105 END TYPE qcschema_electron_shell
114 CHARACTER(LEN=default_string_length) :: ecp_type =
""
116 INTEGER,
DIMENSION(:),
POINTER :: angular_momentum => null()
118 INTEGER,
DIMENSION(:),
POINTER :: r_exponents => null()
120 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: gaussian_exponents => null()
122 REAL(KIND=
dp),
DIMENSION(:, :),
POINTER :: coefficients => null()
123 END TYPE qcschema_ecp
130 TYPE qcschema_center_basis
132 TYPE(qcschema_electron_shell),
DIMENSION(:),
POINTER :: electron_shells => null()
134 TYPE(qcschema_ecp),
DIMENSION(:),
POINTER :: ecp_potentials => null()
136 INTEGER :: ecp_electrons = 0
137 END TYPE qcschema_center_basis
144 TYPE qcschema_basis_set
146 CHARACTER(LEN=default_string_length) :: name =
""
148 TYPE(qcschema_center_basis),
DIMENSION(:),
POINTER :: center_data => null()
154 CHARACTER(LEN=2),
DIMENSION(:),
POINTER :: atom_map => null()
156 INTEGER :: schema_version = -1
158 CHARACTER(LEN=default_string_length) :: schema_name =
""
160 CHARACTER(LEN=default_string_length) :: description =
""
161 END TYPE qcschema_basis_set
169 TYPE qcschema_wavefunction
172 CHARACTER(LEN=default_string_length) :: method =
""
175 TYPE(qcschema_basis_set) :: basis_set = qcschema_basis_set()
178 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_orbitals_a
179 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_orbitals_b
180 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eigenvalues_a
181 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eigenvalues_b
182 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_occupations_a
183 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_occupations_b
184 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_density_mo_a
185 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_density_mo_b
186 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_fock_mo_a
187 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_fock_mo_b
190 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eri
191 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eri_mo_aa
192 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eri_mo_ab
193 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: scf_eri_mo_bb
197 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: localized_orbitals_a
198 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: localized_orbitals_b
199 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: localized_fock_a
200 REAL(KIND=
dp),
DIMENSION(:),
ALLOCATABLE :: localized_fock_b
203 LOGICAL :: restricted = .false.
205 END TYPE qcschema_wavefunction
212 TYPE qcschema_properties
214 REAL(KIND=
dp) :: return_energy = 0.0_dp
216 INTEGER :: calcinfo_nbasis = 0
217 INTEGER :: calcinfo_nmo = 0
218 INTEGER :: calcinfo_nalpha = 0
219 INTEGER :: calcinfo_nbeta = 0
220 INTEGER :: calcinfo_natom = 0
223 INTEGER :: scf_iterations = 0
224 REAL(KIND=
dp) :: scf_one_electron_energy = 0.0_dp
225 REAL(KIND=
dp) :: scf_two_electron_energy = 0.0_dp
226 REAL(KIND=
dp) :: nuclear_repulsion_energy = 0.0_dp
227 REAL(KIND=
dp) :: scf_vv10_energy = 0.0_dp
228 REAL(KIND=
dp) :: scf_xc_energy = 0.0_dp
229 REAL(KIND=
dp) :: scf_dispersion_correction_energy = 0.0_dp
230 REAL(KIND=
dp) :: scf_total_energy = 0.0_dp
232 REAL(KIND=
dp),
DIMENSION(3) :: scf_dipole_moment = 0.0_dp
235 REAL(KIND=
dp) :: mp2_same_spin_correlation_energy = 0.0_dp
236 REAL(KIND=
dp) :: mp2_opposite_spin_correlation_energy = 0.0_dp
237 REAL(KIND=
dp) :: mp2_singles_energy = 0.0_dp
238 REAL(KIND=
dp) :: mp2_doubles_energy = 0.0_dp
240 REAL(KIND=
dp) :: mp2_correlation_energy = 0.0_dp
241 REAL(KIND=
dp) :: mp2_total_energy = 0.0_dp
244 LOGICAL :: mp2 = .false.
246 END TYPE qcschema_properties
254 TYPE(qcschema_topology) ::
topology = qcschema_topology()
255 TYPE(qcschema_provenance) :: provenance = qcschema_provenance()
256 TYPE(qcschema_properties) :: properties = qcschema_properties()
257 TYPE(qcschema_wavefunction) :: wavefunction = qcschema_wavefunction()
258 TYPE(qcschema_basis_set) :: basis = qcschema_basis_set()
259 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: return_result
260 CHARACTER(LEN=default_string_length) :: driver =
""
261 LOGICAL :: success = .false.
275 CHARACTER(LEN=*),
PARAMETER :: routinen =
'qcschema_env_create'
277 CHARACTER(LEN=2) :: atomic_symbol
278 CHARACTER(LEN=default_string_length) :: basis_set_name, method
279 INTEGER :: atomic_number, handle, i, i_glb, iatom, &
280 ikind, nalpha, nao, natoms, nbeta, &
281 nel, nmo, nspins, output_unit
283 REAL(kind=
dp) :: dispersion, mass, one_el_en, two_el_en
297 CALL timeset(routinen, handle)
306 IF (
ASSOCIATED(qs_env))
THEN
307 CALL get_qs_env(qs_env, ks_env=ks_env, energy=energy, &
308 dft_control=dft_control, force=force, &
309 particle_set=particle_set, &
310 scf_env=scf_env, mp2_env=mp2_env, &
311 input=input, qs_kind_set=kind_set, &
312 active_space=active_space_env)
314 cpabort(
"QS environment not associated, QCSchema interface quitting")
318 IF (.NOT.
ASSOCIATED(active_space_env))
THEN
319 cpabort(
"Active space environment not associated, QCSchema interface quitting")
326 qcschema_env%provenance%creator =
'CP2K'
328 qcschema_env%provenance%routine = routinen
334 qcschema_env%topology%schema_name =
'qcschema'
335 qcschema_env%topology%schema_version = 3
337 natoms =
SIZE(particle_set)
339 ALLOCATE (qcschema_env%topology%geometry(3*natoms))
340 ALLOCATE (qcschema_env%topology%symbols(natoms))
341 ALLOCATE (qcschema_env%topology%atomic_numbers(natoms))
342 ALLOCATE (qcschema_env%topology%masses(natoms))
346 qcschema_env%topology%geometry((iatom - 1)*3 + 1:(iatom)*3) = particle_set(iatom)%r(1:3)
349 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, element_symbol=atomic_symbol)
350 qcschema_env%topology%symbols(iatom) = atomic_symbol
354 qcschema_env%topology%atomic_numbers(iatom) = atomic_number
355 qcschema_env%topology%masses(iatom) = mass
358 qcschema_env%topology%molecular_charge = dft_control%charge
359 qcschema_env%topology%molecular_multiplicity = dft_control%multiplicity
365 nspins = active_space_env%nspins
367 nao = active_space_env%mos_active(1)%nao
368 nmo = active_space_env%nmo_active
369 nel = active_space_env%nelec_active
371 IF (nspins == 1)
THEN
372 nalpha = active_space_env%nelec_active/2
375 nalpha = (active_space_env%nelec_active + active_space_env%multiplicity - 1)/2
376 nbeta = (active_space_env%nelec_active - active_space_env%multiplicity + 1)/2
379 qcschema_env%properties%calcinfo_natom = natoms
380 qcschema_env%properties%calcinfo_nbasis = nao
381 qcschema_env%properties%calcinfo_nmo = nmo
382 qcschema_env%properties%calcinfo_nalpha = nalpha
383 qcschema_env%properties%calcinfo_nbeta = nbeta
386 qcschema_env%properties%return_energy = energy%total
387 qcschema_env%properties%scf_total_energy = energy%total
389 qcschema_env%properties%nuclear_repulsion_energy = active_space_env%energy_inactive
391 qcschema_env%properties%scf_iterations = scf_env%iter_count
393 one_el_en = energy%core_overlap + energy%core_self + energy%core
394 qcschema_env%properties%scf_two_electron_energy = one_el_en
396 two_el_en = energy%hartree + energy%ex + energy%hartree_1c
397 qcschema_env%properties%scf_one_electron_energy = two_el_en
399 qcschema_env%properties%scf_xc_energy = &
400 energy%exc + energy%exc_aux_fit + energy%exc1 + energy%exc1_aux_fit
402 dispersion = energy%dispersion + energy%gcp
403 qcschema_env%properties%scf_dispersion_correction_energy = dispersion
406 IF (dft_control%smear) cpabort(
'WARNING: smearing not supported in QCSchema')
407 IF (dft_control%dft_plus_u) cpabort(
'WARNING: DFT+U not supported in QCSchema')
408 IF (dft_control%do_sccs) cpabort(
'WARNING: SCCS not supported in QCSchema')
409 IF (qs_env%qmmm) cpabort(
'WARNING: QM/MM not supported in QCSchema')
410 IF (dft_control%qs_control%mulliken_restraint)
THEN
411 cpabort(
'WARNING: Mulliken restrains not supported in QCSchema')
413 IF (dft_control%qs_control%semi_empirical)
THEN
414 cpabort(
'WARNING: semi_empirical methods not supported in QCSchema')
416 IF (dft_control%qs_control%dftb) cpabort(
'WARNING: DFTB not supported in QCSchema')
417 IF (dft_control%qs_control%xtb) cpabort(
'WARNING: xTB not supported in QCSchema')
420 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
421 qcschema_env%properties%mp2 = .true.
426 qcschema_env%properties%mp2_correlation_energy = energy%mp2
427 qcschema_env%properties%mp2_total_energy = energy%total
430 qcschema_env%properties%scf_total_energy = energy%total - energy%mp2
437 IF (nspins == 1)
THEN
438 qcschema_env%wavefunction%restricted = .true.
440 qcschema_env%wavefunction%restricted = .false.
444 ALLOCATE (qcschema_env%wavefunction%scf_eigenvalues_a(nmo))
446 i_glb = active_space_env%active_orbitals(i, 1)
447 qcschema_env%wavefunction%scf_eigenvalues_a(i) = &
448 active_space_env%mos_active(1)%eigenvalues(i_glb)
452 ALLOCATE (qcschema_env%wavefunction%scf_occupations_a(nmo))
454 i_glb = active_space_env%active_orbitals(i, 1)
455 qcschema_env%wavefunction%scf_occupations_a(i) = &
456 active_space_env%mos_active(1)%occupation_numbers(i_glb)
460 ALLOCATE (qcschema_env%wavefunction%scf_fock_mo_a(nmo*nmo))
462 qcschema_env%wavefunction%scf_fock_mo_a, &
463 active_space_env%active_orbitals(:, 1), &
464 active_space_env%active_orbitals(:, 1))
467 ALLOCATE (qcschema_env%wavefunction%scf_density_mo_a(nmo*nmo))
469 qcschema_env%wavefunction%scf_density_mo_a, &
470 active_space_env%active_orbitals(:, 1), &
471 active_space_env%active_orbitals(:, 1))
474 ALLOCATE (qcschema_env%wavefunction%scf_orbitals_a(nao*nmo))
476 qcschema_env%wavefunction%scf_orbitals_a, &
477 [(i, i=1, nao)], active_space_env%active_orbitals(:, 1))
479 IF (nspins == 2)
THEN
481 ALLOCATE (qcschema_env%wavefunction%scf_eigenvalues_b(nmo))
483 i_glb = active_space_env%active_orbitals(i, 2)
484 qcschema_env%wavefunction%scf_eigenvalues_b(i) = &
485 active_space_env%mos_active(2)%eigenvalues(i_glb)
489 ALLOCATE (qcschema_env%wavefunction%scf_occupations_b(nmo))
491 i_glb = active_space_env%active_orbitals(i, 2)
492 qcschema_env%wavefunction%scf_occupations_b(i) = &
493 active_space_env%mos_active(2)%occupation_numbers(i_glb)
497 ALLOCATE (qcschema_env%wavefunction%scf_fock_mo_b(nmo*nmo))
499 qcschema_env%wavefunction%scf_fock_mo_b, &
500 active_space_env%active_orbitals(:, 2), &
501 active_space_env%active_orbitals(:, 2))
504 ALLOCATE (qcschema_env%wavefunction%scf_density_mo_b(nmo*nmo))
506 qcschema_env%wavefunction%scf_density_mo_b, &
507 active_space_env%active_orbitals(:, 2), &
508 active_space_env%active_orbitals(:, 2))
511 ALLOCATE (qcschema_env%wavefunction%scf_orbitals_b(nao*nmo))
513 qcschema_env%wavefunction%scf_orbitals_b, &
514 [(i, i=1, nao)], active_space_env%active_orbitals(:, 2))
518 ALLOCATE (qcschema_env%wavefunction%scf_eri_mo_aa(nmo**4))
519 CALL eri_to_array(active_space_env%eri, qcschema_env%wavefunction%scf_eri_mo_aa, &
520 active_space_env%active_orbitals, 1, 1)
522 IF (nspins == 2)
THEN
524 ALLOCATE (qcschema_env%wavefunction%scf_eri_mo_ab(nmo**4))
525 CALL eri_to_array(active_space_env%eri, qcschema_env%wavefunction%scf_eri_mo_ab, &
526 active_space_env%active_orbitals, 1, 2)
529 ALLOCATE (qcschema_env%wavefunction%scf_eri_mo_bb(nmo**4))
530 CALL eri_to_array(active_space_env%eri, qcschema_env%wavefunction%scf_eri_mo_bb, &
531 active_space_env%active_orbitals, 2, 2)
539 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
540 CALL get_qs_kind(kind_set(ikind), basis_set=basis_set)
542 basis_set_name = basis_set%name
546 cpassert(basis_set_name == basis_set%name)
549 qcschema_env%wavefunction%basis_set%name = basis_set_name
552 IF (dft_control%uks)
THEN
554 ELSE IF (dft_control%roks)
THEN
564 method = trim(method)//
'HF'
565 ELSE IF (qcschema_env%properties%mp2)
THEN
566 method = trim(method)//
'MP2'
568 method = trim(method)//
'KS'
571 qcschema_env%wavefunction%method = trim(method)
578 IF (
ASSOCIATED(force))
THEN
579 qcschema_env%driver =
'gradient'
581 qcschema_env%driver =
'energy'
586 qcschema_env%success = .true.
589 IF (qcschema_env%success)
THEN
590 IF (qcschema_env%driver ==
'energy')
THEN
591 ALLOCATE (qcschema_env%return_result(1))
592 qcschema_env%return_result(1) = energy%total
594 ALLOCATE (qcschema_env%return_result(3*
SIZE(particle_set)))
596 qcschema_env%return_result = 0.0_dp
599 cpabort(
"The calculation to build the AS is unsuccessful")
602 CALL timestop(handle)
613 IF (
ALLOCATED(qcschema_env%return_result))
THEN
614 DEALLOCATE (qcschema_env%return_result)
617 IF (
ALLOCATED(qcschema_env%topology%atomic_numbers))
THEN
618 DEALLOCATE (qcschema_env%topology%atomic_numbers)
621 IF (
ALLOCATED(qcschema_env%topology%masses))
THEN
622 DEALLOCATE (qcschema_env%topology%masses)
625 IF (
ALLOCATED(qcschema_env%topology%geometry))
THEN
626 DEALLOCATE (qcschema_env%topology%geometry)
629 IF (
ALLOCATED(qcschema_env%topology%symbols))
THEN
630 DEALLOCATE (qcschema_env%topology%symbols)
633 IF (
ALLOCATED(qcschema_env%wavefunction%scf_density_mo_a))
THEN
634 DEALLOCATE (qcschema_env%wavefunction%scf_density_mo_a)
637 IF (
ALLOCATED(qcschema_env%wavefunction%scf_density_mo_b))
THEN
638 DEALLOCATE (qcschema_env%wavefunction%scf_density_mo_b)
641 IF (
ALLOCATED(qcschema_env%wavefunction%scf_fock_mo_a))
THEN
642 DEALLOCATE (qcschema_env%wavefunction%scf_fock_mo_a)
645 IF (
ALLOCATED(qcschema_env%wavefunction%scf_fock_mo_b))
THEN
646 DEALLOCATE (qcschema_env%wavefunction%scf_fock_mo_b)
649 IF (
ALLOCATED(qcschema_env%wavefunction%scf_orbitals_a))
THEN
650 DEALLOCATE (qcschema_env%wavefunction%scf_orbitals_a)
653 IF (
ALLOCATED(qcschema_env%wavefunction%scf_orbitals_b))
THEN
654 DEALLOCATE (qcschema_env%wavefunction%scf_orbitals_b)
657 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eigenvalues_a))
THEN
658 DEALLOCATE (qcschema_env%wavefunction%scf_eigenvalues_a)
661 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eigenvalues_b))
THEN
662 DEALLOCATE (qcschema_env%wavefunction%scf_eigenvalues_b)
665 IF (
ALLOCATED(qcschema_env%wavefunction%scf_occupations_a))
THEN
666 DEALLOCATE (qcschema_env%wavefunction%scf_occupations_a)
669 IF (
ALLOCATED(qcschema_env%wavefunction%scf_occupations_b))
THEN
670 DEALLOCATE (qcschema_env%wavefunction%scf_occupations_b)
673 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eri))
THEN
674 DEALLOCATE (qcschema_env%wavefunction%scf_eri)
677 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eri_mo_aa))
THEN
678 DEALLOCATE (qcschema_env%wavefunction%scf_eri_mo_aa)
681 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eri_mo_bb))
THEN
682 DEALLOCATE (qcschema_env%wavefunction%scf_eri_mo_bb)
685 IF (
ALLOCATED(qcschema_env%wavefunction%scf_eri_mo_ab))
THEN
686 DEALLOCATE (qcschema_env%wavefunction%scf_eri_mo_ab)
689 IF (
ALLOCATED(qcschema_env%wavefunction%localized_orbitals_a))
THEN
690 DEALLOCATE (qcschema_env%wavefunction%localized_orbitals_a)
693 IF (
ALLOCATED(qcschema_env%wavefunction%localized_orbitals_b))
THEN
694 DEALLOCATE (qcschema_env%wavefunction%localized_orbitals_b)
697 IF (
ALLOCATED(qcschema_env%wavefunction%localized_fock_a))
THEN
698 DEALLOCATE (qcschema_env%wavefunction%localized_fock_a)
701 IF (
ALLOCATED(qcschema_env%wavefunction%localized_fock_b))
THEN
702 DEALLOCATE (qcschema_env%wavefunction%localized_fock_b)
712 SUBROUTINE qcschema_update_fock(qcschema_env, active_space_env)
718 qcschema_env%wavefunction%scf_fock_mo_a, &
719 active_space_env%active_orbitals(:, 1), &
720 active_space_env%active_orbitals(:, 1))
723 IF (active_space_env%nspins == 2)
THEN
725 qcschema_env%wavefunction%scf_fock_mo_b, &
726 active_space_env%active_orbitals(:, 2), &
727 active_space_env%active_orbitals(:, 2))
731 qcschema_env%properties%nuclear_repulsion_energy = active_space_env%energy_inactive
733 END SUBROUTINE qcschema_update_fock
742 CHARACTER(LEN=default_path_length),
INTENT(IN) :: filename
744 cpabort(
"CP2K was compiled without the HDF5 library")
746 mark_used(qcschema_env)
748 INTEGER :: output_unit
749 INTEGER(KIND=hdf5_id) :: file_id, group_id
750 INTEGER(KIND=int_8) :: nresult
761 CALL h5fcreate(trim(filename), file_id)
767 CALL h5awrite_fixlen_string(file_id,
'driver', trim(qcschema_env%driver))
769 nresult =
SIZE(qcschema_env%return_result)
770 IF (
SIZE(qcschema_env%return_result) == 1)
THEN
771 CALL h5awrite_double_scalar(file_id,
'return_result', qcschema_env%return_result(1))
773 CALL h5awrite_double_simple(file_id,
'return_result', qcschema_env%return_result)
776 CALL h5awrite_fixlen_string(file_id,
'schema_name', trim(qcschema_env%topology%schema_name))
778 CALL h5awrite_integer_scalar(file_id,
'schema_version', qcschema_env%topology%schema_version)
780 CALL h5awrite_boolean(file_id,
'success', qcschema_env%success)
786 CALL h5gcreate(file_id,
'provenance', group_id)
788 CALL h5awrite_fixlen_string(group_id,
'creator', trim(qcschema_env%provenance%creator))
789 CALL h5awrite_fixlen_string(group_id,
'routine', trim(qcschema_env%provenance%routine))
790 CALL h5awrite_fixlen_string(group_id,
'version', trim(qcschema_env%provenance%version))
792 CALL h5gclose(group_id)
798 CALL h5gcreate(file_id,
'molecule', group_id)
800 CALL h5awrite_double_simple(group_id,
'geometry', qcschema_env%topology%geometry)
801 CALL h5awrite_integer_simple(group_id,
'atomic_numbers', qcschema_env%topology%atomic_numbers)
802 CALL h5awrite_double_simple(group_id,
'masses', qcschema_env%topology%masses)
803 CALL h5awrite_integer_scalar(group_id,
'molecular_charge', qcschema_env%topology%molecular_charge)
804 CALL h5awrite_integer_scalar(group_id,
'molecular_multiplicity', qcschema_env%topology%molecular_multiplicity)
805 CALL h5awrite_string_simple(group_id,
'symbols', qcschema_env%topology%symbols)
807 CALL h5awrite_fixlen_string(group_id,
'schema_name',
'qcschema_molecule')
808 CALL h5awrite_integer_scalar(group_id,
'schema_version', 2)
810 CALL h5gclose(group_id)
816 CALL h5gcreate(file_id,
'properties', group_id)
818 CALL h5awrite_integer_scalar(group_id,
'calcinfo_natom', qcschema_env%properties%calcinfo_natom)
819 CALL h5awrite_integer_scalar(group_id,
'calcinfo_nbasis', qcschema_env%properties%calcinfo_nbasis)
820 CALL h5awrite_integer_scalar(group_id,
'calcinfo_nmo', qcschema_env%properties%calcinfo_nmo)
821 CALL h5awrite_integer_scalar(group_id,
'calcinfo_nalpha', qcschema_env%properties%calcinfo_nalpha)
822 CALL h5awrite_integer_scalar(group_id,
'calcinfo_nbeta', qcschema_env%properties%calcinfo_nbeta)
828 CALL h5awrite_double_scalar(group_id,
'return_energy', qcschema_env%properties%return_energy)
829 CALL h5awrite_double_scalar(group_id,
'scf_total_energy', qcschema_env%properties%scf_total_energy)
830 CALL h5awrite_double_scalar(group_id,
'nuclear_repulsion_energy', &
831 qcschema_env%properties%nuclear_repulsion_energy)
833 IF (qcschema_env%properties%scf_iterations /= 0)
THEN
834 CALL h5awrite_integer_scalar(group_id,
'scf_iterations', qcschema_env%properties%scf_iterations)
837 IF (qcschema_env%properties%scf_one_electron_energy /= 0.0_dp)
THEN
838 CALL h5awrite_double_scalar(group_id,
'scf_one_electron_energy', &
839 qcschema_env%properties%scf_one_electron_energy)
842 IF (qcschema_env%properties%scf_two_electron_energy /= 0.0_dp)
THEN
843 CALL h5awrite_double_scalar(group_id,
'scf_two_electron_energy', &
844 qcschema_env%properties%scf_two_electron_energy)
847 IF (qcschema_env%properties%scf_xc_energy /= 0.0_dp)
THEN
848 CALL h5awrite_double_scalar(group_id,
'scf_xc_energy', &
849 qcschema_env%properties%scf_xc_energy)
852 IF (qcschema_env%properties%scf_dispersion_correction_energy /= 0.0_dp)
THEN
853 CALL h5awrite_double_scalar(group_id,
'scf_dispersion_correction_energy', &
854 qcschema_env%properties%scf_dispersion_correction_energy)
857 IF (qcschema_env%properties%mp2)
THEN
858 CALL h5awrite_double_scalar(group_id,
'mp2_correlation_energy', &
859 qcschema_env%properties%mp2_correlation_energy)
863 CALL h5gclose(group_id)
869 CALL h5gcreate(file_id,
'wavefunction', group_id)
871 CALL h5awrite_fixlen_string(group_id,
'basis', trim(qcschema_env%wavefunction%basis_set%name))
873 CALL h5dwrite_double_simple(group_id,
'scf_orbitals_a', &
874 qcschema_env%wavefunction%scf_orbitals_a)
876 CALL h5dwrite_double_simple(group_id,
'scf_eigenvalues_a', &
877 qcschema_env%wavefunction%scf_eigenvalues_a)
879 CALL h5dwrite_double_simple(group_id,
'scf_occupations_a', &
880 qcschema_env%wavefunction%scf_occupations_a)
882 CALL h5dwrite_double_simple(group_id,
'scf_fock_mo_a', &
883 qcschema_env%wavefunction%scf_fock_mo_a)
885 CALL h5dwrite_double_simple(group_id,
'scf_density_mo_a', &
886 qcschema_env%wavefunction%scf_density_mo_a)
888 CALL h5dwrite_double_simple(group_id,
'scf_eri_mo_aa', &
889 qcschema_env%wavefunction%scf_eri_mo_aa)
891 IF (.NOT. qcschema_env%wavefunction%restricted)
THEN
892 CALL h5dwrite_double_simple(group_id,
'scf_orbitals_b', &
893 qcschema_env%wavefunction%scf_orbitals_b)
895 CALL h5dwrite_double_simple(group_id,
'scf_eigenvalues_b', &
896 qcschema_env%wavefunction%scf_eigenvalues_b)
898 CALL h5dwrite_double_simple(group_id,
'scf_occupations_b', &
899 qcschema_env%wavefunction%scf_occupations_b)
901 CALL h5dwrite_double_simple(group_id,
'scf_fock_mo_b', &
902 qcschema_env%wavefunction%scf_fock_mo_b)
904 CALL h5dwrite_double_simple(group_id,
'scf_density_mo_b', &
905 qcschema_env%wavefunction%scf_density_mo_b)
907 CALL h5dwrite_double_simple(group_id,
'scf_eri_mo_bb', &
908 qcschema_env%wavefunction%scf_eri_mo_bb)
910 CALL h5dwrite_double_simple(group_id,
'scf_eri_mo_ba', &
911 qcschema_env%wavefunction%scf_eri_mo_ab)
916 CALL h5gclose(group_id)
922 CALL h5gcreate(file_id,
'model', group_id)
923 CALL h5awrite_fixlen_string(group_id,
'basis', trim(qcschema_env%wavefunction%basis_set%name))
924 CALL h5awrite_fixlen_string(group_id,
'method', trim(qcschema_env%wavefunction%method))
926 CALL h5gclose(group_id)
929 CALL h5gcreate(file_id,
'keywords', group_id)
931 CALL h5gclose(group_id)
933 CALL h5fclose(file_id)
945 SUBROUTINE read_pmat_from_hdf5(filename, qcschema_env)
946 CHARACTER(LEN=default_path_length),
INTENT(IN) :: filename
950 INTEGER(KIND=hdf5_id) :: file_id, group_id
956 CALL h5fopen(trim(filename), file_id)
959 CALL h5gopen(file_id,
'wavefunction', group_id)
962 nmo = qcschema_env%properties%calcinfo_nmo
963 IF (.NOT.
ALLOCATED(qcschema_env%wavefunction%scf_density_mo_a))
THEN
964 ALLOCATE (qcschema_env%wavefunction%scf_density_mo_a(nmo*nmo))
968 CALL h5dread_double_simple(group_id,
'scf_density_mo_a', qcschema_env%wavefunction%scf_density_mo_a)
970 IF (.NOT. qcschema_env%wavefunction%restricted)
THEN
971 IF (.NOT.
ALLOCATED(qcschema_env%wavefunction%scf_density_mo_b))
THEN
972 ALLOCATE (qcschema_env%wavefunction%scf_density_mo_b(nmo*nmo))
975 CALL h5dread_double_simple(group_id,
'scf_density_mo_b', qcschema_env%wavefunction%scf_density_mo_b)
979 CALL h5gclose(group_id)
980 CALL h5fclose(file_id)
983 END SUBROUTINE read_pmat_from_hdf5
990 SUBROUTINE read_return_energy_from_hdf5(filename, qcschema_env)
991 CHARACTER(LEN=default_path_length),
INTENT(IN) :: filename
994 INTEGER(KIND=hdf5_id) :: file_id, group_id
1000 CALL h5fopen(trim(filename), file_id)
1003 CALL h5gopen(file_id,
'properties', group_id)
1006 CALL h5aread_double_scalar(group_id,
'return_energy', qcschema_env%properties%return_energy)
1009 CALL h5gclose(group_id)
1010 CALL h5fclose(file_id)
1013 END SUBROUTINE read_return_energy_from_hdf5
1021 SUBROUTINE read_active_energy_from_hdf5(active_space_env, qcschema_env)
1025 CHARACTER(LEN=default_path_length) :: qcschema_filename
1028 qcschema_filename = active_space_env%qcschema_filename
1030 CALL read_return_energy_from_hdf5(qcschema_filename, qcschema_env)
1032 active_space_env%energy_active = qcschema_env%properties%return_energy
1033 active_space_env%energy_total = active_space_env%energy_inactive + active_space_env%energy_active
1035 END SUBROUTINE read_active_energy_from_hdf5
Define the atomic kind types and their sub types.
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.
some minimal info about CP2K, including its version and license
character(len= *), parameter, public cp2k_version
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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
A wrapper around the HDF5 Fortran API.
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Types needed for MP2 calculations.
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.
The module to read/write QCSchema HDF5 files for interfacing CP2K with other programs.
subroutine, public qcschema_env_release(qcschema_env)
Releases the allocated memory of a qcschema environment.
subroutine, public qcschema_env_create(qcschema_env, qs_env)
Create and initialize a qcschema object from a quickstep environment.
subroutine, public qcschema_to_hdf5(qcschema_env, filename)
Writes a qcschema object to an hdf5 file.
The types needed for the calculation of active space Hamiltonians.
Contains utility routines for the active space module.
subroutine, public eri_to_array(eri_env, array, active_orbitals, spin1, spin2)
Copy the eri tensor for spins isp1 and isp2 to a standard 1D Fortran array.
subroutine, public subspace_matrix_to_array(source_matrix, target_array, row_index, col_index)
Copy a (square portion) of a cp_fm_type matrix to a standard 1D Fortran array.
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.
module that contains the definitions of the scf types
Control for reading in different topologies and coordinates.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
The full QCSchema output type. For more information refer to: https://molssi-qc-schema....
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...