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

Comparing trunk/OOPSE-3.0/src/UseTheForce/DarkSide/force_globals.F90 (file contents):
Revision 1490 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
Revision 2361 by gezelter, Wed Oct 12 21:00:50 2005 UTC

# Line 1 | Line 1
1 + !!
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   ! Fortran interface to C entry plug.
44  
45   module force_globals
# Line 8 | 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 16 | Line 60 | module force_globals
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 <  real( kind = dp ), allocatable, dimension(:,:), public :: u_l_Row
64 <  real( kind = dp ), allocatable, dimension(:,:), public :: u_l_Col
63 >  real( kind = dp ), allocatable, dimension(:,:), public :: eFrame_Row
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 43 | 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 55 | 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 75 | 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 87 | 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 <      
141 <    allocate(u_l_Row(ndim,nAtomsInRow),stat=alloc_stat)
140 >
141 >    allocate(eFrame_Row(9,nAtomsInRow),stat=alloc_stat)
142      if (alloc_stat /= 0 ) then
143         thisStat = -1
144         return
145      endif
146 <    
147 <    allocate(u_l_Col(ndim,nAtomsInCol),stat=alloc_stat)
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(LR_POT_TYPES,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(LR_POT_TYPES,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(LR_POT_TYPES,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 218 | 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 228 | 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 252 | Line 296 | contains
296      if (allocated(pot_Row))    deallocate(pot_Row)
297      if (allocated(A_Col))      deallocate(A_Col)
298      if (allocated(A_Row))      deallocate(A_Row)
299 <    if (allocated(u_l_Col))    deallocate(u_l_Col)
300 <    if (allocated(u_l_Row))    deallocate(u_l_Row)
299 >    if (allocated(eFrame_Col))  deallocate(eFrame_Col)
300 >    if (allocated(eFrame_Row))  deallocate(eFrame_Row)
301      if (allocated(q_group_Col)) deallocate(q_group_Col)
302      if (allocated(q_group_Row)) deallocate(q_group_Row)    
303 <    if (allocated(q_Col))      deallocate(q_Col)
304 <    if (allocated(q_Row))      deallocate(q_Row)    
303 >    if (allocated(q_Col))       deallocate(q_Col)
304 >    if (allocated(q_Row))       deallocate(q_Row)    
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