LCOV - code coverage report
Current view: top level - src - qmmm_ff_fist.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 51 51 100.0 %
Date: 2024-12-21 06:28:57 Functions: 2 2 100.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             : !> \author teo
      10             : ! **************************************************************************************************
      11             : MODULE qmmm_ff_fist
      12             : 
      13             :    USE kinds,                           ONLY: default_string_length
      14             : #include "./base/base_uses.f90"
      15             : 
      16             :    IMPLICIT NONE
      17             :    PRIVATE
      18             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qmmm_ff_fist'
      19             : 
      20             :    PUBLIC :: qmmm_ff_precond_only_qm
      21             : 
      22             : CONTAINS
      23             : 
      24             : ! **************************************************************************************************
      25             : !> \brief This function handles the atom names and modifies
      26             : !>      the "_QM_" prefix, in order to find the parameters
      27             : !>      and return .TRUE. if all input labels belong to QM atoms
      28             : !> \param id1 ...
      29             : !> \param id2 ...
      30             : !> \param id3 ...
      31             : !> \param id4 ...
      32             : !> \param is_link ...
      33             : !> \return ...
      34             : !> \par History
      35             : !>      11.2004 created [tlaino]
      36             : !> \author Teodoro Laino
      37             : ! **************************************************************************************************
      38     3319747 :    FUNCTION qmmm_ff_precond_only_qm(id1, id2, id3, id4, is_link) RESULT(only_qm)
      39             :       CHARACTER(LEN=default_string_length), &
      40             :          INTENT(INOUT)                                   :: id1
      41             :       CHARACTER(LEN=default_string_length), &
      42             :          INTENT(INOUT), OPTIONAL                         :: id2, id3, id4
      43             :       LOGICAL, INTENT(OUT), OPTIONAL                     :: is_link
      44             :       LOGICAL                                            :: only_qm
      45             : 
      46             :       CHARACTER(LEN=default_string_length)               :: tmp
      47             :       INTEGER                                            :: j, my_index
      48             :       LOGICAL                                            :: my_link
      49             : 
      50     3319747 :       only_qm = .FALSE.
      51     3319747 :       my_link = .FALSE.
      52     3380089 :       DO WHILE (INDEX(id1, "_QM_") /= 0)
      53       60342 :          my_link = qmmm_ff_precond_only_link(id1) .OR. my_link
      54       60342 :          my_index = INDEX(id1, "_QM_") + LEN_TRIM("_QM_")
      55       60342 :          only_qm = .TRUE.
      56       60342 :          tmp = TRIM(id1(my_index:))
      57     4887702 :          clean_string_1: DO j = 1, default_string_length
      58     4887702 :             id1(j:j) = " "
      59             :          END DO clean_string_1
      60       60342 :          id1 = TRIM(tmp)
      61             :       END DO
      62             : 
      63     3319747 :       IF (PRESENT(id2)) THEN
      64     1184634 :          IF (INDEX(id2, "_QM_") == 0) only_qm = .FALSE.
      65     1291148 :          DO WHILE (INDEX(id2, "_QM_") /= 0)
      66      106514 :             my_link = qmmm_ff_precond_only_link(id2) .OR. my_link
      67      106514 :             my_index = INDEX(id2, "_QM_") + LEN_TRIM("_QM_")
      68      106514 :             tmp = TRIM(id2(my_index:))
      69     8627634 :             clean_string_2: DO j = 1, default_string_length
      70     8627634 :                id2(j:j) = " "
      71             :             END DO clean_string_2
      72      106514 :             id2 = TRIM(tmp)
      73             :          END DO
      74             :       END IF
      75             : 
      76     3319747 :       IF (PRESENT(id3)) THEN
      77      498273 :          IF (INDEX(id3, "_QM_") == 0) only_qm = .FALSE.
      78      507093 :          DO WHILE (INDEX(id3, "_QM_") /= 0)
      79        8820 :             my_link = qmmm_ff_precond_only_link(id3) .OR. my_link
      80        8820 :             my_index = INDEX(id3, "_QM_") + LEN_TRIM("_QM_")
      81        8820 :             tmp = TRIM(id3(my_index:))
      82      714420 :             clean_string_3: DO j = 1, default_string_length
      83      714420 :                id3(j:j) = " "
      84             :             END DO clean_string_3
      85        8820 :             id3 = TRIM(tmp)
      86             :          END DO
      87             :       END IF
      88             : 
      89     3319747 :       IF (PRESENT(id4)) THEN
      90      174879 :          IF (INDEX(id4, "_QM_") == 0) only_qm = .FALSE.
      91      178397 :          DO WHILE (INDEX(id4, "_QM_") /= 0)
      92        3518 :             my_link = qmmm_ff_precond_only_link(id4) .OR. my_link
      93        3518 :             my_index = INDEX(id4, "_QM_") + LEN_TRIM("_QM_")
      94        3518 :             tmp = TRIM(id4(my_index:))
      95      284958 :             clean_string_4: DO j = 1, default_string_length
      96      284958 :                id4(j:j) = " "
      97             :             END DO clean_string_4
      98        3518 :             id4 = TRIM(tmp)
      99             :          END DO
     100             :       END IF
     101             : 
     102     3319747 :       IF (PRESENT(is_link)) is_link = my_link
     103             : 
     104     3319747 :    END FUNCTION qmmm_ff_precond_only_qm
     105             : 
     106             : ! **************************************************************************************************
     107             : !> \brief ...
     108             : !> \param id1 ...
     109             : !> \return ...
     110             : ! **************************************************************************************************
     111      179194 :    FUNCTION qmmm_ff_precond_only_link(id1) RESULT(is_link)
     112             :       CHARACTER(LEN=default_string_length), &
     113             :          INTENT(INOUT)                                   :: id1
     114             :       LOGICAL                                            :: is_link
     115             : 
     116             :       CHARACTER(LEN=default_string_length)               :: tmp
     117             :       INTEGER                                            :: j, my_index
     118             : 
     119      179194 :       is_link = .FALSE.
     120      214786 :       DO WHILE (INDEX(id1, "_LNK") /= 0)
     121       35592 :          my_index = INDEX(id1, "_LNK") + 1
     122       35592 :          my_index = INDEX(id1(my_index:), "_QM_") + my_index - 1
     123       35592 :          is_link = .TRUE.
     124       35592 :          tmp = TRIM(id1(my_index:))
     125     2882952 :          clean_string_1: DO j = 1, default_string_length
     126     2882952 :             id1(j:j) = " "
     127             :          END DO clean_string_1
     128       35592 :          id1 = TRIM(tmp)
     129             :       END DO
     130             : 
     131      179194 :    END FUNCTION qmmm_ff_precond_only_link
     132             : 
     133             : END MODULE qmmm_ff_fist

Generated by: LCOV version 1.15