LCOV - code coverage report
Current view: top level - src - mm_mapping_library.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 30 31 96.8 %
Date: 2024-11-21 06:45:46 Functions: 2 3 66.7 %

          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             : !> \brief Contains the mapping ATOM_KIND -> ELEMENT for the most
      10             : !>      common cases in CHARMM and AMBER
      11             : !>      This should avoid in most cases the need to provide the element
      12             : !>      column in the PDB if in the atom_name column of the PDB is provided
      13             : !>      instead the atom kind
      14             : !> \par History
      15             : !>      10.2006 created [tlaino]
      16             : !> \author Teodoro Laino
      17             : ! **************************************************************************************************
      18             : MODULE mm_mapping_library
      19             : 
      20             :    USE kinds,                           ONLY: default_string_length
      21             : #include "./base/base_uses.f90"
      22             : 
      23             :    IMPLICIT NONE
      24             :    PRIVATE
      25             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      26             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mm_mapping_library'
      27             : 
      28             : ! **************************************************************************************************
      29             :    TYPE ff_map_type
      30             :       CHARACTER(LEN=default_string_length), DIMENSION(:), POINTER :: kind => NULL()
      31             :       CHARACTER(LEN=default_string_length), DIMENSION(:), POINTER :: element => NULL()
      32             :    END TYPE ff_map_type
      33             : 
      34             :    TYPE(ff_map_type), POINTER, PUBLIC :: amber_map, &
      35             :                                          charmm_map, &
      36             :                                          gromos_map
      37             :    PUBLIC :: create_ff_map, &
      38             :              destroy_ff_map
      39             : CONTAINS
      40             : 
      41             : ! **************************************************************************************************
      42             : !> \brief Initialize arrays for mapping KINDS <-> ELEMENTS
      43             : !>      for major elements in AMBER and CHARMM
      44             : !> \param ff_type ...
      45             : !> \par History
      46             : !>      10.2006 created [tlaino]
      47             : !> \author Teodoro Laino
      48             : ! **************************************************************************************************
      49       28536 :    SUBROUTINE create_ff_map(ff_type)
      50             :       CHARACTER(LEN=*), INTENT(IN)                       :: ff_type
      51             : 
      52             :       INTEGER, PARAMETER                                 :: amb_imax = 66, chm_imax = 108, &
      53             :                                                             grm_imax = 22
      54             : 
      55        9512 :       SELECT CASE (ff_type)
      56             :       CASE ("AMBER")
      57        9512 :          ALLOCATE (amber_map)
      58             :          ! allocate substructures
      59        9512 :          ALLOCATE (amber_map%kind(amb_imax))
      60        9512 :          ALLOCATE (amber_map%element(amb_imax))
      61             : 
      62             :          amber_map%kind = (/ &
      63             :                           "BR", "C ", "CA", "CB", "CC", "CD", "CI", "CK", "CP", "CM", &
      64             :                           "CS", "CN", "CQ", "CR", "CT", "CV", "CW", "C*", "CX", "CY", &
      65             :                           "CZ", "CO", "TG", "2C", "3C", "C0", "F ", "H ", "HC", "HA", &
      66             :                           "HO", "HS", "HW", "HP", "HZ", "I ", "IM", "IP", "IB", "MG", &
      67             :                           "N ", "NA", "NB", "NC", "N*", "NT", "NY", "ND", "NL", "TN", &
      68             :                           "OA", "O ", "OW", "OH", "OD", "OS", "OP", "P ", "S ", "SH", &
      69      637304 :                           "CU", "FE", "Li", "K ", "Rb", "Cs"/)
      70             :          amber_map%element = (/ &
      71             :                              "Br", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", &
      72             :                              "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", &
      73             :                              "C ", "C ", "C ", "C ", "C ", "Ca", "F ", "H ", "H ", "H ", &
      74             :                              "H ", "H ", "H ", "H ", "H ", "I ", "Cl", "Na", "Na", "Mg", &
      75             :                              "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", &
      76             :                              "O ", "O ", "O ", "O ", "O ", "O ", "O ", "P ", "S ", "S ", &
      77      637304 :                              "Cu", "Fe", "Li", "K ", "Rb", "Cs"/)
      78             : 
      79             :       CASE ("CHARMM")
      80        9512 :          ALLOCATE (charmm_map)
      81             :          ! allocate substructures
      82        9512 :          ALLOCATE (charmm_map%kind(chm_imax))
      83        9512 :          ALLOCATE (charmm_map%element(chm_imax))
      84             : 
      85             :          charmm_map%kind = (/ &
      86             :                            "CA  ", "CAL ", "C   ", "CC  ", "CD  ", "CE  ", "CEL ", "CES ", "CLA ", "CL  ", &
      87             :                            "CM  ", "CN1A", "CN1T", "CN3A", "CN3B", "CN3C", "CN3D", "CN3T", "CN5G", "CN7B", &
      88             :                            "CN7C", "CN7D", "CN8B", "CNA ", "CN  ", "CNE ", "CPA ", "CPB ", "CP  ", "CPH ", &
      89             :                            "CPM ", "CPT ", "CS  ", "CT  ", "CTL ", "CY  ", "DUM ", "FE  ", "FNA ", "FN  ", &
      90             :                            "HA  ", "HAL ", "HB  ", "HC  ", "HCL ", "HE  ", "HE  ", "HEL ", "H   ", "HL  ", &
      91             :                            "HN3B", "HN3C", "HNE ", "HN  ", "HNP ", "HOL ", "HP  ", "HR  ", "HS  ", "HT  ", &
      92             :                            "MG  ", "NC  ", "NE  ", "NH3L", "NH  ", "N   ", "NN1C", "NN2B", "NN2C", "NN2G", &
      93             :                            "NN2U", "NN3A", "NN3G", "NN3I", "NN  ", "NPH ", "NP  ", "NR  ", "NR  ", "NTL ", &
      94             :                            "NY  ", "O2L ", "OBL ", "OB  ", "OCL ", "OC  ", "OHL ", "OH  ", "OM  ", "ON1C", &
      95             :                            "ON2b", "ON6B", "ON  ", "O   ", "OSL ", "OS  ", "OT  ", "P2  ", "PL  ", "POT ", &
      96     1036808 :                            "P   ", "SL  ", "SM  ", "SOD ", "S   ", "SS  ", "ZN  ", "CN6B"/)
      97             : 
      98             :          charmm_map%element = (/ &
      99             :                               "C ", "Ca", "C ", "C ", "C ", "C ", "C ", "Cs", "Cl", "C ", &
     100             :                               "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", &
     101             :                               "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", "C ", &
     102             :                               "C ", "C ", "C ", "C ", "C ", "C ", "H ", "Fe", "F ", "F ", &
     103             :                               "H ", "H ", "H ", "H ", "H ", "H ", "He", "H ", "H ", "H ", &
     104             :                               "H ", "H ", "H ", "H ", "H ", "H ", "H ", "H ", "H ", "H ", &
     105             :                               "Mg", "N ", "Ne", "N ", "N ", "N ", "N ", "N ", "N ", "N ", &
     106             :                               "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", "N ", &
     107             :                               "N ", "O ", "O ", "O ", "O ", "O ", "O ", "O ", "O ", "O ", &
     108             :                               "O ", "O ", "O ", "O ", "O ", "O ", "O ", "P ", "P ", "K ", &
     109     1036808 :                               "P ", "S ", "S ", "Na", "S ", "S ", "Zn", "C "/)
     110             : 
     111             :       CASE ("GROMOS")
     112        9512 :          ALLOCATE (gromos_map)
     113             :          ! allocate substructures
     114        9512 :          ALLOCATE (gromos_map%kind(grm_imax))
     115        9512 :          ALLOCATE (gromos_map%element(grm_imax))
     116             : 
     117             :          gromos_map%kind = (/ &
     118             :                            "H1  ", "CA  ", "HA  ", "SD  ", "OG  ", "CG  ", "HD  ", "SG  ", &
     119             :                            "CZ  ", "OH  ", "C2  ", "H8  ", "O4* ", "O5* ", "PA  ", "O1A ", &
     120      218776 :                            "MG  ", "Na  ", "Cl  ", "OW  ", "HW  ", "HW  "/)
     121             : 
     122             :          gromos_map%element = (/ &
     123             :                               "H ", "C ", "H ", "S ", "O ", "C ", "H ", "S ", &
     124             :                               "C ", "O ", "C ", "H ", "O ", "O ", "P ", "O ", &
     125      247312 :                               "Mg", "Na", "Cl", "O ", "H ", "H "/)
     126             : 
     127             :       END SELECT
     128             : 
     129       28536 :    END SUBROUTINE create_ff_map
     130             : 
     131             : ! **************************************************************************************************
     132             : !> \brief Deallocates the arrays used for mapping
     133             : !> \param ff_type ...
     134             : !> \par History
     135             : !>      10.2006 created [tlaino]
     136             : !> \author Teodoro Laino
     137             : ! **************************************************************************************************
     138       28536 :    SUBROUTINE destroy_ff_map(ff_type)
     139             :       CHARACTER(LEN=*), INTENT(IN)                       :: ff_type
     140             : 
     141        9512 :       SELECT CASE (ff_type)
     142             :       CASE ("AMBER")
     143             :          ! deallocate substructures
     144        9512 :          DEALLOCATE (amber_map%kind)
     145        9512 :          DEALLOCATE (amber_map%element)
     146             :          ! deallocate main
     147        9512 :          DEALLOCATE (amber_map)
     148             :       CASE ("CHARMM")
     149             :          ! deallocate substructures
     150        9512 :          DEALLOCATE (charmm_map%kind)
     151        9512 :          DEALLOCATE (charmm_map%element)
     152             :          ! deallocate main
     153        9512 :          DEALLOCATE (charmm_map)
     154             :       CASE ("GROMOS")
     155             :          ! deallocate substructures
     156        9512 :          DEALLOCATE (gromos_map%kind)
     157        9512 :          DEALLOCATE (gromos_map%element)
     158             :          ! deallocate main
     159       38048 :          DEALLOCATE (gromos_map)
     160             :       END SELECT
     161       28536 :    END SUBROUTINE destroy_ff_map
     162             : 
     163           0 : END MODULE mm_mapping_library

Generated by: LCOV version 1.15