--- trunk/OOPSE/libmdtools/notifyCutoffs.F90 2004/05/07 21:35:05 1150 +++ trunk/OOPSE/libmdtools/notifyCutoffs.F90 2004/06/04 14:59:27 1239 @@ -2,51 +2,75 @@ module notifyCutoffs use definitions use do_Forces, only: setRlistDF - use charge_charge, only: setCutoffsCharge - use dipole_dipole, only: setCutoffsDipole use reaction_field, only: setCutoffsRF use lj, only: setCutoffLJ use eam, only: setCutoffEAM use switcheroo, only: set_switch + use status implicit none PRIVATE + character(len = statusMsgSize) :: errMsg + #define __FORTRAN90 #include "fSwitchingFunction.h" - - public::cutoffNotify - contains + public::cutoffNotify + +contains + + subroutine cutoffNotify( this_rcut, this_rsw, this_rlist ) - subroutine cutoffNotify( this_rcut, this_rlist, this_ecr, this_est ) + real(kind=dp), intent(in) :: this_rcut, this_rsw, this_rlist + + real(kind=dp) :: rsw, rcut, rlist + integer :: localError + logical :: do_shift + + rcut = this_rcut + rsw = this_rsw + rlist = this_rlist + + if (rcut .lt. rsw) then + + write(errMsg, *) 'cutoffRadius is ', rcut, newline // tab, & + 'but switchingRadius is set larger at ', rsw , newline // tab, & + 'That is probably not what you wanted to do!' + + call handleWarning("cutoffNotify", errMsg) + + endif - real(kind=dp), intent(in) :: this_rcut, this_rlist, this_ecr, this_est + if (rlist .lt. rcut) then + + write(errMsg, *) 'neighborListRadius is ', rlist, newline & + // tab, 'but cutoffRadius is set larger at ', rcut , newline & + // tab, 'That is probably a programming error!' + + call handleWarning("cutoffNotify", errMsg) + + endif + + do_shift = .false. + if (abs(rcut-rsw) .lt. 0.0001) then - real(kind=dp) :: rtaper, rcut, rlist, ecr - integer :: localError - - rcut = this_rcut - rlist = this_rlist - ecr = this_ecr - rtaper = this_ecr - this_est + write(errMsg, *) 'cutoffRadius and switchingRadius', newline & + // tab, 'are set to the same value. OOPSE will use', newline & + // tab, 'shifted Lennard-Jones potentials instead of', newline & + // tab, 'switching functions.' - if ((rlist .lt. rcut) .or. (rlist .lt. ecr)) then - write(*,*) 'warning, rlist = ', rlist, ' but rcut, ecr = ', rcut, ecr - endif + call handleInfo("cutoffNotify", errMsg) - call setRlistDF( rlist ) - call setCutoffsCharge( ecr, rtaper ) - call setCutoffsDipole( ecr, rtaper ) - call setCutoffsRF( ecr, rtaper ) - call setCutoffLJ( rcut, localError ) - call setCutoffEAM(rcut, localError) + do_shift = .true. - if (ecr.gt.rcut) then - call set_switch(GROUP_SWITCH, rtaper, ecr) - else - call set_switch(GROUP_SWITCH, rcut, rcut) endif + + call setRlistDF( rlist ) + call setCutoffsRF( rcut, rsw ) + call setCutoffLJ( rcut, do_shift, localError ) + call setCutoffEAM( rcut, localError) + call set_switch(GROUP_SWITCH, rsw, rcut) end subroutine cutoffNotify