--- trunk/OOPSE/libmdtools/simulation_module.F90 2003/04/11 15:16:59 490 +++ trunk/OOPSE/libmdtools/simulation_module.F90 2003/04/11 18:46:37 491 @@ -20,7 +20,7 @@ module simulation logical, save :: simulation_setup_complete = .false. - integer, public, save :: natoms + integer, public, save :: nLocal, nGlobal integer, public, save :: nExcludes_Global = 0 integer, public, save :: nExcludes_Local = 0 integer, allocatable, dimension(:,:), public :: excludesLocal @@ -67,20 +67,20 @@ contains contains - subroutine SimulationSetup(setThisSim, nGlobal, nLocal, c_idents, & + subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & CmolMembership, & status) type (simtype) :: setThisSim - integer, intent(inout) :: nGlobal, nLocal - integer, dimension(nLocal),intent(inout) :: c_idents + integer, intent(inout) :: CnGlobal, CnLocal + integer, dimension(CnLocal),intent(inout) :: c_idents integer :: CnLocalExcludes integer, dimension(2,CnLocalExcludes), intent(in) :: CexcludesLocal integer :: CnGlobalExcludes integer, dimension(CnGlobalExcludes), intent(in) :: CexcludesGlobal - integer, dimension(nGlobal),intent(in) :: CmolMembership + integer, dimension(CnGlobal),intent(in) :: CmolMembership !! Result status, success = 0, status = -1 integer, intent(out) :: status integer :: i, me, thisStat, alloc_stat, myNode @@ -95,8 +95,11 @@ contains status = 0 ! copy C struct into fortran type + + nLocal = CnLocal + nGlobal = CnGlobal + thisSim = setThisSim - natoms = nLocal rcut2 = thisSim%rcut * thisSim%rcut rcut6 = rcut2 * rcut2 * rcut2 rlist2 = thisSim%rlist * thisSim%rlist @@ -105,7 +108,7 @@ contains nExcludes_Global = CnGlobalExcludes nExcludes_Local = CnLocalExcludes - call InitializeForceGlobals(natoms, thisStat) + call InitializeForceGlobals(nLocal, thisStat) if (thisStat /= 0) then write(default_error,*) "SimSetup: InitializeForceGlobals error" status = -1 @@ -185,8 +188,7 @@ contains do i = 1, nGlobal molMemberShipList(i) = CmolMembership(i) - ! write(0,*) 'molMembershipList(',i,') = ', molMemberShipList(i) - enddo + enddo if (status == 0) simulation_setup_complete = .true. @@ -353,7 +355,7 @@ contains return endif - allocate(molMembershipList(getNlocal()), stat=alloc_stat) + allocate(molMembershipList(nGlobal), stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return @@ -371,9 +373,9 @@ contains end subroutine FreeSimGlobals - pure function getNlocal() result(nlocal) - integer :: nlocal - nlocal = natoms + pure function getNlocal() result(n) + integer :: n + n = nLocal end function getNlocal