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 Basic container type for QM/MM with force mixing. 10 : !> \author Ole Schuett 11 : ! ************************************************************************************************** 12 : MODULE qmmmx_types 13 : USE cp_subsys_types, ONLY: cp_subsys_type 14 : USE kinds, ONLY: dp 15 : USE qmmm_types, ONLY: qmmm_env_get,& 16 : qmmm_env_release,& 17 : qmmm_env_type 18 : #include "./base/base_uses.f90" 19 : 20 : IMPLICIT NONE 21 : PRIVATE 22 : 23 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qmmmx_types' 24 : 25 : PUBLIC :: qmmmx_env_type, qmmmx_env_get, qmmmx_env_release 26 : 27 : TYPE qmmmx_env_type 28 : TYPE(qmmm_env_type), POINTER :: core => Null() 29 : TYPE(qmmm_env_type), POINTER :: ext => Null() 30 : END TYPE qmmmx_env_type 31 : 32 : CONTAINS 33 : 34 : ! ************************************************************************************************** 35 : !> \brief ... 36 : !> \param qmmmx_env ... 37 : !> \param subsys ... 38 : !> \param potential_energy ... 39 : !> \param kinetic_energy ... 40 : ! ************************************************************************************************** 41 1542 : SUBROUTINE qmmmx_env_get(qmmmx_env, subsys, potential_energy, kinetic_energy) 42 : TYPE(qmmmx_env_type), INTENT(IN) :: qmmmx_env 43 : TYPE(cp_subsys_type), OPTIONAL, POINTER :: subsys 44 : REAL(KIND=dp), INTENT(OUT), OPTIONAL :: potential_energy, kinetic_energy 45 : 46 : ! get the underlying energies from primary subsys. This is the only subsys 47 : ! for conventional QM/MM, and force-mixing knows to put relevant energy there. 48 : CALL qmmm_env_get(qmmmx_env%ext, & 49 : kinetic_energy=kinetic_energy, & 50 : potential_energy=potential_energy, & 51 1542 : subsys=subsys) 52 : 53 1542 : END SUBROUTINE qmmmx_env_get 54 : 55 : ! ************************************************************************************************** 56 : !> \brief releases the given qmmmx_env (see doc/ReferenceCounting.html) 57 : !> \param qmmmx_env the object to release 58 : !> \author Ole Schuett 59 : ! ************************************************************************************************** 60 30 : SUBROUTINE qmmmx_env_release(qmmmx_env) 61 : TYPE(qmmmx_env_type), INTENT(INOUT) :: qmmmx_env 62 : 63 30 : CALL qmmm_env_release(qmmmx_env%core) 64 30 : DEALLOCATE (qmmmx_env%core) 65 30 : CALL qmmm_env_release(qmmmx_env%ext) 66 30 : DEALLOCATE (qmmmx_env%ext) 67 : 68 30 : END SUBROUTINE qmmmx_env_release 69 : 70 0 : END MODULE qmmmx_types