ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/DarkSide/force_globals.F90
(Generate patch)

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/force_globals.F90 (file contents):
Revision 1930 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 2355 by chuckv, Wed Oct 12 18:59:16 2005 UTC

# Line 50 | Line 50 | module force_globals
50  
51    implicit none
52    PRIVATE
53 + #define __FORTRAN90
54 + #include "UseTheForce/DarkSide/fInteractionMap.h"
55  
56    logical, save :: force_globals_initialized = .false.
57  
# Line 62 | Line 64 | module force_globals
64    real( kind = dp ), allocatable, dimension(:,:), public :: eFrame_Col
65    real( kind = dp ), allocatable, dimension(:,:), public :: A_Row
66    real( kind = dp ), allocatable, dimension(:,:), public :: A_Col
67 <  
68 <  real( kind = dp ), allocatable, dimension(:), public :: pot_Row
69 <  real( kind = dp ), allocatable, dimension(:), public :: pot_Col
70 <  real( kind = dp ), allocatable, dimension(:), public :: pot_Temp
67 >
68 >  real( kind = dp ), allocatable, dimension(:,:), public :: pot_Row
69 >  real( kind = dp ), allocatable, dimension(:,:), public :: pot_Col
70 >  real( kind = dp ), allocatable, dimension(:,:), public :: pot_Temp
71    real( kind = dp ), allocatable, dimension(:,:), public :: f_Row
72    real( kind = dp ), allocatable, dimension(:,:), public :: f_Col
73    real( kind = dp ), allocatable, dimension(:,:), public :: f_Temp
# Line 85 | Line 87 | module force_globals
87    real( kind = dp ), allocatable, dimension(:,:), public :: rf
88    real(kind = dp), dimension(9), public :: tau_Temp = 0.0_dp
89    real(kind = dp), public :: virial_Temp = 0.0_dp
90 <  
90 >
91    public :: InitializeForceGlobals
92 <  
92 >
93   contains
94 <  
94 >
95    subroutine InitializeForceGlobals(nlocal, thisStat)
96      integer, intent(out) :: thisStat
97      integer :: nAtomsInRow, nAtomsInCol
# Line 97 | Line 99 | contains
99      integer :: nlocal
100      integer :: ndim = 3
101      integer :: alloc_stat
102 <    
102 >
103      thisStat = 0
104 <    
104 >
105   #ifdef IS_MPI
106      nAtomsInRow = getNatomsInRow(plan_atom_row)
107      nAtomsInCol = getNatomsInCol(plan_atom_col)
108      nGroupsInRow = getNgroupsInRow(plan_group_row)
109      nGroupsInCol = getNgroupsInCol(plan_group_col)
110 <    
110 >
111   #endif
112 <    
112 >
113      call FreeForceGlobals()
114 <    
114 >
115   #ifdef IS_MPI
116  
117      allocate(q_Row(ndim,nAtomsInRow),stat=alloc_stat)
# Line 117 | Line 119 | contains
119         thisStat = -1
120         return
121      endif
122 <        
122 >
123      allocate(q_Col(ndim,nAtomsInCol),stat=alloc_stat)
124      if (alloc_stat /= 0 ) then
125         thisStat = -1
# Line 129 | Line 131 | contains
131         thisStat = -1
132         return
133      endif
134 <        
134 >
135      allocate(q_group_Col(ndim,nGroupsInCol),stat=alloc_stat)
136      if (alloc_stat /= 0 ) then
137         thisStat = -1
138         return
139      endif
140 <      
140 >
141      allocate(eFrame_Row(9,nAtomsInRow),stat=alloc_stat)
142      if (alloc_stat /= 0 ) then
143         thisStat = -1
144         return
145      endif
146 <    
146 >
147      allocate(eFrame_Col(9,nAtomsInCol),stat=alloc_stat)
148      if (alloc_stat /= 0 ) then
149         thisStat = -1
150         return
151      endif
152 <    
152 >
153      allocate(A_row(9,nAtomsInRow),stat=alloc_stat)
154      if (alloc_stat /= 0 ) then
155         thisStat = -1
156         return
157      endif
158 <        
158 >
159      allocate(A_Col(9,nAtomsInCol),stat=alloc_stat)
160      if (alloc_stat /= 0 ) then
161         thisStat = -1
162         return
163      endif
164 <    
165 <    allocate(pot_row(nAtomsInRow),stat=alloc_stat)
164 >
165 >    allocate(pot_row(POT_ARRAY_SIZE,nAtomsInRow),stat=alloc_stat)
166      if (alloc_stat /= 0 ) then
167         thisStat = -1
168         return
169      endif
170 <    
171 <    allocate(pot_Col(nAtomsInCol),stat=alloc_stat)
170 >
171 >    allocate(pot_Col(POT_ARRAY_SIZE,nAtomsInCol),stat=alloc_stat)
172      if (alloc_stat /= 0 ) then
173         thisStat = -1
174         return
175      endif
176  
177 <    allocate(pot_Temp(nlocal),stat=alloc_stat)
177 >    allocate(pot_Temp(POT_ARRAY_SIZE,nlocal),stat=alloc_stat)
178      if (alloc_stat /= 0 ) then
179         thisStat = -1
180         return
181      endif
182 <    
182 >
183      allocate(f_Row(ndim,nAtomsInRow),stat=alloc_stat)
184      if (alloc_stat /= 0 ) then
185         thisStat = -1
186         return
187      endif
188 <    
188 >
189      allocate(f_Col(ndim,nAtomsInCol),stat=alloc_stat)
190      if (alloc_stat /= 0 ) then
191         thisStat = -1
192         return
193      endif
194 <    
194 >
195      allocate(f_Temp(ndim,nlocal),stat=alloc_stat)
196      if (alloc_stat /= 0 ) then
197         thisStat = -1
198         return
199      endif
200 <    
200 >
201      allocate(t_Row(ndim,nAtomsInRow),stat=alloc_stat)
202      if (alloc_stat /= 0 ) then
203         thisStat = -1
204         return
205      endif
206 <    
206 >
207      allocate(t_Col(ndim,nAtomsInCol),stat=alloc_stat)
208      if (alloc_stat /= 0 ) then
209         thisStat = -1
# Line 260 | Line 262 | contains
262      end if
263  
264   #endif
265 <    
265 >
266      allocate(rf(ndim,nlocal),stat=alloc_stat)
267      if (alloc_stat /= 0 ) then
268         thisStat = -1
# Line 270 | Line 272 | contains
272      force_globals_initialized = .true.
273  
274    end subroutine InitializeForceGlobals
275 <  
275 >
276    subroutine FreeForceGlobals()
277 <    
277 >
278      !We free in the opposite order in which we allocate in.
279 <    
279 >
280      if (allocated(rf))         deallocate(rf)
281   #ifdef IS_MPI
282      if (allocated(rf_Temp))    deallocate(rf_Temp)
# Line 303 | Line 305 | contains
305   #else    
306      if (allocated(atid))       deallocate(atid)    
307   #endif
308 <        
308 >
309    end subroutine FreeForceGlobals
310 <    
310 >
311   end module force_globals

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines