ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/DarkSide/force_globals.F90
Revision: 3470
Committed: Wed Oct 22 20:01:49 2008 UTC (17 years, 3 months ago) by gezelter
File size: 10233 byte(s)
Log Message:
General bug-fixes and other changes to make particle pots work with
the Helfand Energy correlation function

File Contents

# User Rev Content
1 gezelter 1930 !!
2     !! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3     !!
4     !! The University of Notre Dame grants you ("Licensee") a
5     !! non-exclusive, royalty free, license to use, modify and
6     !! redistribute this software in source and binary code form, provided
7     !! that the following conditions are met:
8     !!
9     !! 1. Acknowledgement of the program authors must be made in any
10     !! publication of scientific results based in part on use of the
11     !! program. An acceptable form of acknowledgement is citation of
12     !! the article in which the program was described (Matthew
13     !! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14     !! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15     !! Parallel Simulation Engine for Molecular Dynamics,"
16     !! J. Comput. Chem. 26, pp. 252-271 (2005))
17     !!
18     !! 2. Redistributions of source code must retain the above copyright
19     !! notice, this list of conditions and the following disclaimer.
20     !!
21     !! 3. Redistributions in binary form must reproduce the above copyright
22     !! notice, this list of conditions and the following disclaimer in the
23     !! documentation and/or other materials provided with the
24     !! distribution.
25     !!
26     !! This software is provided "AS IS," without a warranty of any
27     !! kind. All express or implied conditions, representations and
28     !! warranties, including any implied warranty of merchantability,
29     !! fitness for a particular purpose or non-infringement, are hereby
30     !! excluded. The University of Notre Dame and its licensors shall not
31     !! be liable for any damages suffered by licensee as a result of
32     !! using, modifying or distributing the software or its
33     !! derivatives. In no event will the University of Notre Dame or its
34     !! licensors be liable for any lost revenue, profit or data, or for
35     !! direct, indirect, special, consequential, incidental or punitive
36     !! damages, however caused and regardless of the theory of liability,
37     !! arising out of the use of or inability to use software, even if the
38     !! University of Notre Dame has been advised of the possibility of
39     !! such damages.
40     !!
41    
42    
43 gezelter 1490 ! Fortran interface to C entry plug.
44    
45     module force_globals
46     use definitions
47     #ifdef IS_MPI
48     use mpiSimulation
49     #endif
50    
51     implicit none
52     PRIVATE
53 chuckv 2355 #define __FORTRAN90
54     #include "UseTheForce/DarkSide/fInteractionMap.h"
55 gezelter 1490
56     logical, save :: force_globals_initialized = .false.
57    
58     #ifdef IS_MPI
59     real( kind = dp ), allocatable, dimension(:,:), public :: q_Row
60     real( kind = dp ), allocatable, dimension(:,:), public :: q_Col
61     real( kind = dp ), allocatable, dimension(:,:), public :: q_group_Row
62     real( kind = dp ), allocatable, dimension(:,:), public :: q_group_Col
63 gezelter 1930 real( kind = dp ), allocatable, dimension(:,:), public :: eFrame_Row
64     real( kind = dp ), allocatable, dimension(:,:), public :: eFrame_Col
65 gezelter 1490 real( kind = dp ), allocatable, dimension(:,:), public :: A_Row
66     real( kind = dp ), allocatable, dimension(:,:), public :: A_Col
67 gezelter 2204
68 chuckv 2355 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 gezelter 1490 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
74     real( kind = dp ), allocatable, dimension(:,:), public :: t_Row
75     real( kind = dp ), allocatable, dimension(:,:), public :: t_Col
76     real( kind = dp ), allocatable, dimension(:,:), public :: t_Temp
77     real( kind = dp ), allocatable, dimension(:,:), public :: rf_Row
78     real( kind = dp ), allocatable, dimension(:,:), public :: rf_Col
79     real( kind = dp ), allocatable, dimension(:,:), public :: rf_Temp
80 gezelter 3466 real( kind = dp ), allocatable, dimension(:), public :: ppot_Row
81     real( kind = dp ), allocatable, dimension(:), public :: ppot_Col
82     real( kind = dp ), allocatable, dimension(:), public :: ppot_Temp
83 gezelter 1490
84     integer, allocatable, dimension(:), public :: atid_Row
85     integer, allocatable, dimension(:), public :: atid_Col
86     #endif
87    
88     integer, allocatable, dimension(:), public :: atid
89    
90     real( kind = dp ), allocatable, dimension(:,:), public :: rf
91     real(kind = dp), dimension(9), public :: tau_Temp = 0.0_dp
92     real(kind = dp), public :: virial_Temp = 0.0_dp
93 gezelter 2204
94 gezelter 1490 public :: InitializeForceGlobals
95 gezelter 2204
96 gezelter 1490 contains
97 gezelter 2204
98 gezelter 1490 subroutine InitializeForceGlobals(nlocal, thisStat)
99     integer, intent(out) :: thisStat
100     integer :: nAtomsInRow, nAtomsInCol
101     integer :: nGroupsInRow, nGroupsInCol
102     integer :: nlocal
103     integer :: ndim = 3
104     integer :: alloc_stat
105 gezelter 2204
106 gezelter 1490 thisStat = 0
107 gezelter 2204
108 gezelter 1490 #ifdef IS_MPI
109     nAtomsInRow = getNatomsInRow(plan_atom_row)
110     nAtomsInCol = getNatomsInCol(plan_atom_col)
111     nGroupsInRow = getNgroupsInRow(plan_group_row)
112     nGroupsInCol = getNgroupsInCol(plan_group_col)
113 gezelter 2204
114 gezelter 1490 #endif
115 gezelter 2204
116 gezelter 1490 call FreeForceGlobals()
117 gezelter 2204
118 gezelter 1490 #ifdef IS_MPI
119    
120     allocate(q_Row(ndim,nAtomsInRow),stat=alloc_stat)
121     if (alloc_stat /= 0 ) then
122     thisStat = -1
123     return
124     endif
125 gezelter 2204
126 gezelter 1490 allocate(q_Col(ndim,nAtomsInCol),stat=alloc_stat)
127     if (alloc_stat /= 0 ) then
128     thisStat = -1
129     return
130     endif
131    
132     allocate(q_group_Row(ndim,nGroupsInRow),stat=alloc_stat)
133     if (alloc_stat /= 0 ) then
134     thisStat = -1
135     return
136     endif
137 gezelter 2204
138 gezelter 1490 allocate(q_group_Col(ndim,nGroupsInCol),stat=alloc_stat)
139     if (alloc_stat /= 0 ) then
140     thisStat = -1
141     return
142     endif
143 gezelter 2204
144 gezelter 1930 allocate(eFrame_Row(9,nAtomsInRow),stat=alloc_stat)
145 gezelter 1490 if (alloc_stat /= 0 ) then
146     thisStat = -1
147     return
148     endif
149 gezelter 2204
150 gezelter 1930 allocate(eFrame_Col(9,nAtomsInCol),stat=alloc_stat)
151 gezelter 1490 if (alloc_stat /= 0 ) then
152     thisStat = -1
153     return
154     endif
155 gezelter 2204
156 gezelter 1490 allocate(A_row(9,nAtomsInRow),stat=alloc_stat)
157     if (alloc_stat /= 0 ) then
158     thisStat = -1
159     return
160     endif
161 gezelter 2204
162 gezelter 1490 allocate(A_Col(9,nAtomsInCol),stat=alloc_stat)
163     if (alloc_stat /= 0 ) then
164     thisStat = -1
165     return
166     endif
167 gezelter 2204
168 gezelter 2361 allocate(pot_row(LR_POT_TYPES,nAtomsInRow),stat=alloc_stat)
169 gezelter 1490 if (alloc_stat /= 0 ) then
170     thisStat = -1
171     return
172     endif
173 gezelter 2204
174 gezelter 2361 allocate(pot_Col(LR_POT_TYPES,nAtomsInCol),stat=alloc_stat)
175 gezelter 1490 if (alloc_stat /= 0 ) then
176     thisStat = -1
177     return
178     endif
179    
180 gezelter 2361 allocate(pot_Temp(LR_POT_TYPES,nlocal),stat=alloc_stat)
181 gezelter 1490 if (alloc_stat /= 0 ) then
182     thisStat = -1
183     return
184     endif
185 gezelter 2204
186 gezelter 1490 allocate(f_Row(ndim,nAtomsInRow),stat=alloc_stat)
187     if (alloc_stat /= 0 ) then
188     thisStat = -1
189     return
190     endif
191 gezelter 2204
192 gezelter 1490 allocate(f_Col(ndim,nAtomsInCol),stat=alloc_stat)
193     if (alloc_stat /= 0 ) then
194     thisStat = -1
195     return
196     endif
197 gezelter 2204
198 gezelter 1490 allocate(f_Temp(ndim,nlocal),stat=alloc_stat)
199     if (alloc_stat /= 0 ) then
200     thisStat = -1
201     return
202     endif
203 gezelter 2204
204 gezelter 1490 allocate(t_Row(ndim,nAtomsInRow),stat=alloc_stat)
205     if (alloc_stat /= 0 ) then
206     thisStat = -1
207     return
208     endif
209 gezelter 2204
210 gezelter 1490 allocate(t_Col(ndim,nAtomsInCol),stat=alloc_stat)
211     if (alloc_stat /= 0 ) then
212     thisStat = -1
213     return
214     endif
215    
216     allocate(t_temp(ndim,nlocal),stat=alloc_stat)
217     if (alloc_stat /= 0 ) then
218     thisStat = -1
219     return
220     endif
221    
222     allocate(atid(nlocal),stat=alloc_stat)
223     if (alloc_stat /= 0 ) then
224     thisStat = -1
225     return
226     endif
227    
228    
229     allocate(atid_Row(nAtomsInRow),stat=alloc_stat)
230     if (alloc_stat /= 0 ) then
231     thisStat = -1
232     return
233     endif
234    
235     allocate(atid_Col(nAtomsInCol),stat=alloc_stat)
236     if (alloc_stat /= 0 ) then
237     thisStat = -1
238     return
239     endif
240    
241     allocate(rf_Row(ndim,nAtomsInRow),stat=alloc_stat)
242     if (alloc_stat /= 0 ) then
243     thisStat = -1
244     return
245     endif
246    
247     allocate(rf_Col(ndim,nAtomsInCol),stat=alloc_stat)
248     if (alloc_stat /= 0 ) then
249     thisStat = -1
250     return
251     endif
252    
253     allocate(rf_Temp(ndim,nlocal),stat=alloc_stat)
254     if (alloc_stat /= 0 ) then
255     thisStat = -1
256     return
257     endif
258    
259 gezelter 3470 allocate(ppot_Row(nAtomsInRow),stat=alloc_stat)
260 gezelter 3466 if (alloc_stat /= 0 ) then
261     thisStat = -1
262     return
263     endif
264    
265 gezelter 3470 allocate(ppot_Col(nAtomsInCol),stat=alloc_stat)
266 gezelter 3466 if (alloc_stat /= 0 ) then
267     thisStat = -1
268     return
269     endif
270    
271     allocate(ppot_Temp(nlocal),stat=alloc_stat)
272     if (alloc_stat /= 0 ) then
273     thisStat = -1
274     return
275     endif
276    
277 gezelter 1490 #else
278    
279     allocate(atid(nlocal),stat=alloc_stat)
280     if (alloc_stat /= 0 ) then
281     thisStat = -1
282     return
283     end if
284    
285     #endif
286 gezelter 2204
287 gezelter 1490 allocate(rf(ndim,nlocal),stat=alloc_stat)
288     if (alloc_stat /= 0 ) then
289     thisStat = -1
290     return
291     endif
292    
293     force_globals_initialized = .true.
294    
295     end subroutine InitializeForceGlobals
296 gezelter 2204
297 gezelter 1490 subroutine FreeForceGlobals()
298 gezelter 2204
299 gezelter 1490 !We free in the opposite order in which we allocate in.
300 gezelter 2204
301 gezelter 1490 if (allocated(rf)) deallocate(rf)
302     #ifdef IS_MPI
303 gezelter 3466 if (allocated(ppot_Temp)) deallocate(ppot_Temp)
304     if (allocated(ppot_Col)) deallocate(ppot_Col)
305     if (allocated(ppot_Row)) deallocate(ppot_Row)
306 gezelter 1490 if (allocated(rf_Temp)) deallocate(rf_Temp)
307     if (allocated(rf_Col)) deallocate(rf_Col)
308     if (allocated(rf_Row)) deallocate(rf_Row)
309     if (allocated(atid_Col)) deallocate(atid_Col)
310     if (allocated(atid_Row)) deallocate(atid_Row)
311     if (allocated(atid)) deallocate(atid)
312     if (allocated(t_Temp)) deallocate(t_Temp)
313     if (allocated(t_Col)) deallocate(t_Col)
314     if (allocated(t_Row)) deallocate(t_Row)
315     if (allocated(f_Temp)) deallocate(f_Temp)
316     if (allocated(f_Col)) deallocate(f_Col)
317     if (allocated(f_Row)) deallocate(f_Row)
318     if (allocated(pot_Temp)) deallocate(pot_Temp)
319     if (allocated(pot_Col)) deallocate(pot_Col)
320     if (allocated(pot_Row)) deallocate(pot_Row)
321     if (allocated(A_Col)) deallocate(A_Col)
322     if (allocated(A_Row)) deallocate(A_Row)
323 gezelter 1930 if (allocated(eFrame_Col)) deallocate(eFrame_Col)
324     if (allocated(eFrame_Row)) deallocate(eFrame_Row)
325 gezelter 1490 if (allocated(q_group_Col)) deallocate(q_group_Col)
326     if (allocated(q_group_Row)) deallocate(q_group_Row)
327 gezelter 1930 if (allocated(q_Col)) deallocate(q_Col)
328     if (allocated(q_Row)) deallocate(q_Row)
329 gezelter 1490 #else
330     if (allocated(atid)) deallocate(atid)
331     #endif
332 gezelter 2204
333 gezelter 1490 end subroutine FreeForceGlobals
334 gezelter 2204
335 gezelter 1490 end module force_globals