Index: source/openmm/omm_ctrl.src =================================================================== --- source/openmm/omm_ctrl.src (revision 369) +++ source/openmm/omm_ctrl.src (working copy) @@ -12,7 +12,8 @@ !> or was preceded by an OMM ON command, otherwise false. logical function omm_requested(comlyn, comlen, caller) use string, only: INDXA - + implicit none + character(len=*), intent(in) :: comlyn integer, intent(in) :: comlen character(len=*), intent(in) :: caller @@ -39,6 +40,8 @@ use omm_main, only: teardown_openmm, serialize use omm_gbsa, only : qgbsa, soluteEPS, solventEPS #endif + implicit none + character(len=*), intent(inout) :: comlyn integer, intent(inout) :: comlen @@ -74,8 +77,9 @@ if (INDXA(comlyn, comlen, 'GBOFF') > 0) qgbsa = .false. if (INDXA(comlyn, comlen, 'GBON') > 0) qgbsa = .true. lommgb = qgbsa - case('NB ') cmds - call handle_nb(comlyn, comlen) +! case('NB ') cmds +! call wrndie(-4, '', & +! 'this binary does not support the Charmm Nonbonded plugin') end select cmds enddo @@ -100,6 +104,8 @@ #if KEY_GOMODEL==1 use inbnd, only: QETEN #endif + implicit none + character(len=*), intent(in) :: caller if (qRep) then @@ -109,33 +115,11 @@ !> To be called when atoms are added or deleted from the PSF. subroutine omm_system_changed() - use omm_main + use omm_main + implicit none #if KEY_OPENMM==1 call omm_invalidate() #endif end subroutine omm_system_changed - - subroutine handle_nb(comlyn, comlen) - use string, only: indxa - use omm_nbopts, only: use_nbplugin - - character(len=*), intent(inout) :: comlyn - integer, intent(inout) :: comlen - - if ( INDXA(comlyn, comlen, 'ON') > 0 ) then -#if KEY_NONBPLUGIN==1 - use_nbplugin = .false. - call wrndie(-4, '', & - 'this binary does not support the Charmm Nonbonded plugin') -#else - use_nbplugin = .true. -#endif - else if ( INDXA(comlyn, comlen, 'OFF') > 0 ) then - use_nbplugin = .false. - else - call wrndie(-4, '', & - 'bad/missing command; usage: omm nb on or omm nb off') - endif - end subroutine handle_nb end module omm_ctrl Index: source/openmm/omm_nbopts.src =================================================================== --- source/openmm/omm_nbopts.src (revision 369) +++ source/openmm/omm_nbopts.src (working copy) @@ -2,12 +2,6 @@ use chm_kinds implicit none -#if KEY_NONBPLUGIN==1 - logical, save, public :: use_nbplugin = .false. -#else - logical, save, public :: use_nbplugin = .true. -#endif - type, public :: omm_nbopts_t real(chm_real) :: rcut real(chm_real) :: switchdist @@ -34,7 +28,6 @@ logical :: use_omm_elec ! composite logical (see below) logical :: use_gbsaobc2 ! logical liked to OpenMM GBSAOBC2 logical :: use_block ! logical indicating block was called - logical :: use_nbplugin ! use CharmmNBForce or OpenMM_NonbondedF. end type omm_nbopts_t contains @@ -61,6 +54,7 @@ #if KEY_BLOCK==1 use block_ltm, only: qblock, nblckcalls #endif + implicit none ! TODO move fallback decls to inbnd #if KEY_LRVDW==0 @@ -69,7 +63,6 @@ #if KEY_GOMODEL==0 logical, parameter :: QETEN = .false. #endif - character(len=100) :: charmm_plugin_dir_name opts%alpha = KAPPA opts%kmax = [KMAXX, KMAXY, KMAXZ] @@ -124,14 +117,10 @@ opts%use_block = qblock opts%block_changed = nblckcalls #endif - - call getenv('CHARMM_PLUGIN_DIR', charmm_plugin_dir_name) - if(trim(charmm_plugin_dir_name) == '') use_nbplugin = .false. - opts%use_nbplugin = use_nbplugin - end function current_nbopts logical function same_nbopts(a, b) result(same) + implicit none type(omm_nbopts_t), intent(in) :: a, b real(chm_real), parameter :: NOCUT = 990.0 real(chm_real), parameter :: RTOL = 1.0d-3 @@ -175,8 +164,6 @@ same = same .and. (a%use_gbsaobc2 .eqv. b%use_gbsaobc2) same = same .and. (a%use_block .eqv. b%use_block) same = same .and. (a%block_changed == b%block_changed) - same = same .and. (a%use_nbplugin .eqv. b%use_nbplugin) end function same_nbopts - end module omm_nbopts Index: source/openmm/omm_nonbond.src =================================================================== --- source/openmm/omm_nonbond.src (revision 369) +++ source/openmm/omm_nonbond.src (working copy) @@ -30,15 +30,12 @@ use energym use bases_fcm, only : BNBND use block_ltm, only : QBLOCK + implicit none type(OpenMM_System), intent(inout) :: system + type(OpenMM_NonbondedForce) :: nonbond type(omm_nbopts_t), intent(in) :: nbopts - type(OpenMM_Force) :: nonbond - - type(OpenMM_NonbondedForce) :: omm_typed_nb - type(OMM_CharmmNBForce) :: chm_typed_nb - integer :: ijunk real*8 :: nb_cutoff @@ -47,27 +44,12 @@ use_omm_elec = nbopts%use_omm_elec use_omm_vdw = nbopts%use_omm_vdw - use_nbplugin = nbopts%use_nbplugin - if (nbopts%use_nbplugin) then - if(prnlev>=2) write(outu,'(a)') & - 'CHARMM> Using CHARMMM Plugin nb routines.' - call CharmmNB_create(chm_typed_nb) - nonbond = transfer(chm_typed_nb, OpenMM_Force(0)) - if(use_omm_elec) then - call CharmmNB_setReactionFieldDielectric( & - chm_typed_nb, nbopts%rf_diel) - endif - else - if(prnlev>=2) write(outu,'(a)') & - 'CHARMM> Using OpenMM nb routines.' - call OpenMM_NonbondedForce_create(omm_typed_nb) - nonbond = transfer(omm_typed_nb, OpenMM_Force(0)) - if(use_omm_elec) then - call OpenMM_NonbondedForce_setReactionFieldDielectric( & - omm_typed_nb, nbopts%rf_diel) - endif - endif + if (prnlev>=2) write(outu,'(a)') 'CHARMM> Using OpenMM nb routines.' + call OpenMM_NonbondedForce_create(nonbond) + + if (use_omm_elec) & + call OpenMM_NonbondedForce_setReactionFieldDielectric(nonbond, nbopts%rf_diel) nb_cutoff = nbopts%rcut / OpenMM_AngstromsPerNm if (nbopts%periodic) then @@ -75,18 +57,17 @@ else call setup_nonperiodic(system, nonbond, nb_cutoff, nbopts) endif - ijunk = OpenMM_System_addForce(system, nonbond) + ijunk = OpenMM_System_addForce(system, transfer(nonbond, OpenMM_Force(0))) - call nb_add_particles(nonbond, nbopts) + call nb_add_particles(nonbond) if (use_omm_vdw) call nb_set_fixes(system, nbopts) - call nb_set_exclusions(nonbond, nbopts, BNBND%INB14, BNBND%IBLO14) + call nb_set_exclusions(nonbond, BNBND%INB14, BNBND%IBLO14) #if KEY_BLOCK==1 - if (qblock) then - call blockscale_intrablock(nonbond, nbopts, BNBND%INB14, BNBND%IBLO14) - endif + if (qblock) & + call blockscale_intrablock(nonbond, BNBND%INB14, BNBND%IBLO14) #endif - ! This is a debug statement. Please leave for the time being. -! call show_NBParams(nonbond, nbopts) +! This is a debug statement. Please leave for the time being. +! call show_NBParams(nonbond) end subroutine setup_nonbonded !> Returns a factor by which to scale a product of two charges, @@ -102,12 +83,11 @@ end function charge_scale !> Sets charges and vdW parameters for each atom. - subroutine nb_add_particles(nonbond, nbopts) + subroutine nb_add_particles(nonbond) use psf, only: NATOM - use omm_nbopts, only: omm_nbopts_t + implicit none - type(OpenMM_Force), intent(inout) :: nonbond - type(omm_nbopts_t), intent(in) :: nbopts + type(OpenMM_NonbondedForce), intent(inout) :: nonbond real(chm_real) :: charge, sigma, epsln integer :: iatom, itc_i, ijunk @@ -126,15 +106,7 @@ epsln = ZERO endif ! "Particle Parameters" here are for single atoms - if (nbopts%use_nbplugin) then - ijunk = CharmmNB_addParticle( & - transfer(nonbond, OMM_CharmmNBForce(0)), & - charge, sigma, epsln) - else - ijunk = OpenMM_NonbondedForce_addParticle( & - transfer(nonbond, OpenMM_NonbondedForce(0)), & - charge, sigma, epsln) - endif + ijunk = OpenMM_NonbondedForce_addParticle(nonbond, charge, sigma, epsln) enddo end subroutine nb_add_particles @@ -172,15 +144,14 @@ end subroutine get_nb_params !> Sets all topology/residue based non-bond exclusions and 1-4 interactions - subroutine nb_set_exclusions(nonbond, nbopts, INB14, IBLO14) + subroutine nb_set_exclusions(nonbond, INB14, IBLO14) use psf, only: NATOM, CG, IAC, MAXATC use param, only: NATC, ITC, VDWR, EFF, NBFIXR use inbnd, only: E14FAC use omm_block, only : blockscale_nbpair - use omm_nbopts, only: omm_nbopts_t + implicit none - type(OpenMM_Force), intent(inout) :: nonbond - type(omm_nbopts_t), intent(in) :: nbopts + type(OpenMM_NonbondedForce), intent(inout) :: nonbond integer, intent(in) :: INB14(:), IBLO14(:) integer :: iatom, jatom @@ -248,20 +219,11 @@ scaleElec = ONE scalevdW = ONE endif - if (nbopts%use_nbplugin) then - ijunk = CharmmNB_addException( & - transfer(nonbond, OMM_CharmmNBForce(0)), & - iatom-1, jatom-1, scaleElec * charge_prod, sigma, & - scalevdW*epsln, OpenMM_TRUE) - else - ijunk = OpenMM_NonbondedForce_addException( & - transfer(nonbond, OpenMM_NonbondedForce(0)), & - iatom-1, jatom-1, scaleElec * charge_prod, sigma, & - scalevdW*epsln, OpenMM_TRUE) - endif - if(prnlev>=6) write(OUTU, & - '(a,1x,i4,1x,i4)') & - 'Exclusion - nb_set_exclusions' ,iatom, jatom + ijunk = OpenMM_NonbondedForce_addException(nonbond, & + iatom-1, jatom-1, scaleElec * charge_prod, sigma, & + scalevdW*epsln, OpenMM_TRUE) + if(prnlev>=6) write(OUTU, '(a,1x,i4,1x,i4)') & + 'Exclusion - nb_set_exclusions' ,iatom, jatom enddo enddo end subroutine nb_set_exclusions @@ -641,9 +603,11 @@ end subroutine get_nbfswitchedformula subroutine setup_nonperiodic(system, nonbond, rcut, nbopts) - use omm_nbopts + use omm_nbopts + implicit none + type(OpenMM_System), intent(inout) :: system - type(OpenMM_Force), intent(inout) :: nonbond + type(OpenMM_NonbondedForce), intent(inout) :: nonbond real*8, intent(in) :: rcut type(omm_nbopts_t), intent(in) :: nbopts @@ -651,9 +615,6 @@ integer*4 :: using_lrc, using_vdw_ommswit real*8 :: diel_rf - type(OMM_CharmmNBForce) :: chm_typed_nb - type(OpenMM_NonbondedForce) :: omm_typed_nb - if (rcut >= 99) then nb_method = OpenMM_NonbondedForce_NoCutoff if (PRNLEV >= 2) write (OUTU, '(X,A)') & @@ -670,54 +631,29 @@ if (nbopts%use_lrc) using_lrc = OpenMM_True using_vdw_ommswit = OpenMM_False - if(nbopts%use_vdw_ommswit .and. & - (nbopts%rcut > nbopts%switchdist)) & + if(nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist)) & using_lrc = OpenMM_True - if(nbopts%use_nbplugin) then - chm_typed_nb = transfer(nonbond, chm_typed_nb) - call CharmmNB_setNonbondedMethod( & - chm_typed_nb, nb_method) - ! Note we need to initalize cutoff regardless - call CharmmNB_setCutoffDistance( & - chm_typed_nb, rcut) - diel_rf = CharmmNB_getReactionFieldDielectric(chm_typed_nb) - call CharmmNB_setUseDispersionCorrection(chm_typed_nb, using_lrc) - if(nbopts%use_vdw_ommswit .and. & - (nbopts%rcut > nbopts%switchdist) ) then - call CharmmNB_setUseSwitchingFunction(chm_typed_nb, & - using_vdw_ommswit) - call CharmmNB_setSwitchingDistance(chm_typed_nb, & - nbopts%switchdist / OpenMM_AngstromsPerNm) - endif - else - omm_typed_nb = transfer(nonbond, omm_typed_nb) - call OpenMM_NonbondedForce_setNonbondedMethod(omm_typed_nb, nb_method) - call OpenMM_NonbondedForce_setCutoffDistance(omm_typed_nb, rcut) - diel_rf = OpenMM_NonbondedForce_getReactionFieldDielectric( & - omm_typed_nb) - call OpenMM_NonbondedForce_setUseDispersionCorrection( & - omm_typed_nb, using_lrc) - if(nbopts%use_vdw_ommswit .and. & - (nbopts%rcut > nbopts%switchdist) ) then - call OpenMM_NonbondedForce_setUseSwitchingFunction( & - omm_typed_nb, using_vdw_ommswit) - call OpenMM_NonbondedForce_setSwitchingDistance( & - omm_typed_nb, nbopts%switchdist / OpenMM_AngstromsPerNm ) - endif + call OpenMM_NonbondedForce_setNonbondedMethod(nonbond, nb_method) + call OpenMM_NonbondedForce_setCutoffDistance(nonbond, rcut) + diel_rf = OpenMM_NonbondedForce_getReactionFieldDielectric(nonbond) + call OpenMM_NonbondedForce_setUseDispersionCorrection(nonbond, using_lrc) + if (nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist)) then + call OpenMM_NonbondedForce_setUseSwitchingFunction(nonbond, using_vdw_ommswit) + call OpenMM_NonbondedForce_setSwitchingDistance(nonbond, & + nbopts%switchdist / OpenMM_AngstromsPerNm ) endif - if ((nb_method == OpenMM_NonbondedForce_CutoffNonPeriodic) .and. & - (PRNLEV >= 5)) & - write (OUTU, '(10X,A,F8.3)') & - 'Reaction field dielectric constant = ', diel_rf + if ((nb_method == OpenMM_NonbondedForce_CutoffNonPeriodic) .and. (PRNLEV >= 5)) & + write (OUTU, '(10X,A,F8.3)') 'Reaction field dielectric constant = ', diel_rf end subroutine setup_nonperiodic subroutine setup_periodic(system, nonbond, rcut, nbopts) use omm_nbopts + implicit none type(OpenMM_System), intent(inout) :: system - type(OpenMM_Force), intent(inout) :: nonbond + type(OpenMM_NonbondedForce), intent(inout) :: nonbond real*8, intent(in) :: rcut type(omm_nbopts_t), intent(in) :: nbopts @@ -728,15 +664,6 @@ real*8 :: box_a(3), box_b(3), box_c(3), box(3) integer*4 :: using_lrc, using_vdw_ommswit - type(OMM_CharmmNBForce) :: chm_typed_nb - type(OpenMM_NonbondedForce) :: omm_typed_nb - - if(nbopts%use_nbplugin) then - chm_typed_nb = transfer(nonbond, chm_typed_nb) - else - omm_typed_nb = transfer(nonbond, omm_typed_nb) - endif - if (nbopts%use_pme) then nb_method = OpenMM_NonbondedForce_PME if (PRNLEV >= 7) write (OUTU, '(X,A,/,10X,A)') & @@ -749,22 +676,16 @@ 'of the OpenMM documentation for details.' else !if(nbopts%use_elec_rxnfld) then nb_method = OpenMM_NonbondedForce_CutoffPeriodic - if (PRNLEV >= 7) write (OUTU, '(X,A,2(/,10X,A))') & + if (PRNLEV >= 7) then + write (OUTU, '(X,A,2(/,10X,A))') & 'Warning: Using OpenMM Cutoff method. This differs from', & 'CHARMM in that a reaction field approximation is used', & 'for the region outside the cutoff.' - if (PRNLEV >= 7) then - if(nbopts%use_nbplugin) then - rfd_const = OpenMM_NonbondedForce_getReactionFieldDielectric( & - omm_typed_nb) - else - rfd_const = CharmmNB_getReactionFieldDielectric(chm_typed_nb) - endif + rfd_const = OpenMM_NonbondedForce_getReactionFieldDielectric(nonbond) write (OUTU, '(10X,A,F8.3)') & 'CHARMM> Reaction field dielectric constant = ', rfd_const - endif - - endif + end if + end if box = nbopts%box / OpenMM_AngstromsPerNm box_a = ZERO @@ -785,165 +706,41 @@ if(nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist) ) & using_vdw_ommswit = OpenMM_True - if(nbopts%use_nbplugin) then - call CharmmNB_setNonbondedMethod(chm_typed_nb, nb_method) - call CharmmNB_setCutoffDistance(chm_typed_nb, rcut) - call CharmmNB_setUseDispersionCorrection(chm_typed_nb, using_lrc) + call OpenMM_NonbondedForce_setNonbondedMethod(nonbond, nb_method) + call OpenMM_NonbondedForce_setCutoffDistance(nonbond, rcut) + call OpenMM_NonbondedForce_setUseDispersionCorrection(nonbond, & + using_lrc) - if(nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist) ) then - call CharmmNB_setUseSwitchingFunction(chm_typed_nb, & - using_vdw_ommswit) - call CharmmNB_setSwitchingDistance(chm_typed_nb, & - nbopts%switchdist / OpenMM_AngstromsPerNm ) - endif + if(nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist) ) then + call OpenMM_NonbondedForce_setUseSwitchingFunction(nonbond, & + using_vdw_ommswit) + call OpenMM_NonbondedForce_setSwitchingDistance(nonbond, & + nbopts%switchdist / OpenMM_AngstromsPerNm ) + endif - if (nbopts%use_pme) then - if (prnlev >= 2) write(OUTU, '(a,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'CHARMM> configuring OpenMM PME with', & - ' alpha', omm_kappa / OpenMM_AngstromsPerNM, & - ' fft', nbopts%mesh_dim(1), & - nbopts%mesh_dim(2), nbopts%mesh_dim(3) - call CharmmNB_setPMEParams(chm_typed_nb, omm_kappa, & - nbopts%mesh_dim(1), nbopts%mesh_dim(2), nbopts%mesh_dim(3)) - else if (nbopts%use_ewald) then - if (prnlev >= 2) write(OUTU, '(a,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'CHARMM> configuring OpenMM Ewald with', & - ' alpha', omm_kappa / OpenMM_AngstromsPerNM, & - ' kmax', nbopts%kmax(1), & - nbopts%kmax(2), nbopts%kmax(3) - call CharmmNB_setEwaldParams(chm_typed_nb, omm_kappa, & - nbopts%kmax(1), nbopts%kmax(2), nbopts%kmax(3)) - else - return - endif - else - call OpenMM_NonbondedForce_setNonbondedMethod(omm_typed_nb, nb_method) - call OpenMM_NonbondedForce_setCutoffDistance(omm_typed_nb, rcut) - call OpenMM_NonbondedForce_setUseDispersionCorrection(omm_typed_nb, & - using_lrc) + if (nbopts%use_pme) then + if (prnlev >= 2) write(OUTU, '(a,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & + 'CHARMM> configuring OpenMM PME with', & + ' alpha', omm_kappa / OpenMM_AngstromsPerNM, & + ' fft', nbopts%mesh_dim(1), & + nbopts%mesh_dim(2), nbopts%mesh_dim(3) - if(nbopts%use_vdw_ommswit .and. (nbopts%rcut > nbopts%switchdist) ) then - call OpenMM_NonbondedForce_setUseSwitchingFunction(omm_typed_nb, & - using_vdw_ommswit) - call OpenMM_NonbondedForce_setSwitchingDistance(omm_typed_nb, & - nbopts%switchdist / OpenMM_AngstromsPerNm ) - endif + call OpenMM_NonbondedForce_setPMEParameters(nonbond, omm_kappa, & + nbopts%mesh_dim(1), nbopts%mesh_dim(2), nbopts%mesh_dim(3)) - if (nbopts%use_pme) then + if (prnlev >= 7) then openmm_tol = est_pme_tol(box, rcut, nbopts%mesh_dim) - call OpenMM_NonbondedForce_setEwaldErrorTolerance(omm_typed_nb, & - openmm_tol) - else if (nbopts%use_ewald) then - openmm_tol = est_ewald_tol(box, rcut) - call OpenMM_NonbondedForce_setEwaldErrorTolerance(omm_typed_nb, & - openmm_tol) - else - return - endif + write (OUTU,'(a,x,f10.4,/)') 'OpenMM Error Tolerance is', openmm_tol + end if + else if (nbopts%use_ewald) then + openmm_tol = est_ewald_tol(box, rcut) + call OpenMM_NonbondedForce_setEwaldErrorTolerance(nonbond, & + openmm_tol) + else + return endif - - ! For debugging we can print the original OpenMM Ewald/PME parameters - ! and compare those to what we use now (same as CHARMM) - if (nbopts%use_pme .and. (prnlev >= 7))then - call print_openmm_pme_info(system, nonbond, nbopts, box, rcut) - else if (nbopts%use_ewald .and. (prnlev >= 7))then - call print_openmm_ewald_info(system, nonbond, nbopts, box, rcut) - end if - - ! if (prnlev >= 2) write (OUTU, "(A, ES10.3)") & - ! ' Specifying OpenMM Ewald error tolerance ', openmm_tol - !call OpenMM_NonbondedForce_setEwaldErrorTolerance(nonbond, openmm_tol) - !if (nbopts%use_pme) then - ! duplicates NonbondedForceImpl::calcPMEParameters - ! if (PRNLEV >= 2) write (OUTU, "(' OpenMM will use KAPPA of ', es10.3,' A^(-1)')") & - ! sqrt(-log(Two*openmm_tol))/rcut/OpenMM_AngstromsPerNm - ! mesh_scale = Two*sqrt(-log(Two*openmm_tol))/rcut/(Three*(openmm_tol)**0.2) - ! if (PRNLEV >= 2) write (OUTU, '(a,/,a,3i6)') & - ! ' OpenMM nodes in PME mesh will be closest', & - ! ' product of 2, 3 and 5 to', & - ! max(5, ceiling(mesh_scale * box(1))), & - ! max(5, ceiling(mesh_scale * box(2))), & - ! max(5, ceiling(mesh_scale * box(3))) - !endif end subroutine setup_periodic - subroutine print_openmm_ewald_info(system, force, nbopts, box, rcut) - use omm_nbopts, only: omm_nbopts_t - - type(OpenMM_System), intent(in) :: system - type(OpenMM_Force), intent(in) :: force - type(omm_nbopts_t), intent(in) :: nbopts - real*8, intent(in) :: rcut, box(3) - - real*8 :: openmm_tol, old_kappa - integer:: old_kmax(3) - - real*8 :: new_kappa - integer:: new_kmax(3) - - type(OMM_CharmmNBForce) :: chm_typed_nb - chm_typed_nb = transfer(force, chm_typed_nb) - - openmm_tol = est_ewald_tol(box, rcut) - - if(nbopts%use_nbplugin) then - call CharmmNB_errorTolToEwaldParams(chm_typed_nb, system, openmm_tol, & - old_kappa, old_kmax(1), old_kmax(2), old_kmax(3)) - call CharmmNB_getEwaldParams(chm_typed_nb, new_kappa, & - new_kmax(1), new_kmax(2), new_kmax(3)) - write (OUTU,'(a,/,a,x,f10.4,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'Under the old regime', & - 'OpenMM Error Tolerance would have been', openmm_tol, & - 'old kappa', old_kappa, & - 'old kmax', old_kmax(1), old_kmax(2), old_kmax(3) - write (OUTU,'(a,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'Under the new regime', & - 'kappa', new_kappa, & - 'kmax', new_kmax(1), new_kmax(2), new_kmax(3) - else - write (OUTU,'(a,x,f10.4,/)') 'OpenMM Error Tolerance is', openmm_tol - endif - end subroutine print_openmm_ewald_info - - subroutine print_openmm_pme_info(system, force, nbopts, box, rcut) - use omm_nbopts, only: omm_nbopts_t - - type(OpenMM_System), intent(in) :: system - type(OpenMM_Force), intent(in) :: force - type(omm_nbopts_t), intent(in) :: nbopts - real*8, intent(in) :: box(3), rcut - - real*8 :: openmm_tol, old_kappa - integer:: old_fft(3) - - real*8 :: new_kappa - integer:: new_fft(3) - - type(OMM_CharmmNBForce) :: chm_typed_nb - chm_typed_nb = transfer(force, chm_typed_nb) - - openmm_tol = est_pme_tol(box, rcut, nbopts%mesh_dim) - - if(nbopts%use_nbplugin) then - call CharmmNB_errorTolToPMEParams(chm_typed_nb, system, openmm_tol, & - old_kappa, old_fft(1), old_fft(2), old_fft(3)) - call CharmmNB_getPMEParams(chm_typed_nb, new_kappa, & - new_fft(1), new_fft(2), new_fft(3)) - - write (OUTU,'(a,/,a,x,f10.4,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'Under the old regime', & - 'OpenMM Error Tolerance would have been', openmm_tol, & - 'old kappa', old_kappa, & - 'old fft', old_fft(1), old_fft(2), old_fft(3) - write (OUTU,'(a,/,a,x,f10.4,/,a,x,i4,x,i4,x,i4,/)') & - 'Under the new regime', & - 'kappa', new_kappa, & - 'fft', new_fft(1), new_fft(2), new_fft(3) - else - write (OUTU,'(a,x,f10.4,/)') 'OpenMM Error Tolerance is', openmm_tol - endif - end subroutine print_openmm_pme_info - ! Estimates a PME error tolerance (dimensionless) ! for OpenMM based on NFFT values from CHARMM input. ! Derived from NonbondedForceImpl::calcPMEParameters. @@ -1107,15 +904,15 @@ !> occupying blocks 2 and 3. We also assume blocks 2 and 3 are !> excluded from one another. This routine scales the interactions !> block 2 - block 2 and block 3 block - subroutine blockscale_intrablock(nonbond, nbopts, INB14, IBLO14) + subroutine blockscale_intrablock(nonbond, INB14, IBLO14) use omm_nbopts, only: omm_nbopts_t use omm_block, only : blocknumber, blockscale_nbpair use psf, only: NATOM, CG, IAC use param, only: ITC, VDWR, EFF use fast, only : LOWTP - - type(OpenMM_Force), intent(inout) :: nonbond - type(omm_nbopts_t), intent(in) :: nbopts + implicit none + + type(OpenMM_NonbondedForce), intent(inout) :: nonbond integer, intent(in) :: INB14(:), IBLO14(:) real(chm_real) :: charge, sigma, well_depth @@ -1167,17 +964,9 @@ endif call blockscale_nbpair(iatom, jatom, scaleElec, scalevdW) - if(nbopts%use_nbplugin) then - ipair0 = CharmmNB_addException( & - transfer(nonbond, OMM_CharmmNBForce(0)), & - iatom-1, jatom-1, scaleElec*charge, & - sigma, scalevdW*well_depth, OpenMM_TRUE) - else - ipair0 = OpenMM_NonbondedForce_addException( & - transfer(nonbond, OpenMM_NonbondedForce(0)), & - iatom-1, jatom-1, scaleElec*charge, & - sigma, scalevdW*well_depth, OpenMM_TRUE) - endif + ipair0 = OpenMM_NonbondedForce_addException(nonbond, & + iatom-1, jatom-1, scaleElec*charge, & + sigma, scalevdW*well_depth, OpenMM_TRUE) if(prnlev>6) write(OUTU, & '(a,i4,1x,i4,1x,i4,1x,i4,2x,f5.2,1x,f5.2,1x,f5.2)') & @@ -1230,23 +1019,22 @@ iend = BNBND%IBLO14(iatom) do ipair = istrt, iend Is14orExcl = Is14orExcl .or. (jatom == abs(BNBND%INB14(ipair))) - enddo - if(.not. Is14orExcl) then - + end do + if (.not. Is14orExcl) then ipair0 = OpenMM_CustomNonbondedForce_addExclusion(nonbond, & iatom-1, jatom-1 ) - if(prnlev>6) write(OUTU, & + if (prnlev>6) write(OUTU, & '(a,i4,1x,i4,1x,i4,1x,i4,2x,f5.2,1x,f5.2,1x,f5.2)') & ' Exclusion - block_intrablock_nbfixexcl: ' & , iatom, jatom, block_i, block_j if (ipair0 >= MAX_EXCEPTIONS) call wrndie(-3, & 'BLOCK_INTRABLOCK_NBFIXEXCL', & 'Too many nonbonded exceptions for OpenMM') - endif - endif - enddo - endif - enddo + end if + end if + end do + end if + end do #endif return end subroutine block_intrablock_nbfixexcl @@ -1254,31 +1042,21 @@ subroutine show_NBParams(nonbond, nbopts) use omm_nbopts, only: omm_nbopts_t use psf, only: NATOM + implicit none - type(OpenMM_Force), intent(in) :: nonbond + type(OpenMM_NonbondedForce), intent(in) :: nonbond type(omm_nbopts_t), intent(in) :: nbopts - type(OMM_CharmmNBForce) :: chm_typed_nb - type(OpenMM_NonbondedForce) :: omm_typed_nb - integer :: i real(chm_real) :: charge, sigma, epsilon - chm_typed_nb = transfer(nonbond, chm_typed_nb) - omm_typed_nb = transfer(nonbond, omm_typed_nb) - do i = 1, NATOM - if(nbopts%use_nbplugin) then - call CharmmNB_getParticleParameters(chm_typed_nb, i-1, & - charge,sigma, epsilon) - else - call OpenMM_NonbondedForce_getParticleParameters(omm_typed_nb, i-1, & - charge,sigma, epsilon) - endif - if(prnlev>6) write(OUTU, & + call OpenMM_NonbondedForce_getParticleParameters(nonbond, i-1, & + charge,sigma, epsilon) + if (prnlev>6) write(OUTU, & '(i4,2x,f5.2,1x,f5.2,1x,f5.2)') i, charge, & sigma*OpenMM_AngstromsPerNm, epsilon/OpenMM_KJPerKcal - enddo + end do return end subroutine show_NBParams #endif