LCOV - code coverage report
Current view: top level - src - fist_efield_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b279b6b) Lines: 13 14 92.9 %
Date: 2024-04-24 07:13:09 Functions: 1 2 50.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 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             : ! **************************************************************************************************
      12             : MODULE fist_efield_types
      13             :    USE input_section_types,             ONLY: section_vals_get,&
      14             :                                               section_vals_get_subs_vals,&
      15             :                                               section_vals_type,&
      16             :                                               section_vals_val_get
      17             :    USE kinds,                           ONLY: dp
      18             : #include "./base/base_uses.f90"
      19             : 
      20             :    IMPLICIT NONE
      21             : 
      22             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fist_efield_types'
      23             : 
      24             : ! **************************************************************************************************
      25             :    TYPE fist_efield_type
      26             :       LOGICAL                                :: apply_field = .FALSE.
      27             :       LOGICAL                                :: displacement = .FALSE.
      28             :       REAL(KIND=dp)                          :: strength
      29             :       REAL(KIND=dp), DIMENSION(3)            :: polarisation
      30             :       REAL(KIND=dp), DIMENSION(3)            :: dfilter
      31             :    END TYPE fist_efield_type
      32             : ! **************************************************************************************************
      33             : 
      34             :    PRIVATE
      35             : 
      36             :    PUBLIC :: fist_efield_type
      37             :    PUBLIC :: read_efield_section
      38             : 
      39             : ! **************************************************************************************************
      40             : 
      41             : CONTAINS
      42             : 
      43             : ! **************************************************************************************************
      44             : !> \brief Read input section PERIODIC_EFIELD
      45             : !> \param input_section ...
      46             : !> \param efield ...
      47             : !> \par History
      48             : !> \author JGH
      49             : ! **************************************************************************************************
      50        2639 :    SUBROUTINE read_efield_section(input_section, efield)
      51             :       TYPE(section_vals_type), POINTER                   :: input_section
      52             :       TYPE(fist_efield_type), POINTER                    :: efield
      53             : 
      54        2639 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: pp
      55             :       TYPE(section_vals_type), POINTER                   :: tmp_section
      56             : 
      57        2639 :       IF (.NOT. ASSOCIATED(efield)) ALLOCATE (efield)
      58             : 
      59             :       ! Read the finite field input section for periodic fields
      60        2639 :       tmp_section => section_vals_get_subs_vals(input_section, "PERIODIC_EFIELD")
      61        2639 :       CALL section_vals_get(tmp_section, explicit=efield%apply_field)
      62        2639 :       IF (efield%apply_field) THEN
      63           4 :          CALL section_vals_val_get(tmp_section, "POLARISATION", r_vals=pp)
      64          32 :          efield%polarisation(1:3) = pp(1:3)
      65           4 :          CALL section_vals_val_get(tmp_section, "D_FILTER", r_vals=pp)
      66          32 :          efield%dfilter(1:3) = pp(1:3)
      67           4 :          CALL section_vals_val_get(tmp_section, "INTENSITY", r_val=efield%strength)
      68           4 :          CALL section_vals_val_get(tmp_section, "DISPLACEMENT_FIELD", l_val=efield%displacement)
      69             :       END IF
      70             : 
      71        2639 :    END SUBROUTINE read_efield_section
      72             : 
      73             : ! **************************************************************************************************
      74             : 
      75           0 : END MODULE fist_efield_types

Generated by: LCOV version 1.15