ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/simulation_module.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/simulation_module.F90 (file contents):
Revision 460 by chuckv, Fri Apr 4 22:22:30 2003 UTC vs.
Revision 491 by mmeineke, Fri Apr 11 18:46:37 2003 UTC

# Line 20 | Line 20 | module simulation
20  
21    logical, save :: simulation_setup_complete = .false.
22  
23 <  integer, public, save :: natoms
23 >  integer, public, save :: nLocal, nGlobal
24    integer, public, save :: nExcludes_Global = 0
25    integer, public, save :: nExcludes_Local = 0
26    integer, allocatable, dimension(:,:), public :: excludesLocal
27    integer, allocatable, dimension(:), public :: excludesGlobal
28 +  integer, allocatable, dimension(:), public :: molMembershipList
29  
30    real(kind=dp), save :: rcut2 = 0.0_DP
31    real(kind=dp), save :: rcut6 = 0.0_DP
# Line 66 | Line 67 | contains
67    
68   contains
69    
70 <  subroutine SimulationSetup(setThisSim, nComponents, c_idents, &
70 >  subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, &
71         CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, &
72 +       CmolMembership, &
73         status)    
74  
75      type (simtype) :: setThisSim
76 <    integer, intent(inout) :: nComponents
77 <    integer, dimension(nComponents),intent(inout) :: c_idents
76 >    integer, intent(inout) :: CnGlobal, CnLocal
77 >    integer, dimension(CnLocal),intent(inout) :: c_idents
78  
79      integer :: CnLocalExcludes
80      integer, dimension(2,CnLocalExcludes), intent(in) :: CexcludesLocal
81      integer :: CnGlobalExcludes
82      integer, dimension(CnGlobalExcludes), intent(in) :: CexcludesGlobal
83 +    integer, dimension(CnGlobal),intent(in) :: CmolMembership
84      !!  Result status, success = 0, status = -1
85      integer, intent(out) :: status
86      integer :: i, me, thisStat, alloc_stat, myNode
# Line 92 | Line 95 | contains
95      status = 0
96  
97      ! copy C struct into fortran type
98 +
99 +    nLocal = CnLocal
100 +    nGlobal = CnGlobal
101 +
102      thisSim = setThisSim
96    natoms = nComponents
103      rcut2 = thisSim%rcut * thisSim%rcut
104      rcut6 = rcut2 * rcut2 * rcut2
105      rlist2 = thisSim%rlist * thisSim%rlist
# Line 102 | Line 108 | contains
108      nExcludes_Global = CnGlobalExcludes
109      nExcludes_Local = CnLocalExcludes
110  
111 <    call InitializeForceGlobals(natoms, thisStat)
111 >    call InitializeForceGlobals(nLocal, thisStat)
112      if (thisStat /= 0) then
113 +       write(default_error,*) "SimSetup: InitializeForceGlobals error"
114         status = -1
115         return
116      endif
117  
118      call InitializeSimGlobals(thisStat)
119      if (thisStat /= 0) then
120 +       write(default_error,*) "SimSetup: InitializeSimGlobals error"
121         status = -1
122         return
123      endif
# Line 159 | Line 167 | contains
167      endif
168      
169   #else
170 <    do i = 1, nComponents
170 >    do i = 1, nLocal
171        
172         me = getFirstMatchingElement(atypes, "c_ident", c_idents(i))
173         atid(i) = me
# Line 167 | Line 175 | contains
175      enddo
176   #endif
177  
170    !! Create neighbor lists
171    call expandNeighborList(nComponents, thisStat)
172    if (thisStat /= 0) then
173       status = -1
174       return
175    endif
178  
179  
180      do i = 1, nExcludes_Local
# Line 184 | Line 186 | contains
186         excludesGlobal(i) = CexcludesGlobal(i)
187      enddo
188  
189 +    do i = 1, nGlobal
190 +       molMemberShipList(i) = CmolMembership(i)
191 +     enddo
192 +
193      if (status == 0) simulation_setup_complete = .true.
194      
195    end subroutine SimulationSetup
# Line 348 | Line 354 | contains
354         thisStat = -1
355         return
356      endif
357 +
358 +    allocate(molMembershipList(nGlobal), stat=alloc_stat)
359 +    if (alloc_stat /= 0 ) then
360 +       thisStat = -1
361 +       return
362 +    endif
363      
364    end subroutine InitializeSimGlobals
365    
366    subroutine FreeSimGlobals()
367      
368      !We free in the opposite order in which we allocate in.
369 <    
369 >
370 >    if (allocated(molMembershipList)) deallocate(molMembershipList)    
371      if (allocated(excludesGlobal)) deallocate(excludesGlobal)
372      if (allocated(excludesLocal)) deallocate(excludesLocal)
373  
374    end subroutine FreeSimGlobals
375  
376 <  pure function getNlocal() result(nlocal)
377 <    integer :: nlocal
378 <    nlocal = natoms
376 >  pure function getNlocal() result(n)
377 >    integer :: n
378 >    n = nLocal
379    end function getNlocal
380  
381    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines