(git:7fc1fe1)
Loading...
Searching...
No Matches
nlo_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8!> \brief Nonlinear optical environment: input parameters and data shared by calculation stages.
9! **************************************************************************************************
11 USE cell_types, ONLY: cell_type
12 USE kinds, ONLY: dp
13 USE kpoint_types, ONLY: kpoint_release,&
16 USE qs_mo_types, ONLY: mo_set_type
17#include "../base/base_uses.f90"
18
19 IMPLICIT NONE
20
21 PRIVATE
22
23 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'nlo_types'
24
26 ! A frequency is either a regular energy grid or a signed link to an earlier field.
27 TYPE, PUBLIC :: nlo_frequency_type
28 REAL(kind=dp) :: start_ev = 0.0_dp, &
29 step_ev = 0.0_dp
30 INTEGER :: n_values = 0, &
31 reference = 0, &
32 sign = 1
33 END TYPE nlo_frequency_type
34
35 ! One instance, nlo_env, owns the input and the data shared by the five main stages.
36 TYPE, PUBLIC :: nlo_type
37 INTEGER :: order = 0, &
38 k_mesh(3) = 0
39 LOGICAL, ALLOCATABLE :: elements(:, :)
40 REAL(kind=dp) :: t1_au = 0.0_dp
41 REAL(kind=dp) :: t2_au = 0.0_dp
42 REAL(kind=dp) :: transition_width_au = 0.0_dp
43 TYPE(nlo_frequency_type) :: frequency(5)
44 ! Number of independent tuples formed from FREQ_1,...,FREQ_ORDER.
45 INTEGER :: n_frequency_combinations = 0
46 ! Data shared by preparation, Brillouin-zone integration and output.
47 INTEGER :: n_bands = 0, &
48 n_ao = 0, &
49 n_images = 0, &
50 n_kpoints = 0, &
51 n_spin = 0
52
53 REAL(kind=dp) :: min_direct_gap = 0.0_dp, &
54 projection_error = 0.0_dp
55 ! AO matrices at lattice image R: H, S, and dipole d.
56 ! Indices: (spin or Cartesian component, AO row, AO column, R).
57 REAL(kind=dp), ALLOCATABLE :: h_ao_r(:, :, :, :), &
58 s_ao_r(:, :, :, :), &
59 d_ao_r(:, :, :, :)
60
61 ! Integrated current: (output direction, input-direction code, frequency combination).
62 COMPLEX(dp), ALLOCATABLE :: current_spectrum(:, :, :)
63
64 ! Temporary matrices for one k point, allocated once for the integration stage.
65 COMPLEX(dp), ALLOCATABLE :: band_connection_derivatives(:, :, :, :), &
66 band_hamiltonian_derivatives(:, :, :), &
67 current_flat(:, :), &
68 position_derivatives(:, :, :, :), &
69 hamiltonian_derivatives(:, :, :), &
70 rho0_derivatives(:, :, :), &
71 overlap_derivatives(:, :, :), &
72 velocity(:, :, :)
73 INTEGER, ALLOCATABLE :: occupied(:)
74 REAL(kind=dp), ALLOCATABLE :: energies(:)
75
76 ! Number of spin/k-point tasks assigned to the reporting rank.
77 INTEGER :: progress_done = 0, &
78 progress_next = 1, &
79 progress_total = 0
80 REAL(kind=dp) :: progress_start = 0.0_dp
81
82 TYPE(cell_type), POINTER :: cell => null()
83 TYPE(kpoint_type), POINTER :: images => null()
84 TYPE(mo_set_type), POINTER :: mos(:) => null()
85 TYPE(mp_para_env_type), POINTER :: para_env => null()
86 END TYPE nlo_type
87
88CONTAINS
89
90! **************************************************************************************************
91!> \brief Release NLO-owned matrices and the auxiliary k-point environment, if created.
92!> \param nlo_env NLO settings and owned arrays to release
93! **************************************************************************************************
94 SUBROUTINE release_nlo_environment(nlo_env)
95 TYPE(nlo_type), INTENT(INOUT) :: nlo_env
96
97 CALL kpoint_release(nlo_env%images)
98 NULLIFY (nlo_env%cell, nlo_env%mos, nlo_env%para_env)
99 DEALLOCATE (nlo_env%h_ao_R, nlo_env%s_ao_R, nlo_env%d_ao_R, nlo_env%current_spectrum)
100 IF (ALLOCATED(nlo_env%elements)) DEALLOCATE (nlo_env%elements)
101
102 END SUBROUTINE release_nlo_environment
103
104END MODULE nlo_types
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Types and basic routines needed for a kpoint calculation.
subroutine, public kpoint_release(kpoint)
Release a kpoint environment, deallocate all data.
Interface to the message passing library MPI.
Nonlinear optical environment: input parameters and data shared by calculation stages.
Definition nlo_types.F:10
subroutine, public release_nlo_environment(nlo_env)
Release NLO-owned matrices and the auxiliary k-point environment, if created.
Definition nlo_types.F:95
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
Contains information about kpoints.
stores all the informations relevant to an mpi environment