LCOV - code coverage report
Current view: top level - src - fist_efield_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:06f838d) Lines: 94.4 % 18 17
Test Date: 2026-06-05 07:04:50 Functions: 50.0 % 2 1

            Line data    Source code
       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              : ! **************************************************************************************************
      12              : MODULE fist_efield_types
      13              :    USE cell_types,                      ONLY: cell_transform_input_cartesian,&
      14              :                                               cell_type
      15              :    USE input_section_types,             ONLY: section_vals_get,&
      16              :                                               section_vals_get_subs_vals,&
      17              :                                               section_vals_type,&
      18              :                                               section_vals_val_get
      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              : ! **************************************************************************************************
      27              :    TYPE fist_efield_type
      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              : 
      43              : CONTAINS
      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         2635 :    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         2635 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: pp
      59              :       TYPE(section_vals_type), POINTER                   :: tmp_section
      60              : 
      61        23715 :       IF (.NOT. ASSOCIATED(efield)) ALLOCATE (efield)
      62              : 
      63              :       ! Read the finite field input section for periodic fields
      64         2635 :       tmp_section => section_vals_get_subs_vals(input_section, "PERIODIC_EFIELD")
      65         2635 :       CALL section_vals_get(tmp_section, explicit=efield%apply_field)
      66         2635 :       IF (efield%apply_field) THEN
      67            4 :          CALL section_vals_val_get(tmp_section, "POLARISATION", r_vals=pp)
      68           32 :          efield%polarisation(1:3) = pp(1:3)
      69            4 :          IF (PRESENT(cell)) THEN
      70            4 :             IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%polarisation(1:3))
      71              :          END IF
      72            4 :          CALL section_vals_val_get(tmp_section, "D_FILTER", r_vals=pp)
      73           32 :          efield%dfilter(1:3) = pp(1:3)
      74            4 :          IF (PRESENT(cell)) THEN
      75            4 :             IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%dfilter(1:3))
      76              :          END IF
      77            4 :          CALL section_vals_val_get(tmp_section, "INTENSITY", r_val=efield%strength)
      78            4 :          CALL section_vals_val_get(tmp_section, "DISPLACEMENT_FIELD", l_val=efield%displacement)
      79              :       END IF
      80              : 
      81         2635 :    END SUBROUTINE read_efield_section
      82              : 
      83              : ! **************************************************************************************************
      84              : 
      85            0 : END MODULE fist_efield_types
        

Generated by: LCOV version 2.0-1