--- trunk/OOPSE/libmdtools/simulation_module.F90 2003/04/11 18:46:37 491 +++ trunk/OOPSE/libmdtools/simulation_module.F90 2003/07/23 22:13:59 648 @@ -27,22 +27,12 @@ module simulation integer, allocatable, dimension(:), public :: excludesGlobal integer, allocatable, dimension(:), public :: molMembershipList - real(kind=dp), save :: rcut2 = 0.0_DP - real(kind=dp), save :: rcut6 = 0.0_DP - real(kind=dp), save :: rlist2 = 0.0_DP - real(kind=dp), public, dimension(3), save :: box - + real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv + logical, public, save :: boxIsOrthorhombic public :: SimulationSetup public :: getNlocal public :: setBox - public :: setBox_3d - public :: getBox - public :: setRcut - public :: getRcut - public :: getRlist - public :: getRrf - public :: getRt public :: getDielect public :: SimUsesPBC public :: SimUsesLJ @@ -54,17 +44,7 @@ module simulation public :: SimRequiresPrepairCalc public :: SimRequiresPostpairCalc public :: SimUsesDirectionalAtoms - - interface getBox - module procedure getBox_3d - module procedure getBox_1d - end interface - interface setBox - module procedure setBox_3d - module procedure setBox_1d - end interface - contains subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & @@ -100,10 +80,6 @@ contains nGlobal = CnGlobal thisSim = setThisSim - rcut2 = thisSim%rcut * thisSim%rcut - rcut6 = rcut2 * rcut2 * rcut2 - rlist2 = thisSim%rlist * thisSim%rlist - box = thisSim%box nExcludes_Global = CnGlobalExcludes nExcludes_Local = CnLocalExcludes @@ -166,17 +142,19 @@ contains deallocate(c_idents_Row) endif -#else +#endif + +! We build the local atid's for both mpi and nonmpi do i = 1, nLocal me = getFirstMatchingElement(atypes, "c_ident", c_idents(i)) atid(i) = me enddo -#endif + do i = 1, nExcludes_Local excludesLocal(1,i) = CexcludesLocal(1,i) excludesLocal(2,i) = CexcludesLocal(2,i) @@ -194,91 +172,22 @@ contains end subroutine SimulationSetup - subroutine setBox_3d(new_box_size) - real(kind=dp), dimension(3) :: new_box_size + subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) + real(kind=dp), dimension(3,3) :: cHmat, cHmatInv + integer :: cBoxIsOrthorhombic integer :: smallest, status, i - - thisSim%box = new_box_size - box = thisSim%box - + + Hmat = cHmat + HmatInv = cHmatInv + if (cBoxIsOrthorhombic .eq. 0 ) then + boxIsOrthorhombic = .false. + else + boxIsOrthorhombic = .true. + endif + return - end subroutine setBox_3d - - subroutine setBox_1d(dim, new_box_size) - integer :: dim, status - real(kind=dp) :: new_box_size - thisSim%box(dim) = new_box_size - box(dim) = thisSim%box(dim) - end subroutine setBox_1d - - subroutine setRcut(new_rcut, status) - real(kind = dp) :: new_rcut - integer :: myStatus, status - thisSim%rcut = new_rcut - rcut2 = thisSim%rcut * thisSim%rcut - rcut6 = rcut2 * rcut2 * rcut2 - status = 0 - return - end subroutine setRcut + end subroutine setBox - function getBox_3d() result(thisBox) - real( kind = dp ), dimension(3) :: thisBox - thisBox = thisSim%box - end function getBox_3d - - function getBox_1d(dim) result(thisBox) - integer, intent(in) :: dim - real( kind = dp ) :: thisBox - - thisBox = thisSim%box(dim) - end function getBox_1d - - subroutine getRcut(thisrcut,rc2,rc6,status) - real( kind = dp ), intent(out) :: thisrcut - real( kind = dp ), intent(out), optional :: rc2 - real( kind = dp ), intent(out), optional :: rc6 - integer, optional :: status - - if (present(status)) status = 0 - - if (.not.simulation_setup_complete ) then - if (present(status)) status = -1 - return - end if - - thisrcut = thisSim%rcut - if(present(rc2)) rc2 = rcut2 - if(present(rc6)) rc6 = rcut6 - end subroutine getRcut - - subroutine getRlist(thisrlist,rl2,status) - real( kind = dp ), intent(out) :: thisrlist - real( kind = dp ), intent(out), optional :: rl2 - - integer, optional :: status - - if (present(status)) status = 0 - - if (.not.simulation_setup_complete ) then - if (present(status)) status = -1 - return - end if - - thisrlist = thisSim%rlist - if(present(rl2)) rl2 = rlist2 - end subroutine getRlist - - function getRrf() result(rrf) - real( kind = dp ) :: rrf - rrf = thisSim%rrf - write(*,*) 'getRrf = ', rrf, thisSim%rrf - end function getRrf - - function getRt() result(rt) - real( kind = dp ) :: rt - rt = thisSim%rt - end function getRt - function getDielect() result(dielect) real( kind = dp ) :: dielect dielect = thisSim%dielect