(git:1f9fd2c)
Loading...
Searching...
No Matches
fist_efield_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! **************************************************************************************************
9!> \par History
10!> \author JGH
11! **************************************************************************************************
19 USE kinds, ONLY: dp
20#include "./base/base_uses.f90"
21
22 IMPLICIT NONE
23
24 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fist_efield_types'
25
26! **************************************************************************************************
28 LOGICAL :: apply_field = .false.
29 LOGICAL :: displacement = .false.
30 REAL(kind=dp) :: strength = 0.0_dp
31 REAL(kind=dp), DIMENSION(3) :: polarisation = 0.0_dp
32 REAL(kind=dp), DIMENSION(3) :: dfilter = 0.0_dp
33 END TYPE fist_efield_type
34! **************************************************************************************************
35
36 PRIVATE
37
38 PUBLIC :: fist_efield_type
39 PUBLIC :: read_efield_section
40
41! **************************************************************************************************
42
43CONTAINS
44
45! **************************************************************************************************
46!> \brief Read input section PERIODIC_EFIELD
47!> \param input_section ...
48!> \param efield ...
49!> \param cell ...
50!> \par History
51!> \author JGH
52! **************************************************************************************************
53 SUBROUTINE read_efield_section(input_section, efield, cell)
54 TYPE(section_vals_type), POINTER :: input_section
55 TYPE(fist_efield_type), POINTER :: efield
56 TYPE(cell_type), OPTIONAL, POINTER :: cell
57
58 REAL(kind=dp), DIMENSION(:), POINTER :: pp
59 TYPE(section_vals_type), POINTER :: tmp_section
60
61 IF (.NOT. ASSOCIATED(efield)) ALLOCATE (efield)
62
63 ! Read the finite field input section for periodic fields
64 tmp_section => section_vals_get_subs_vals(input_section, "PERIODIC_EFIELD")
65 CALL section_vals_get(tmp_section, explicit=efield%apply_field)
66 IF (efield%apply_field) THEN
67 CALL section_vals_val_get(tmp_section, "POLARISATION", r_vals=pp)
68 efield%polarisation(1:3) = pp(1:3)
69 IF (PRESENT(cell)) THEN
70 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%polarisation(1:3))
71 END IF
72 CALL section_vals_val_get(tmp_section, "D_FILTER", r_vals=pp)
73 efield%dfilter(1:3) = pp(1:3)
74 IF (PRESENT(cell)) THEN
75 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%dfilter(1:3))
76 END IF
77 CALL section_vals_val_get(tmp_section, "INTENSITY", r_val=efield%strength)
78 CALL section_vals_val_get(tmp_section, "DISPLACEMENT_FIELD", l_val=efield%displacement)
79 END IF
80
81 END SUBROUTINE read_efield_section
82
83! **************************************************************************************************
84
85END MODULE fist_efield_types
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_transform_input_cartesian(cell, vector)
Transform a Cartesian real-space vector from the user input cell frame into CP2K's canonical internal...
Definition cell_types.F:261
subroutine, public read_efield_section(input_section, efield, cell)
Read input section PERIODIC_EFIELD.
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Type defining parameters related to the simulation cell.
Definition cell_types.F:60