Performs all the memory allocation and vector initialization needed to run the openMMPol library
Allocation topology... ... and electrostatics
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_system), | intent(inout) | :: | sys_obj |
The object to be initialized |
||
integer(kind=ip), | intent(in) | :: | l_ff_type |
Force field type used in initialization |
||
integer(kind=ip), | intent(in) | :: | l_mm_atoms |
Number of MM atoms used in initialization |
||
integer(kind=ip), | intent(in) | :: | l_pol_atoms |
Number of polarizable atoms used in initialization |
subroutine mmpol_init(sys_obj, l_ff_type, l_mm_atoms, l_pol_atoms)
!! Performs all the memory allocation and vector initialization
!! needed to run the openMMPol library
use mod_constants, only: OMMP_FF_AMBER, OMMP_FF_AMOEBA, OMMP_FF_UNKNOWN
use mod_electrostatics, only: electrostatics_init
use mod_io, only: print_matrix, fatal_error
use mod_profiling, only: time_push, time_pull
implicit none
type(ommp_system), intent(inout) :: sys_obj
!! The object to be initialized
integer(ip), intent(in) :: l_ff_type
!! Force field type used in initialization
integer(ip), intent(in) :: l_mm_atoms
!! Number of MM atoms used in initialization
integer(ip), intent(in) :: l_pol_atoms
!! Number of polarizable atoms used in initialization
call time_push()
!! Allocation topology...
allocate(sys_obj%top)
!! ... and electrostatics
allocate(sys_obj%eel)
! FF related settings
if(l_ff_type == OMMP_FF_UNKNOWN) then
call fatal_error("Cannot initialize an UNKNOWN forcefield!")
end if
sys_obj%ff_type = l_ff_type
if(sys_obj%ff_type == OMMP_FF_AMOEBA) then
sys_obj%amoeba = .true.
else if(sys_obj%ff_type == OMMP_FF_AMBER) then
sys_obj%amoeba = .false.
end if
! Initialization of sub-modules:
! a. topology
call topology_init(sys_obj%top, l_mm_atoms)
! b. electrostatics
call electrostatics_init(sys_obj%eel, sys_obj%amoeba, l_pol_atoms, &
sys_obj%top)
! Everything is done
sys_obj%mmpol_is_init = .true.
call time_pull('MMPol object creation (mmpol_init)')
end subroutine mmpol_init